Function types

In CBC or Cipher Block Chaining mode each block is XORed with
the previous enciphered block before encryption. For the first
block, start with an initialization vector.
Take an encryption function, an initialisation vector, a key and
a list of blocks and return the encrypted blocks using CBC.

To decipher in CBC or Cipher Block Chaining mode, decipher
each block, then XOR the result with the previous block of
plaintext result. Note that the initialization vector is treated as the
zeroth block of plaintext.
Take a decryption function, an initialisation vector, a key and a list
of encrypted blocks using CBC and return plaintext blocks.