liveBook · Manning

Electronic codebook mode

As explained in Hacking Cryptography

Electronic codebook is a block cipher mode that encrypts each block independently with the same key.

Electronic codebook (ECB) mode encrypts each plaintext block independently with the same key. Because identical plaintext blocks produce identical ciphertext blocks, the ciphertext can reveal repeated patterns in the original data. section 5.3

Figure 5.5 ECB mode encrypts each block independently of other blocks.
figure

This figure shows the defining implementation property: ECB encrypts every block independently rather than incorporating neighboring blocks. section 5.3

The ECB penguin

Encrypting an image with ECB can leave its broad features recognizable. Repeated or related pixel blocks preserve enough spatial structure for darker and lighter regions to remain visible, even without the key or decryption. section 5.3

Treat ECB as a warning sign when encrypting multiple blocks:

  • Do not use ECB for real-world applications because it reveals plaintext patterns. section 5.3
  • Choose a mode that prevents repeated plaintext blocks from producing identical ciphertext; CBC is presented as a commonly used alternative and requires a unique IV for each message. section 5.3 section 5.6

How Hacking Cryptography covers it

How deep it goes
Defines independent block processing and demonstrates its visual consequence, but does not detail a code-level implementation.
Examples
Uses repeated plaintext blocks and the recognizable ECB-encrypted penguin image to expose structural leakage.
What it assumes
Assumes familiarity with plaintext, ciphertext, keys, blocks, and padding while contrasting block and stream cipher processing.
What you can do after
Evaluate encryption designs by recognizing ECB pattern leakage and selecting a mode with per-message variability.
How it connects
Connects ECB to block ciphers, padding, CBC mode, initialization vectors, and stream ciphers.

Also explained in

Compare how 3 books explain electronic codebook mode →

Related concepts

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