                 DES Cryptosystem DLL by Andy Brown 1994
                 ---------------------------------------

Description
-----------
DES is the well known U.S. Data Encryption Standard cipher. DES encrypts
data in 64 bit blocks, using a 64 bit key -- of which 56 bits are used in
the encipherment process. The code in this DLL is an adaptation of the
`libdes' package which I got from everyone's favourite one-stop
crypto-shop, nic.funet.fi. I'm afraid the name of the original author
escapes me, but thanks to him anyway for a great package.


Using DES.DLL
-------------
For Borland C++ IDE projects, add DES.LIB to your project. Makefile based
projects need to add DES.LIB to the linker stage.

Include DES.H in any of your project files that need to call the DES
encryption routines.

Ensure DES.DLL is either in somewhere in your PATH environment variable, or
in your Windows SYSTEM directory.

The file `cert.txt' contains a list of plaintext/key/ciphertext values that
you can use to make sure that your DES code is functioning correctly


                                   API
                                   ---

int FAR PASCAL des_key_sched(des_cblock FAR *key,
                             des_key_schedule FAR *sched)

key     FAR pointer to a 64 bit key. a `des_cblock' is simply an 8-byte
        unsigned character array so you can just pass the address of an 8
        byte array as this parameter.

sched   FAR pointer to an address of a des_key_schedule structure that the
        function will fill in with the DES key schedule information that
        you will need to pass to the encryption/decryption function.

        You need to call this function before you use the des_ecb_encrypt
        function to operate on your data. It performs some initial
        operations on your key, presumably to make the operation of the
        cipher faster.

        Always returns zero.

int FAR PASCAL des_ecb_encrypt(des_cblock FAR *input,
                               des_cblock FAR *output,
                               des_key_schedule FAR *ks,
                               int encrypt)

input   FAR pointer to an 8 byte block to be encrypted/decrypted
output  FAR pointer to an 8 byte block to hold the results of the
        encryption/decryption
ks      FAR pointer to the des_key_schedule structure that you were given
        by the des_key_sched() function (above)
encrypt 1 (TRUE) if you encrypting, 0 (FALSE) if you are decrypting


Example
-------
To encrypt an 8 byte block, you may have a program fragment like this:

void encrypt_block(BYTE *block,BYTE *key)
{
des_key_schedule ks;

  des_key_sched(&key,&ks);
  des_ecb_encrypt(&block,&block,1);
}

The function prototypes in des.h should ensure that you don't have to
explicitly cast the arguments.


Comments
--------
The DLL was compiled with Borland C++ v3.1 with optimizations set to
`fastest', using the 286 instruction set option. You can probably get quite
a speed increase using the 386 instruction set.


Have fun,

Andy

+---------------------------+----------------------------------------------+
| Andy <asb@cs.nott.ac.uk>  | PGP key fingerprint: EC 80 9C 96 54 63 CC 97 |
|    finger for PGP key     |                    : FF 7D C5 69 0B 55 23 63 |
+---------------------------+----------------------------------------------+
