This module contains wrappers for cryptographic functions
using the conduit package. Currently there is support for
hashes, HMACs and many modes of block ciphers (but not
everything crypto-api supports has a counterpart here).
All functions on this package work in constant memory.

Block ciphers

Electronic codebook mode (ECB)

A Conduit that encrypts a stream of ByteStrings
using ECB mode. Expects the input length to be a multiple of
the block size of the cipher and fails otherwise. (Note that
ECB has many undesirable cryptographic properties, please
avoid it if you don't know what you're doing.)

Cipher-block chaining message authentication code (CBC-MAC)

A Sink that computes the CBC-MAC of a stream of
ByteStrings and creates a digest (already encoded in a
ByteString, since we're using a block cipher). Expects
the input length to be a multiple of the block size of the
cipher and fails otherwise. (Note that CBC-MAC is not secure
for variable-length messages.)

Internal helpers

A Conduit that takes arbitrary ByteStrings and
outputs Blocks. Each Full block will have a length that
is multiple of the given block size (either exactly the block
size or a multiple of at least 1x the block size, depending on
the BlockMode). All Blocks beside the last one will be
Full. The last block will always be LastOne with less
bytes than the block size, possibly zero.