Reading — step 1 of 5
Read
~1 min readThe State & Galois Field
The State Matrix
AES operates on a fixed 128-bit (16-byte) block, organized as a 4×4 matrix of bytes:
input bytes: s00 s10 s20 s30 s01 s11 ... s33
state matrix (column-major):
| s00 s01 s02 s03 |
| s10 s11 s12 s13 |
| s20 s21 s22 s23 |
| s30 s31 s32 s33 |
Note the layout: the FIRST four bytes are the FIRST COLUMN. AES is column-major. This matters for the operations later.
The block size is FIXED at 16 bytes regardless of key size. Key sizes vary:
- AES-128: 10 rounds
- AES-192: 12 rounds
- AES-256: 14 rounds
Each round transforms the state via four operations:
- SubBytes (S-box substitution)
- ShiftRows (cyclic shift)
- MixColumns (matrix multiplication in GF(2^8))
- AddRoundKey (XOR with round key)
The first round skips MixColumns; the last round skips MixColumns. Otherwise all rounds apply all 4.
You'll implement each transformation, then assemble. The math is dense but each piece is small.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…