AES · 03 The maths

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.

Continue with
04 Worked example

AES: worked example

The official FIPS 197 test vector for AES-128 and how to use it to check an implementation.

↑