Module Cryptsystem_64


module Cryptsystem_64: sig .. end
The module type of a cryptsystem using 64 bit block ciphers. Such a module is normally not used directly to encrypt messages. Only interesting for the average programmer are the key handling functions: HOW TO TRANSFORM A PASSWORD/PASSPHRASE INTO A KEY:

It is not recommended to apply 'prepare' directly to the passphrase that the user types in. As letters are much more likely than other characters, and some bits are never used, the number of different keys would be MUCH smaller than the number of possible keys. To avoid this, apply an MD5 hash function on the ascii representation of the passphrase before passing the value to 'prepare', i.e.

let k = prepare (Digest.substring passphrase 0 (String.length passphrase))

Note, that the resulting key has not more than 128 bits, even if the passphrase is longer. To get a 256 bit key, you can concatenate the MD5 of the passphrase and the MD5 of the reverted passphrase. Up to now, 128 bit keys are secure.


module type T = sig .. end