cipher block chaining is a way to nondeterministically encrypt an arbitrary-length message using a block cipher.

  1. pad your message to a multiple of the block length
  2. generate a random initial vector (IV) . this is the first ciphertext.
  3. before encrypting block , XOR it with , i.e.
  4. and then output the ciphertext .

in diagram form:

note that you expect to see a block cipher input repeated after blocks have been encrypted with the same key , where is the block size in bits (TODO: why? so what?)