AES · 01 How it works

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.

  1. 01
    Initial key addition

    The state is combined with a first subkey using the XOR operation.

  2. 02
    SubBytes

    Each byte is replaced with another according to a fixed table, the S-box: it introduces non-linearity.

  3. 03
    ShiftRows

    The rows of the table are shifted by 0, 1, 2 and 3 positions: bytes are mixed across columns.

  4. 04
    MixColumns

    Each column is transformed by a mathematical operation that makes every byte depend on all the others in the column.

  5. 05
    AddRoundKey

    The state is combined with the round subkey, derived from the main key.

  6. 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.

ModeHow it worksNote
ECBEach block encrypted on its ownAvoid: identical blocks give identical results and reveal structure
CBCEach block depends on the previous oneNeeds an unpredictable initialisation vector and integrity protection
CTRTurns AES into a stream generatorFast and parallelisable; the counter must never be reused
GCMEncryption plus authenticationThe current standard for communications; never reuse the nonce with the same key
XTSDesigned for disksUsed in disk encryption
Continue with
02 History

AES: history

From the decline of DES to the NIST competition, from Rijndael’s victory to the publication of the FIPS 197 standard.

↑