Block Cipher Modes of Operation
What you'll learn: How block ciphers like AES combine multiple blocks of plaintext using different chaining strategies to encrypt data securely.
The Core Problem
You've learned about block ciphers like AES that encrypt fixed-size chunks (blocks) of data. But what happens when you need to encrypt a long message with many blocks? If you encrypt each block identically and independently, patterns in your plaintext will show through—identical plaintext blocks produce identical ciphertext blocks, revealing information to attackers.
Modes of operation solve this by defining how to apply a block cipher to multi-block messages.
Common Modes
ECB (Electronic Codebook)
The simplest mode: encrypt each block independently using the same key. Don't use this in practice—it preserves patterns. Think of it like using the same substitution for every word in a book; repeated words stand out.
CBC (Cipher Block Chaining)
Each plaintext block is XORed with the previous ciphertext block before encryption. The first block uses an initialization vector (IV). This creates a dependency chain—each block's ciphertext depends on all previous plaintext. Like a chain where each link connects to the one before it.
CTR (Counter Mode)
Turns a block cipher into a stream cipher. Encrypt sequential counter values, then XOR the results with plaintext blocks. Blocks can be encrypted in parallel, making it fast. Think of generating a pseudo-random pad synchronized with a counter.
Other Modes
GCM (Galois/Counter Mode) adds authentication, CFB and OFB provide different streaming properties—each mode balances security, performance, and use-case requirements.
Key Takeaway: Block cipher modes determine how individual blocks connect together when encrypting long messages; choosing the right mode (like CBC or CTR instead of ECB) is critical for security.