Feistel, DES, Triple DES and AES
◈ 7 cardsWhy the Feistel structure makes decryption free even when its round function is not invertible, and the block size, key size and round count of the three block ciphers the paper can name.
The Feistel structure — invertible by construction
Feistel's idea solves a real design problem: how do you build a cipher out of a complicated, thoroughly mixing function when you have no idea how to invert that function? The answer is to arrange the rounds so that the structure is invertible whether or not the function is.
Split a -bit block into a left and right half, . Round computes
where is a subkey derived from the key. Look at what round preserves: survives untouched as . So at decryption time you already have the argument was called with, and you can recompute and XOR it back off to recover . is never inverted; it is only ever evaluated forwards. That is why a one-way function — even a hash — can serve as a Feistel round function, and it is why decryption is the same algorithm run with the subkeys in reverse order.
Worked example — three rounds of a tiny Feistel network
Take an 8-bit block (), the round function , and subkeys , , . Start at (11), (6).
round 1: L1 = R0 = 0110 (6)
F(6, 5) = (36 + 5) mod 16 = 9
R1 = L0 XOR 9 = 11 XOR 9 = 0010 (2)
round 2: L2 = R1 = 0010 (2)
F(2, 3) = (4 + 3) mod 16 = 7
R2 = L1 XOR 7 = 6 XOR 7 = 0001 (1)
Complete round 3 the same way: , , and . The block after three rounds is .
Now undo round 3 with nothing but the round-3 subkey. We know , so immediately. And , so — which is exactly the we started round 3 with. Note that this is genuinely not invertible: and as well, so knowing an output does not determine its input. The round inverted anyway. That is the whole point of the structure.
DES
DES is the standard — FIPS 46, published 1977 by the National Bureau of Standards. The algorithm it specifies is called DEA, and the standard-versus-algorithm split is a classic exam trap. Its parameters: 64-bit block, 56-bit key, 16 rounds with 16 subkeys, a minor variant of the Feistel structure.
The key figure is 56, not 64. DES accepts a 64-bit key input, but every eighth bit is a parity bit and contributes nothing; 56 bits do the work. Swapping the block size and the key size is the most common single error on this material. And the reason DES died matters: decades of public analysis have turned up no fatal cryptanalytic weakness. The key length is the problem, not the algorithm — average trials is simply no longer a lot.
Triple DES
3DES keeps DEA and applies it three times in an encrypt–decrypt–encrypt arrangement:
With three independent keys the effective key length is 168 bits. With two keys, setting , it is 112 bits. Attaching 168 to the two-key variant is the trap.
Why is the middle stage a decryption? There is no cryptographic significance whatsoever — it is backward compatibility. Set and the expression collapses to , ordinary single DES, so a 3DES implementation can talk to a legacy DES peer. Learners routinely invent a security reason for it; there is none. Standardisation ran ANSI X9.17 (1985) to FIPS 46-3 (1999) to NIST SP 800-67 (2017). Its two drawbacks are that it is slow — three passes of an algorithm designed for 1970s hardware — and that its 64-bit block is too small for modern data volumes.
AES
AES is FIPS 197, published November 2001, from NIST's 1997 open call: fifteen candidates, five finalists, and Rijndael the winner. Its parameters:
- Block size is always 128 bits. Only the key varies. "AES has a variable block size" is false and is a reliable distractor.
- Key size 128, 192 or 256 bits, giving 10, 12 or 14 rounds respectively.
- It is not a Feistel cipher. The whole block is processed in parallel every round, and the consequence is that AES decryption is not the same algorithm as AES encryption — the free-decryption property Feistel buys you is precisely what AES gives up.
Each round is built from four transformations, and you should be able to name each one and say what it is for:
- SubBytes — a byte-by-byte table lookup. This is the substitution, and it supplies confusion.
- ShiftRows — the rows of the state are rotated left by 0, 1, 2 and 3 positions. Diffusion across rows.
- MixColumns — each byte of a column becomes a function of all four bytes of that column. Diffusion across columns.
- AddRoundKey — a bitwise XOR of the state with the round key. It is its own inverse, and it is the only transformation that uses the key.
Because AddRoundKey is the only key-dependent step, the cipher begins and ends with it: any transformation applied before the first or after the last AddRoundKey could be undone by an attacker without the key and would add nothing. Key expansion turns a 128-bit key into 44 words of 32 bits. And the final round omits MixColumns, which keeps the encryption and decryption structures aligned.