Skip to content
CryptographyInternals

02 / 11 · Modern cryptography

AES

The block cipher protecting most of the world's encrypted data, one round at a time.

Standard
FIPS-197, 2001
Block / key
128 bits / 128–256 bits
Used in
HTTPS, Wi-Fi, disk encryption

The Advanced Encryption Standard was chosen by NIST in 2001 after an open, five-year international competition. The winner, Rijndael, was designed by the Belgian cryptographers Joan Daemen and Vincent Rijmen.

AES encrypts 16 bytes at a time, arranged as a 4×4 grid called the state. Ten rounds of four simple operations turn it into ciphertext that, without the key, looks like random noise.

Message
A
t
t
a
c
k
␣
a
t
␣
d
a
w
n
!
!

01 / 17 · Inside AES-128

A message

AES (Advanced Encryption Standard) is the cipher that protects most of what you send online. Follow one message through it: 16 characters, exactly the amount AES scrambles at once. Type your own.

Encrypting turns a readable message into something only the key holder can read back.

Playground

Encrypt your own block, one operation at a time

Type a 16-character message and key, then step through all 40 operations. Click any byte to follow it: the panel on the right works the current operation out on that byte.

Your input

Shorter text is padded with spaces; only the first 16 characters count.

Start · Load the message into the state
After
A→65→0x41
0100000141

1 byte = 8 bits

Start

Load the message into the state

What happens

The 16 bytes of your message fill a 4×4 grid, the state, column by column. Every operation that follows rewrites this grid.

On your values

“A” → 65 → 0x41

Why it matters

Working on a grid lets AES mix bytes along rows (ShiftRows) and columns (MixColumns): two directions that together spread every byte everywhere.

Following byte 0 (row 0, column 0). Click another byte to follow it.

Start

Start

How it works

  1. 1Key expansion stretches the 128-bit key into 11 round keys.
  2. 2AddRoundKey XORs the state with the first round key.
  3. 3Each of the 10 rounds applies SubBytes (a fixed, non-linear byte substitution), ShiftRows (row r rotates left by r), MixColumns (each column is mixed by a matrix multiplication in GF(2⁸)) and AddRoundKey.
  4. 4The last round skips MixColumns. Decryption runs the inverse operations in reverse order.

Why it holds

Confusion
SubBytes is built from inversion in GF(2⁸), chosen to be as far from linear as possible. Linear and differential cryptanalysis, the attacks that broke many earlier ciphers, gain almost nothing from it.
Diffusion
ShiftRows spreads bytes across columns and MixColumns spreads each byte over its column. After two rounds, every output bit depends on every input bit. The avalanche chart above shows it: one flipped bit becomes about 64 differing bits.
Margin
The best known attacks on full AES-128 barely improve on brute force (biclique: about 2¹²⁶·¹). Reduced versions are broken up to 7 rounds; AES uses 10, 12 or 14.

What can go wrong

Misuse, not math
Real failures come from how AES is used: ECB mode leaks patterns, a repeated nonce in GCM is catastrophic, and keys left in memory or source code get stolen.
Side channels
Table-based implementations leak timing through CPU caches. Modern CPUs provide AES-NI instructions that run in constant time.
Read the in-depth articleHow Does AES Encryption Work? A Step-by-Step ExampleHow AES encryption works, step by step: we follow one real 16-byte block through key expansion and all 10 rounds of AES-128, with every hex value shown.