Each algorithm has an adt that holds the current state for a given encryption. It is produced by the setup function for the algorithm, alg setup , which is given a secret key and an initialisation vector ivec . A sequence of blocks of data can then be encrypted or decrypted by repeatedly calling alg cbc (for `cipher block chaining'), or alg ebc (the less secure `electronic code book', if provided). On each call, buf provides n bytes of the data to encrypt or decrypt. N must be a multiple of the encryption block size ALG bsize . Exceptionally, aescbc allows n to be other than a multiple of AESbsize in length, but then for successful decryption, the decryptor must use the same sequence of buffer sizes as the encryptor. Direction is the constant Encrypt or Decrypt as required. State maintains the encryption state, initially produced by the setup function, and updated as each buffer is encrypted or decrypted.
The algorithms currently available are:
aes The Advanced Encryption Standard, AES (also known as Rijndael). The key should be 16, 24 or 32 bytes long (128, 192 or 256 bits). Ivec should be AESbsize bytes of random data: random enough to be unlikely to be reused but not cryptographically strongly unpredictable.
blowfish Bruce Schneier's symmetric block cipher. The key is any length from 4 to 56 bytes. Ivec if non-nil is BFbsize bytes of random data. For blowfishcbc , n must be a multiple of BFbsize .
des The older Data Encryption Standard, DES. Key is 8 bytes (64 bits), containing a 56-bit key encoded into 64 bits where every eighth bit is parity. Ivec is DESbsize bytes of random data.
idea The International Data Encryption Standard, IDEA™. The key is 16 bytes long (128 bits). Ivec is IDEAbsize bytes of random data.
IDEA was patented by Ascom-Tech AG (EP 0 482 154 B1, US005214703), currently held by iT_SEC Systec Ltd. The patent expired in 2012.