3. Block Ciphers & DES
Scrambling data in fixed-size chunks
A stream cipher processes data one byte at a time. A block cipher takes a different approach: it divides the input into fixed-size blocks (typically 8 or 16 bytes) and applies a complex, key-dependent transformation to each block independently.
The Data Encryption Standard (DES), published in 1977, was the first widely adopted block cipher and defined the blueprint that all modern block ciphers follow: multiple rounds of substitution and permutation, each controlled by a piece of the key.
The Block Cipher Concept
Basic structure
┌──────────────┐
Plaintext block ─→│ │─→ Ciphertext block
(n bits) │ Block Cipher │ (n bits)
Key ─────────────→│ │
└──────────────┘
Same input + same key = same output (deterministic)
Different key = completely different output
A block cipher is a keyed permutation: for any given key, it maps every possible input block to a unique output block. No two inputs produce the same output, and no information is lost — the transformation is fully reversible.
Shannon's Principles: Confusion and Diffusion
In 1949, Claude Shannon identified two properties that any good cipher must have:
Confusion
Each bit of the ciphertext should depend on many bits of the key. This obscures the relationship between key and ciphertext. Achieved through substitution (S-boxes).
Diffusion
Changing one bit of plaintext should change many bits of ciphertext. This spreads the influence of each input bit across the output. Achieved through permutation and mixing.
The Avalanche Effect
A good block cipher exhibits the avalanche effect: flipping a single bit in the plaintext (or key) should flip approximately half the bits in the ciphertext. The output should look completely unrelated to the input.
Feistel Networks — DES's Architecture
DES uses a structure called a Feistel network, invented by Horst Feistel at IBM. The clever trick: you don't need the round function to be reversible. The structure itself guarantees reversibility.
-
Split the block in half
The 64-bit input is divided into a left half (L) and right half (R), each 32 bits.
-
Apply the round function
Pass the right half through a complex function F with the round key:
F(R, Ki). -
XOR with the left half
Compute
L ⊕ F(R, Ki). This becomes the new right half. -
Swap halves
The old right half becomes the new left half. Repeat for the next round.
One Feistel round
Input: L₀ = 1010... R₀ = 0111... Round key: K₁
L₀ R₀
│ │
│ ┌────────┐ │
│ │ F(R,K₁)│←──┤
│ └───┬────┘ │
│ │ │
⊕←───────┘ │
│ │
↓ ↓
R₁ = L₀⊕F(R₀,K₁) L₁ = R₀
To decrypt: run the same structure in reverse order of round keys.
The beauty of a Feistel network is that decryption uses the exact same circuit as encryption — you just feed in the round keys in reverse order. This made DES cheap to implement in hardware.
DES Specifics
| Property | Value |
|---|---|
| Block size | 64 bits (8 bytes) |
| Key size | 56 bits (plus 8 parity bits = 64 bits total) |
| Number of rounds | 16 |
| Round function | Expansion → XOR with round key → 8 S-boxes → Permutation |
| Key schedule | 56-bit key → 16 round keys of 48 bits each |
The DES Round Function (F)
Inside one DES round
R (32 bits)
│
↓
┌───────────┐
│ Expansion │ 32 → 48 bits (some bits duplicated)
└────┬──────┘
│
⊕ ← Round key K_i (48 bits)
│
↓
┌───────────┐
│ 8 S-boxes │ 48 → 32 bits (the nonlinear core)
└────┬──────┘
│
↓
┌───────────┐
│Permutation│ 32 → 32 bits (bit shuffling)
└────┬──────┘
│
↓
F(R, K_i)
The S-boxes (substitution boxes) are the heart of DES. Each S-box takes 6 input bits and produces 4 output bits using a fixed lookup table. This nonlinear substitution is what provides confusion — without it, DES would be a linear function and trivially breakable.
Why DES is Broken
56 Bits Is Not Enough
A 56-bit key means 256 ≈ 72 quadrillion possible keys. That sounds like a lot, but in 1998 the EFF built a machine called Deep Crack for $250,000 that could brute-force a DES key in about 56 hours. Today, it would take minutes.
Even before brute-force became practical, cryptanalysts developed theoretical attacks:
- Differential cryptanalysis (Biham & Shamir, 1990) — analyze how differences in plaintext pairs propagate through the cipher
- Linear cryptanalysis (Matsui, 1993) — find linear approximations of the S-boxes
Both attacks need fewer operations than brute force, though they require many known plaintext-ciphertext pairs.
Triple DES (3DES) — A Stopgap
Rather than designing a new cipher, the industry extended DES by applying it three times with two or three different keys:
Triple DES (EDE mode)
Ciphertext = DES_encrypt(K₃, DES_decrypt(K₂, DES_encrypt(K₁, Plaintext)))
With 3 independent keys: effective key length = 168 bits
With 2 keys (K₁=K₃): effective key length = 112 bits
The encrypt-decrypt-encrypt (EDE) pattern means that if K₁=K₂=K₃, Triple DES degrades gracefully to single DES — useful for backward compatibility.
Triple DES is secure but slow — three times the work of DES, with a block size still stuck at 64 bits. By the late 1990s, it was clear that a clean replacement was needed. That replacement was AES.
Real-World Legacy
| System | Role of DES/3DES |
|---|---|
| ATM networks | Used DES for PIN encryption for decades |
| Payment cards (EMV) | 3DES still used in some card transaction authentication |
| Early SSL/TLS | DES and 3DES were standard cipher suites |
| Kerberos | DES was the original default encryption type |
| NIST (2023) | 3DES officially deprecated — withdrawn from all new applications |
Try It Yourself — DES Feistel Rounds
Enter a 64-bit plaintext and key as hex (16 characters each). Use the slider to step through all 16 Feistel rounds and watch the left and right halves transform.
Statistics
Avalanche Effect — One Bit Changes Everything
This demo encrypts two plaintexts that differ by a single bit and compares the internal state at every round. A good cipher should reach ~50% bit difference (32 out of 64) within just a few rounds.
Key Takeaways
- Block ciphers encrypt fixed-size chunks of data using multiple rounds of substitution and permutation
- Confusion (S-boxes) obscures the key; diffusion (permutation) spreads each bit's influence across the block
- Feistel networks make decryption automatic — same circuit, reverse key order
- DES was groundbreaking but its 56-bit key is fatally small by modern standards
- Triple DES patched the key size but tripled the cost — a proper replacement was needed
DES showed the world how to build a block cipher, but its 56-bit key and 64-bit block are too small for modern security. In 2001, NIST selected a new standard: AES — a fundamentally different design that's faster, more secure, and still unbroken today.