# Module Cryptokit.Block

    module Block: sig .. end

The `Block` module provides classes that implements popular block ciphers, chaining modes, and wrapping of a block cipher as a general transform or as a hash function. The classes can be composed in a Lego-like fashion, facilitating the integration of new block ciphers, modes, etc.

    class type block_cipher = object .. end

Abstract interface for a block cipher.

## Deriving transforms and hashes from block ciphers

    class cipher : block_cipher -> Cryptokit.transform

Wraps a block cipher as a general transform.

    class cipher_padded_encrypt : Cryptokit.Padding.scheme -> block_cipher -> Cryptokit.transform

Like `Cryptokit.Block.cipher`, but performs padding on the input data as specified by the first argument.

    class cipher_padded_decrypt : Cryptokit.Padding.scheme -> block_cipher -> Cryptokit.transform

Like `Cryptokit.Block.cipher`, but removes padding on the output data as specified by the first argument.

    class mac : ?iv:string -> ?pad:Cryptokit.Padding.scheme -> block_cipher -> Cryptokit.hash

Build a MAC (keyed hash function) from the given block cipher.

    class mac_final_triple : ?iv:string -> ?pad:Cryptokit.Padding.scheme -> block_cipher -> block_cipher -> block_cipher -> Cryptokit.hash

Build a MAC (keyed hash function) from the given block ciphers `c1`, `c2` and `c3`.

## Some block ciphers: AES, DES, triple DES, Blowfish

    class aes_encrypt : string -> block_cipher

The AES block cipher, in encryption mode.

    class aes_decrypt : string -> block_cipher

The AES block cipher, in decryption mode.

    class des_encrypt : string -> block_cipher

The DES block cipher, in encryption mode.

    class des_decrypt : string -> block_cipher

The DES block cipher, in decryption mode.

    class triple_des_encrypt : string -> block_cipher

The Triple-DES block cipher, in encryption mode.

    class triple_des_decrypt : string -> block_cipher

The Triple-DES block cipher, in decryption mode.

    class blowfish_encrypt : string -> block_cipher

The Blowfish block cipher, in encryption mode.

    class blowfish_decrypt : string -> block_cipher

The Blowfish block cipher, in decryption mode.

## Chaining modes

    class cbc_encrypt : ?iv:string -> block_cipher -> block_cipher

Add Cipher Block Chaining (CBC) to the given block cipher in encryption mode.

    class cbc_decrypt : ?iv:string -> block_cipher -> block_cipher

Add Cipher Block Chaining (CBC) to the given block cipher in decryption mode.

    class cfb_encrypt : ?iv:string -> int -> block_cipher -> block_cipher

Add Cipher Feedback Block (CFB) to the given block cipher in encryption mode.

    class cfb_decrypt : ?iv:string -> int -> block_cipher -> block_cipher

Add Cipher Feedback Block (CFB) to the given block cipher in decryption mode.

    class ofb : ?iv:string -> int -> block_cipher -> block_cipher

Add Output Feedback Block (OFB) to the given block cipher.

    class ctr : ?iv:string -> ?inc:int -> block_cipher -> block_cipher

Add Counter mode to the given block cipher.