AES: 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 arranges the 16 bytes of the block in a 4 × 4 table, called the state, and transforms it several times. Each complete transformation is a round.
- 01
Initial key addition
The state is combined with a first subkey using the XOR operation.
- 02
SubBytes
Each byte is replaced with another according to a fixed table, the S-box: it introduces non-linearity.
- 03
ShiftRows
The rows of the table are shifted by 0, 1, 2 and 3 positions: bytes are mixed across columns.
- 04
MixColumns
Each column is transformed by a mathematical operation that makes every byte depend on all the others in the column.
- 05
AddRoundKey
The state is combined with the round subkey, derived from the main key.
- 06
Repetition
The steps are repeated for 10, 12 or 14 rounds; the last one omits MixColumns.
Modes of operation
AES encrypts one block at a time. To encrypt a file or a communication a mode of operation is needed, which sets out how blocks are chained.
| Mode | How it works | Note |
|---|---|---|
| ECB | Each block encrypted on its own | Avoid: identical blocks give identical results and reveal structure |
| CBC | Each block depends on the previous one | Needs an unpredictable initialisation vector and integrity protection |
| CTR | Turns AES into a stream generator | Fast and parallelisable; the counter must never be reused |
| GCM | Encryption plus authentication | The current standard for communications; never reuse the nonce with the same key |
| XTS | Designed for disks | Used in disk encryption |
AES: history
From the decline of DES to the NIST competition, from Rijndael’s victory to the publication of the FIPS 197 standard.
The pages of this topic
Back to the overviewAES: 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: worked example
The official FIPS 197 test vector for AES-128 and how to use it to check an implementation.
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.