module Cipher:sig..end
Cipher module implements the AES, DES, Triple-DES, ARCfour
    and Blowfish symmetric ciphers.  Symmetric ciphers are presented
    as transforms parameterized by a secret key and a ``direction''
    indicating whether encryption or decryption is to be performed.
    The same secret key is used for encryption and for decryption.type | | | Encrypt | |||
| | | Decrypt | (* | Indicate whether the cipher should perform encryption (transforming plaintext to ciphertext) or decryption (transforming ciphertext to plaintext). | *) | 
type | | | ECB | |||
| | | CBC | |||
| | | CFB of  | |||
| | | OFB of  | (* | Block ciphers such as AES or DES map a fixed-sized block of
        input data to a block of output data of the same size.
        A chaining mode indicates how to extend them to multiple blocks
        of data.  The four chaining modes supported in this library are: 
 CBCis a recommended default.  ForCFB nandOFB n,
        note that the blocksize is reduced ton, but encryption
        speed drops by a factor ofblocksize / n, whereblocksizeis the block size of the underlying cipher; moreover,nmust be between1andblocksizeincluded. | *) | 
val aes : ?mode:chaining_mode ->
       ?pad:Cryptokit.Padding.scheme ->
       ?iv:string -> string -> direction -> Cryptokit.transform
        The optional mode argument specifies a
        chaining mode, as described above; CBC is used by default.
        The optional pad argument specifies a padding scheme to
        pad cleartext to an integral number of blocks.  If no pad
        argument is given, no padding is performed and the length
        of the cleartext must be an integral number of blocks.
        The optional iv argument is the initialization vector used
        in modes CBC, CFB and OFB.  It is ignored in ECB mode.
        If provided, it must be a string of the same size as the block size
        (16 bytes).  If omitted, the null initialization vector
        (16 zero bytes) is used.
        The aes function returns a transform that performs encryption
        or decryption, depending on the direction argument.
val des : ?mode:chaining_mode ->
       ?pad:Cryptokit.Padding.scheme ->
       ?iv:string -> string -> direction -> Cryptokit.transformdes function have the same meaning as
        for the Cryptokit.Cipher.aes function.  The key argument is
        a string of length 8 (64 bits); the least significant bit of
        each key byte is ignored.val triple_des : ?mode:chaining_mode ->
       ?pad:Cryptokit.Padding.scheme ->
       ?iv:string -> string -> direction -> Cryptokit.transformk1,
        decrypted with another 56-bit key k2, then re-encrypted with
        either k1 or a third 56-bit key k3.
        This results in a 112-bit or 168-bit key length that resists
        brute-force attacks.  However, the three encryptions required
        on each block make this cipher quite slow (4 times slower than
        AES).  The arguments to the triple_des function have the
        same meaning as for the Cryptokit.Cipher.aes function.  The
        key argument is a string of length 16 or 24, representing the
        concatenation of the key parts k1, k2, and optionally
        k3.  The least significant bit of each key byte is
        ignored.val arcfour : string -> direction -> Cryptokit.transformARCfour is popular for its speed: approximately 2 times faster than AES. It accepts any key length up to 2048 bits.
The ARCfour cipher is a stream cipher, not a block cipher. Hence, its natural block size is 1, and no padding is required. Chaining modes do not apply. A feature of stream ciphers is that the xor of two ciphertexts obtained with the same key is the xor of the corresponding plaintexts, which allows various attacks. Hence, the same key must never be reused.
        The string argument is the key; its length must be between
        1 and 256 inclusive.  The direction argument is present for
        consistency with the other ciphers only, and is actually
        ignored: for all stream ciphers, decryption is the same
        function as encryption.
val blowfish : ?mode:chaining_mode ->
       ?pad:Cryptokit.Padding.scheme ->
       ?iv:string -> string -> direction -> Cryptokit.transform
        The optional mode argument specifies a
        chaining mode, as described above; CBC is used by default.
        The optional pad argument specifies a padding scheme to
        pad cleartext to an integral number of blocks.  If no pad
        argument is given, no padding is performed and the length
        of the cleartext must be an integral number of blocks.
        The optional iv argument is the initialization vector used
        in modes CBC, CFB and OFB.  It is ignored in ECB mode.
        If provided, it must be a string of the same size as the block size
        (16 bytes).  If omitted, the null initialization vector
        (16 zero bytes) is used.
        The blowfish function returns a transform that performs encryption
        or decryption, depending on the direction argument.