AES: the maths
The finite field with 256 elements, the construction of the S-box and the MixColumns calculation: the mathematics that makes AES robust.
AES works on bytes by treating them as elements of a finite field with 256 elements, written GF(2^8). In this field you can add, multiply and divide while always staying within the 256 possible values.
- Addition
- In GF(2^8) the sum of two bytes is the bitwise XOR operation.
- Multiplication
- Bytes are multiplied as polynomials and the remainder of division by a fixed degree-8 polynomial is taken.
- S-box
- Each byte is replaced by its multiplicative inverse in the field, followed by an affine transformation: a construction chosen to resist linear and differential attacks.
- MixColumns
- Each column is multiplied by a fixed matrix with coefficients 2, 3, 1 and 1 in the field: a small change in one byte spreads to the whole column.
Diffusion and confusion
As early as 1949 Claude Shannon identified two properties of a good cipher: confusion, which makes the relationship between key and ciphertext complex, and diffusion, which spreads the influence of each plaintext bit over many ciphertext bits. In AES the S-box produces confusion, ShiftRows and MixColumns diffusion: after two rounds every output bit depends on every input bit.
AES: worked example
The official FIPS 197 test vector for AES-128 and how to use it to check an implementation.
The pages of this topic
Back to the overviewAES: how it works
The 16-byte state, the four steps of each round — SubBytes, ShiftRows, MixColumns, AddRoundKey — and the role of modes of operation.
AES: history
From the decline of DES to the NIST competition, from Rijndael’s victory to the publication of the FIPS 197 standard.
AES: weaknesses and attacks
Theoretical attacks, side channels, misuse of modes and quantum computers: what really threatens AES.
AES today
Where AES is used every day — web, Wi-Fi, disks, messages, archives — and why it is considered adequate for the future too.
AES: pitfalls to avoid
The most common mistakes made by those who use AES in their own programs: wrong modes, weak keys, repeated vectors, lack of authentication.
AES: frequently asked questions
Short answers to the most common doubts about AES, key length, security and quantum computers.