Week 3 · Block ciphers · KL 7.2
ShiftRows and MixColumns are the diffusion half of AES. One moves bytes across columns, the other mixes within a column. Change a single input byte and step through the round to watch its influence reach the entire 4×4 state in just two rounds.
The state is the 16-byte AES block written as a 4×4 grid of bytes, column by column. A shaded cell marks a byte whose value would change because of the one flipped input byte. Use Next and Prev, or the arrow keys, to move through the operations.
AES is a substitution–permutation network. Each round does three jobs, and the four named operations map onto them: SubBytes is the substitution, ShiftRows and MixColumns together are the permutation and diffusion layer, and AddRoundKey is the key mixing. SubBytes and AddRoundKey act byte-by-byte, so only the two diffusion steps move influence between cells.
S-box on each byte, in place.
Row r rotates left by r — moves bytes across columns.
Mixes the four bytes within each column over GF(2⁸).
XOR the round key into the state.
↑ ShiftRows + MixColumns = the diffusion layer
AES-128 repeats this round ten times, after an initial AddRoundKey before the first round. The final round keeps SubBytes, ShiftRows and AddRoundKey but drops MixColumns.
SubBytes → ShiftRows → MixColumns → AddRoundKey.
SubBytes → ShiftRows → AddRoundKey.
Two reasons it is dropped. A MixColumns at the very end adds no security, because an attacker can simply invert it before the last AddRoundKey — it mixes nothing they cannot unmix. And omitting it lines encryption and decryption up into the same sequence of layer types, which lets a decryption round reuse the structure of an encryption round.