CBC mode

CBC stands for Cipher Block Chaining.

Under this mode the outcome of encrypting earlier blocks flow into the encryption of the current block. Every block of the encrypted text thus depends not only on the associated plaintext block but also on all the previous plaintext blocks. In addition, an initialisation block is required for the first plaintext block.

Encryption proceeds as follows:

  1. The first plaintext block is encrypted.

  2. The resulting block of encrypted text is linked to the next plaintext block by means of an Exclusive-OR and only then encrypted.

  3. This is repeated until the end of the plaintext is reached.

Decryption proceeds in analogous fashion:

  1. The first block of encrypted text is decrypted.

  2. The next block of encrypted text is first of all decrypted and then combined with the previous block of encrypted text by means of an Exclusive-OR.

  3. This is repeated until the end of the encrypted text is reached.

However, this method still has the disadvantage that two messages produce the same encrypted text up to the first difference. In particular, identical messages produce the same encrypted text. To prevent this, "initialisation vectors" are used. An initialisation vector is a random value which can be transmitted unencrypted with the message. Prior to encryption (or decryption, as the case may be) of the first block, this block is combined with the initialisation vector by means of an Exclusive-OR. The procedure then continues as described above.

In the ECB mode, every block is encrypted independently of the other blocks.