Path: blob/main/foundations/03-galois-fields-aes/README.md
483 views
Module 03: Galois Fields and AES
See how abstract field theory becomes the concrete engine inside AES.
Prerequisites
Module 02: Rings, Fields, and Polynomials (fields, polynomial rings, quotient rings)
Learning Objectives
After completing this module you will:
Construct GF(2^8) as a polynomial quotient ring
Perform field arithmetic (add, multiply, invert) in GF(256)
Understand every AES operation as a field theoretic transformation
Build the AES S-box from first principles using field inverses and affine maps
Explore (SageMath Notebooks)
Work through these notebooks in order:
| # | Notebook | What You'll Learn |
|---|---|---|
| a | Binary Fields: GF(2) | The simplest field and why it matters for computing |
| b | Extension Fields: GF(2^n) | Building larger fields from GF(2) using irreducible polynomials |
| c | GF(256) Arithmetic | Addition as XOR, multiplication via polynomial reduction |
| d | AES S-box Construction | Field inverse + affine transform = the S-box |
| e | AES MixColumns as Field Ops | MixColumns as matrix multiplication over GF(256) |
| f | Full AES Round | SubBytes, ShiftRows, MixColumns, AddRoundKey end to end |
Implement (Rust)
Build these from scratch in rust/src/lib.rs:
| # | Function | Description |
|---|---|---|
| 1 | gf256_add | Addition in GF(256) (XOR) |
| 2 | gf256_mul | Multiplication in GF(256) with reduction by the AES polynomial |
| 3 | gf256_inv | Multiplicative inverse in GF(256) |
| 4 | aes_sbox | Compute a single S-box output from the field inverse + affine map |
| 5 | aes_mix_column | Apply MixColumns to one column using GF(256) matrix multiplication |
Run: cargo test -p galois-fields-aes
Break
Try these attacks in the break/ folder:
Construct a weak S-box using a reducible polynomial and show the resulting algebraic vulnerability
Show why ECB mode leaks patterns by encrypting a structured image
Connect
See where this shows up in practice (in the connect/ folder):
AES 128/256 in TLS 1.3 is the cipher suite that protects most web traffic
AES-GCM authenticated encryption combines AES with Galois field based authentication