libmcrypt:

To use libmcrypt in your program include lcrypt.h. This file defines
these algorithms:
# define BLOWFISH 0
# define DES 1 
# define TripleDES 2
# define ThreeWAY 3
# define GOST 4
# define SAFER64 6
# define SAFER128 7
# define CAST128 8
# define TEAN 9      /* TEAN stands for TEA new */

Also these functions:

* Misc functions:

int get_block_size(int algorithm);
 Returns the block size of the given algorithm in bytes.
 Algorithm is one of the above.

int get_key_size(int algorithm); 
 Returns the key size of the given algorithm in bytes.


CBC, ECB and CFB are the modes that the algorithm may function.
ECB and CBC encrypt in blocks but CFB in bytes (8bits). 

* Initialization Functions:

int init_mcrypt_ecb(const int algorithm, void * key,const int lenofkey);
 Starts encryption in ECB mode, and returns a thread descriptor. 
 Returns (-1) on error.

int init_mcrypt_cbc(const int algorithm, void * key,const int lenofkey);
 Starts encryption in CBC mode, and returns a thread descriptor. 
 If you want to use an IV you must use it as the first block of your message. 
 The IV does not need to be unique nor secret, just random.
 Returns (-1) on error.

int init_mcrypt_cfb(const int algorithm, void * key,const int lenofkey, IV);
 Starts encryption in CFB mode, and returns a thread descriptor. 
 Unlike CBC mode the IV must be specified (since the whole encryption
 depends on this). That IV does not need to be secret it can be transmited
 as is. Although it should be unique for every message.
 Returns (-1) on error. 


* Encryption/Decryption Functions:

 ECB:
int mcrypt_ecb(int thread, void *plaintext, int len);
int mdecrypt_ecb(int thread, void *plaintext,int len);

 Using the thread descriptor you can now use these functions. len is the
 length in bytes of the plaintext and it should be k*(algorithms_block_size), 
 The plaintext is replaced by the ciphertext.
 You must have use init_mcrypt_ecb to use these functions.

 CBC:
int mcrypt_cbc(int thread, void *plaintext, int len);
int mdecrypt_cbc(int thread, void *plaintext, int len);

 Using the thread descriptor you can now use these functions.
 len is the length in bytes of the plaintext and it should be 
 k*(algorithms_block_size). Plaintext is replaced by the ciphertext
 You must have use init_mcrypt_cbc to use these functions.

 CFB (8 bit):
int mcrypt_cfb(int thread, void *plaintext, int len);
int mdecrypt_cfb(int thread, void *plaintext, int len);

 Using the thread descriptor you can now use these functions. Since CFB
 encrypts one byte a time there is no limitation for the len.
 Plaintext is replaced with the ciphertext. 
 You must have initialise init_mcrypt_cfb to use these functions.


* Freeing Memory functions:

int end_mcrypt_ecb(int td);
 Finishes (so it clears memory) encryption/decryption for the given
 thread descriptor. For ECB mode.

int end_mcrypt_cbc(int td);
 Finishes (so it clears memory) encryption/decryption for the given
 thread descriptor. For CBC mode only.

int end_mcrypt_cfb(int td);
 Finishes (so it clears memory) encryption/decryption for the given
 thread descriptor. For CFB mode only.


* Warning: The mcrypt_init_xxx are not re-entrant. If you use them
  in a multithreaded program, you should create a lock for these functions.
