# 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:

- prepare: preprocesses the string representation of the key and get the internal representation. For some ciphers, this is a very expensive operation (e.g. for blowfish).
- is_weak: for some ciphers, some keys have bad characteristics and should not be used to encrypt messages. These keys are called weak.

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