Block Ciphers and Operation Modes
What Encryption Is For
Encryption serves one primary goal: confidentiality. It transforms readable data — called plaintext — into an unreadable form called ciphertext in such a way that only a party possessing the secret key can reverse the process. Without the key, the ciphertext should reveal nothing about the original message.
For most of modern computing, that standard is met by AES — the Advanced Encryption Standard. AES is the workhorse of symmetric encryption: it is fast in hardware and software, standardized by NIST, and deployed in virtually every TLS connection, encrypted disk, and secure messaging protocol in use today.
The One-Block Problem
AES operates on exactly one fixed-size block at a time: 16 bytes (128 bits). Encrypt a 16-byte input, get a 16-byte output. The relationship between input and output looks completely random to anyone without the key — cryptographically solid.
The difficulty begins as soon as your data exceeds 16 bytes. You have to split it into multiple blocks and encrypt them in sequence. The question is: how do you sequence those block encryptions? That decision is called a mode of operation, and it turns out the answer matters enormously.
ECB — The Dangerous Default
ECB (Electronic Codebook) is the simplest possible answer: encrypt each block independently, using the same key, with no other input. Block 1 goes in, encrypted Block 1 comes out. Block 2 goes in, encrypted Block 2 comes out. Nothing connects them.
This sounds reasonable until you notice the consequence: if any two plaintext blocks are identical, their ciphertext blocks will also be identical. The encryption function is deterministic — same input, same key, same output, every time.
The ECB Penguin
The most striking demonstration of this flaw is the ECB penguin. Researchers took a bitmap image of Tux — the Linux mascot — and encrypted it with AES in ECB mode. A bitmap image of a simple cartoon penguin on a white background contains large regions of solid color: solid white background, solid black body, solid orange beak and feet. Those regions are composed of thousands of identical 16-byte blocks.
After ECB encryption, the resulting ciphertext file, when rendered as an image, still shows the penguin's outline. The large regions of identical pixel values produced identical ciphertext blocks, and the structural pattern of the original image survived encryption intact. Confidentiality failed completely — not because the cipher was weak, but because the mode was wrong.
Real-World Implications
The penguin is not merely a classroom curiosity. Any data that contains repeated patterns — session tokens with a fixed prefix, database rows with identical field values, XML documents with repeated tags, encrypted log files with predictable structure — is vulnerable to the same pattern-leakage attack. An attacker observing ECB-encrypted traffic can detect repeated blocks, infer which blocks are identical, and in some cases craft chosen-plaintext inputs that allow them to decrypt individual blocks incrementally. No key recovery is required.
What You Will Do
In the visualizer panel accompanying this lesson, you will enter plaintext and observe how it is partitioned into 16-byte blocks. You will see both ECB and CBC modes render the resulting ciphertext blocks, and you will observe directly that ECB preserves block-level patterns while CBC does not. The pre-filled example — ATTACKATDAWNATTACKATDAWN — is chosen precisely because the 16-byte blocks repeat, making the pattern visually obvious.