The output file for all the algorithms (except unix crypt) when not used in
bare mode is:

3 bytes as: NULL + "m" + NULL
1 byte the algorithm (the algorithm's number is defined in lib/mcrypt.h)
1 byte the algorithm's mode (CBC, ECB, CFB, OFB) (also in lib/mcrypt.h)
1 byte storing the mode in which mcrypt read the key. (7bit or 8bit) (1,0)
blocksize bytes the crc32 of the plaintext(encrypted) 
  (the first 32 bits of the encrypted text are the crc32)
blocksize bytes the IV 
 (if CBC,OFB, or CFB. In CBC the IV is encrypted, in OFB or CFB it is unencrypted)
x bytes encrypted data (x=k*blocksize, k=1,2...)
1 byte the number of bytes that didn't fit to the algorithm and were
  padded. (this byte does not exist in CFB and OFB modes) This
  number should be 0 <= x < blocksize

blocksize is 8 bytes for DES, CAST, 3DES, Blowfish, GOST, TEA, Safer 
and 12 bytes for 3-way. 
