Finite Fields (GF(p) & GF(2^n))
Why arithmetic mod a composite breaks division, how GF(p) and GF(2^n) fix it, and why GF(2^8) turns out to be the substrate under AES, Reed-Solomon, CRCs and erasure coding.
A field is a set where you can add, subtract, multiply, and divide by anything nonzero, with all the usual laws holding. The rationals and reals are infinite fields; what makes finite ones indispensable to computing is that a finite field lets you do exact, reversible arithmetic on fixed-width machine words with no rounding and no overflow — which is why AES, Reed–Solomon, CRCs, secret sharing and erasure coding all quietly live inside one.
The problem: mod a composite is not a field #
Arithmetic mod always gives you a ring — add, subtract, multiply freely. Division is where it breaks. has a multiplicative inverse mod only when , so mod a composite, some elements simply cannot be divided by, and "divide" silently becomes a many-to-one map.
Two repairs give a genuine field:
- , prime: integers mod a prime. Every nonzero element is coprime to , so every one has an inverse (find it with the extended Euclidean algorithm). Simple, but the size is a prime — an awkward fit for byte-oriented hardware.
- : elements are polynomials of degree with coefficients in , multiplied modulo an irreducible polynomial of degree . Irreducibility plays exactly the role primality did: it guarantees no zero divisors, hence inverses for all nonzero elements. Every finite field has order for some prime , and all fields of the same order are isomorphic — so "the" field is well-defined.
GF(2^n) is the one hardware likes #
Take : coefficients are bits, a polynomial of degree is an -bit word, and addition of coefficients mod 2 is XOR. So in :
- addition = subtraction = XOR (no carries, no borrows, its own inverse)
- multiplication = carry-less polynomial multiply, then reduce mod the irreducible polynomial (shift and conditional XOR)
has exactly 256 elements, one per byte. That is not a coincidence in AES; it is the reason for the design.
Where this shows up #
| System | Field | What the field does |
|---|---|---|
| AES S-box | , | The S-box is multiplicative inversion in the field, then an affine map — inversion is maximally nonlinear, which is precisely the property a cipher wants |
| AES MixColumns | same | Each column is a degree-3 polynomial multiplied by a fixed mod ; invertible, so decryption works |
| Reed–Solomon | / | Data is polynomial coefficients; evaluation at distinct points gives redundancy. Any of symbols reconstruct via Lagrange interpolation — QR codes, CDs, DVB |
| Erasure coding | Same math at storage scale: Reed–Solomon(6,3) in HDFS/Ceph/Azure gives 3-failure tolerance at 1.5× overhead instead of 3× replication | |
| CRC | Remainder of the message polynomial mod a generator — a ring computation, and why CRC detects burst errors but is not a MAC | |
| Shamir secret sharing | or | A secret is a polynomial's constant term; shares determine it, reveal nothing |
| AES-GCM authentication | GHASH is polynomial evaluation in the field — and its linearity is exactly why nonce reuse leaks the auth key |
Source claims audit #
The table and the mod-128 ambiguity argument were seeded from a university lab manual (polynomial-cipher lab); the applications come from primary specs.
| Claim from source | Status | Notes |
|---|---|---|
| "Operations mod a prime number don't work — ambiguity on division" | needs correction | The reasoning is right but the wording is wrong: the source's own counterexample uses mod 128, a composite. Mod a prime is a perfectly good field. The real requirement is prime or prime-power modulus |
| Worked ambiguity example | current | Recomputed; is the actual cause |
| vector/power table with | current | Recomputed independently; matches |
| Source's "polynomial cipher" (multiply message by a fixed polynomial) | outdated — not a cipher | Multiplication by a known fixed polynomial is trivially invertible by anyone; there is no secret. Useful as field arithmetic practice, not as cryptography — kept the math, dropped the framing |
| "Cyclic method has high cryptographic strength vs Caesar etc." | outdated | False as stated; see above |