liveBook · Manning

Cipher block chaining mode

As explained in Real-World Cryptography

Cipher block chaining is a block-cipher mode that XORs each plaintext block with the preceding ciphertext block before encryption, using an initialization vector for the first block.

Encrypting each block independently can preserve visible patterns, as the ECB penguin demonstrates. Cipher block chaining (CBC) hides those repetitions by combining each plaintext block with an unpredictable value before encryption. section 4.3

CBC encryption follows a short chain:

  • Generate a random, unpredictable initialization vector (IV), 16 bytes for AES. section 4.3
  • XOR the IV with the first plaintext block, then encrypt the result. section 4.3
  • XOR each later plaintext block with the preceding ciphertext block before encrypting it. section 4.3
  • Transmit the IV in clear text with the ciphertext so decryption can reverse the process. section 4.3

The ECB penguin

An image encrypted with ECB still reveals its outline because repeated plaintext blocks produce repeated ciphertext blocks. CBC uses a random IV and chained ciphertext blocks to produce different ciphertext for repeated plaintext encrypted separately. section 4.3

How Real-World Cryptography covers it

How deep it goes
Explains IV generation, XOR chaining, padding, encryption, and decryption, but stops short of implementation details.
Examples
Uses the ECB penguin, AES diagrams, and an eight-byte padding example.
What it assumes
Assumes familiarity with block encryption and XOR while establishing CBC’s operation from the ECB pattern problem.
What you can do after
Evaluate/understand how CBC randomizes block encryption and why decryption requires the associated IV.
How it connects
Connects block ciphers with AES, XOR, initialization vectors, padding, ciphertext, and ECB.

Also explained in

Compare how 3 books explain cipher block chaining mode →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Real-World Cryptography. The section links point to the parts of the book it draws on.