Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
duyuefeng0708
GitHub Repository: duyuefeng0708/Cryptography-From-First-Principle
Path: blob/main/foundations/03-galois-fields-aes/README.md
483 views
unlisted

Module 03: Galois Fields and AES

View on nbviewer

See how abstract field theory becomes the concrete engine inside AES.

Prerequisites

Learning Objectives

After completing this module you will:

  1. Construct GF(2^8) as a polynomial quotient ring

  2. Perform field arithmetic (add, multiply, invert) in GF(256)

  3. Understand every AES operation as a field theoretic transformation

  4. Build the AES S-box from first principles using field inverses and affine maps

Explore (SageMath Notebooks)

Work through these notebooks in order:

#NotebookWhat You'll Learn
aBinary Fields: GF(2)The simplest field and why it matters for computing
bExtension Fields: GF(2^n)Building larger fields from GF(2) using irreducible polynomials
cGF(256) ArithmeticAddition as XOR, multiplication via polynomial reduction
dAES S-box ConstructionField inverse + affine transform = the S-box
eAES MixColumns as Field OpsMixColumns as matrix multiplication over GF(256)
fFull AES RoundSubBytes, ShiftRows, MixColumns, AddRoundKey end to end

Implement (Rust)

Build these from scratch in rust/src/lib.rs:

#FunctionDescription
1gf256_addAddition in GF(256) (XOR)
2gf256_mulMultiplication in GF(256) with reduction by the AES polynomial
3gf256_invMultiplicative inverse in GF(256)
4aes_sboxCompute a single S-box output from the field inverse + affine map
5aes_mix_columnApply 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


Next: Module 04: Number Theory and RSA