What are the four operations that AES performs in each round?
SubBytes (substitute bytes through an S-box), ShiftRows (shift rows of the state), MixColumns (mix the columns), AddRoundKey (XOR with the round key).
Each round applies these four steps to a 4×4 byte matrix of the state:
| Step | What it does | Cryptographic purpose |
|---|---|---|
| SubBytes | Replace each byte by an entry from a fixed 256-entry S-box (substitution box) | Confusion — non-linear relationship between key and ciphertext |
| ShiftRows | Cyclically shift rows of the state (row 0 by 0, row 1 by 1, …) | Diffusion — spread bytes horizontally |
| MixColumns | Multiply each column by a fixed matrix in GF(2⁸) | Diffusion — spread bytes vertically |
| AddRoundKey | XOR the state with the round key (derived from the master key via the key schedule) | Mix the key into the data — XOR is the symmetric crypto workhorse |
The "confusion vs diffusion" mantra (Claude Shannon, 1949):
- Confusion = make the relationship between key and ciphertext as complex as possible (the S-box).
- Diffusion = spread the influence of one plaintext bit over many ciphertext bits (ShiftRows + MixColumns).
A single AES round only modestly confuses & diffuses; ten rounds (for AES-128) avalanche a single bit change throughout the whole 128-bit block.
Tip: The mnemonic is "SSMA" for SubBytes, ShiftRows, MixColumns, AddRoundKey — the order matters, and the final round skips MixColumns (a quirk that simplifies decryption). You don't need to memorise the math; understanding why each step exists (confusion or diffusion) is the goal.