Blocks, Keys, and Rounds

A Bigger Block

DES encrypts 64 bits at a time.

AES encrypts 128 bits at a time. That’s 16 bytes, or 16 characters of text.

Larger blocks mean fewer encryption operations for the same amount of data, and better resistance to certain attacks.


The State Matrix

Here’s where AES differs from DES.

AES doesn’t treat those 16 bytes as a long row of bits. Instead, it arranges them into a 4×4 grid called the state.


If your 16 bytes are:

b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15b_0, b_1, b_2, b_3, b_4, b_5, b_6, b_7, b_8, b_9, b_{10}, b_{11}, b_{12}, b_{13}, b_{14}, b_{15}

AES arranges them like this:

Col 0Col 1Col 2Col 3
Row 0b0b_0b4b_4b8b_8b12b_{12}
Row 1b1b_1b5b_5b9b_9b13b_{13}
Row 2b2b_2b6b_6b10b_{10}b14b_{14}
Row 3b3b_3b7b_7b11b_{11}b15b_{15}

Notice: the bytes fill in column by column, not row by row.

This matters because AES operations work on rows and columns separately. The way bytes are arranged affects how they mix together.


Three Key Sizes

AES is flexible. You choose your security level:

Key SizeBits of SecurityUse Case
128 bits128Standard, fast
192 bits192Higher security
256 bits256Maximum security

128-bit AES is still unbroken. 256-bit is often used when regulations or paranoia demand it.


Rounds

Each AES encryption runs multiple rounds. Each round scrambles the data further.

More key bits = more rounds:

Key SizeNumber of Rounds
128 bits10 rounds
192 bits12 rounds
256 bits14 rounds

Why more rounds for bigger keys?

A larger key has more bits of information. The cipher needs more mixing to ensure every key bit influences every output bit.

If you used 256-bit keys with only 10 rounds, some key bits might not fully affect the output.


What Happens Each Round

Every round applies four operations to the state:

StepOperationWhat it does
1SubBytesReplace each byte using a lookup table
2ShiftRowsShift rows left by different amounts
3MixColumnsMix bytes within each column
4AddRoundKeyXOR with the round key

The final round is special. It skips MixColumns.

Why? It’s a design choice that makes encryption and decryption more symmetrical. The math works out cleaner.


Not a Feistel Cipher

DES uses a Feistel network: split the block in half, process one half, swap, repeat.

AES is different. It’s a substitution-permutation network: transform the entire block every round.


Next, we’ll look at a simplified version of AES that’s small enough to compute by hand. Once you understand that, the full AES will make sense.