The one-sentence version
AES treats each byte as an element of the finite field . Its S-box is "take the multiplicative inverse, then apply an affine transformation"; MixColumns is a polynomial multiplication. Designing with algebraic structure rather than an arbitrarily drawn table gives AES provable resistance to known attacks.
This article has three layers:
- The intuition: confusion and diffusion, and what each AES round does
- Real-world use: AES is everywhere, and why it isn't afraid of quantum computers
- The mathematics: constructing , the S-box, MixColumns and worked examples from the FIPS 197 standard
Layer 1: The Intuition
1.1 Symmetric encryption has two jobs
Shannon proposed in 1949 that a good block cipher must achieve both:
- Confusion: the relationship between ciphertext and key should be as complex and nonlinear as possible, so it can't be solved with a system of linear equations.
- Diffusion: changing one plaintext bit should change about half of the ciphertext bits (the "avalanche effect").
AES is a machine that does these two things over and over for 10 to 14 rounds.
1.2 One round of AES
AES arranges 16 bytes of data into a square, and each round has four steps:
| Step | What it does | Purpose |
|---|---|---|
| SubBytes | Replaces each byte using the S-box | Confusion: the only nonlinear step |
| ShiftRows | Rotates row left by positions | Diffusion: spreads bytes across columns |
| MixColumns | Multiplies each column by a fixed matrix | Diffusion: every byte in a column affects the whole column |
| AddRoundKey | XORs with this round's subkey | Brings in the key |
After two rounds, any single input byte already affects all 16 output bytes.
1.3 Why use a finite field
A byte has 256 possible values. We want to "multiply" and "divide" bytes and still get a byte. Ordinary integer multiplication overflows, and modulo 256 isn't a field ( means zero divisors, so division fails).
The solution is to treat a byte as a polynomial with coefficients 0 or 1, and compute modulo an irreducible polynomial. Then the 256 bytes form exactly a field: you can add, subtract, multiply and divide, and every nonzero element has an inverse.
Layer 2: Real-World Use
AES is the standard chosen by the US NIST through an open competition in 2001 (originally called Rijndael, designed by two Belgian cryptographers). Today it is nearly everywhere:
- Data encryption in HTTPS (AES-GCM)
- Full-disk encryption on phones and computers (iOS, Android, BitLocker, FileVault)
- Wi-Fi WPA2/WPA3, VPNs, encrypted archives
- Cryptocurrency wallet files, password managers
Hardware acceleration: Intel and AMD's AES-NI instructions and ARM's cryptography extensions implement an AES round directly on the chip, reaching several GB per second.
Quantum computers: AES has no algebraic trapdoor like RSA's, so Shor's algorithm doesn't apply; Grover's algorithm only reduces brute force from to about . So AES-256 is enough to cope. See "Post-Quantum Cryptography" for details.
The real risk is in the implementation
AES itself has had no practical attacks in over twenty years. The incidents all come from how it is used: ECB mode (identical plaintext blocks give identical ciphertext blocks, the famous "penguin still clearly visible after encryption"), nonce reuse in GCM mode, and cache-timing side channels from table-based implementations.
Layer 3: The Mathematics
3.1 Constructing
Take (where addition is XOR). The polynomial
is irreducible over , so is a maximal ideal of , and the quotient ring
is a field with elements (abstract algebra: is a field if and only if is irreducible).
A byte corresponds to the polynomial . For example 0x57 corresponds to .
- Addition: add coefficients bit by bit modulo 2, which is XOR.
- Multiplication: multiply the polynomials, then take the remainder modulo . In implementations, "multiply by = shift left one bit, and XOR
0x1Bon overflow".
3.2 A worked example: multiplication
{57} · {83} = {C1} (the example from FIPS 197)
{57} and {83} .
First, ordinary polynomial multiplication (coefficients modulo 2):
Then reduce modulo : repeatedly lower the degree using , finally getting
(Checked with Python.)
3.3 The S-box = inverse + affine transformation
For each byte :
- Invert: in (by convention );
- Affine transformation: treat as a vector in and compute , where is a fixed circulant matrix:
S(53) = ED (the example from FIPS 197)
- Inverse: the inverse of
{53}is{CA}; you can verify that{53}·{CA} = {01} - The affine transformation then gives
{ED}
Also, S(00) = 63: the "inverse" of is still , leaving only the constant 63. (Checked with Python.)
Why use inversion: is highly nonlinear on . Nyberg (1993) proved that such maps have near-optimal resistance to differential attacks and linear attacks: any input difference produces a given output difference with probability at most .
Why add an affine transformation too: the algebraic structure of pure inversion is too "clean" and might be exploited by algebraic attacks (such as interpolation attacks), and and are fixed points. The affine transformation disrupts this structure and ensures the S-box has no fixed points or "opposite fixed points".
3.4 MixColumns = polynomial multiplication modulo
The 4 bytes of each column are treated as a cubic polynomial with coefficients in , , and then
Because , this is a cyclic convolution, which as a matrix is
Note that is reducible in characteristic 2, so this quotient ring isn't a field, but is coprime to and therefore invertible; decryption just multiplies by its inverse .
This matrix is also an MDS matrix (the same concept as MDS codes in Reed–Solomon error correction): the total number of nonzero bytes in input and output is at least 5. This guarantees the speed of diffusion, and is the core of the AES designers' "wide trail strategy".
Summary
| Layer | Key points |
|---|---|
| Intuition | Confusion comes from the S-box, diffusion from ShiftRows and MixColumns, repeated for a dozen or so rounds |
| Algebra | A byte an element of ; an irreducible polynomial gives a field |
| Design | S-box inverse + affine, resisting differential and linear attacks; MixColumns is MDS |
| Engineering | The algorithm is solid; the risks are misused modes and side channels; AES-256 withstands quantum computers |