← Back to section · Foundations of Cryptography

Finite Fields GF(p) and GF(2^n): The Two Most Used Finite Worlds

A finite field must have a prime power number of elements. This article explains the two main families: GF(p), the residue classes modulo a prime and the chassis of elliptic-curve cryptography; and GF(2^n), where bit strings are treated as polynomials — the workbench of AES and error-correcting codes — plus why no field GF(6) can exist.

Published 22 November 2026 · 6 min read · PQ Frontier

Finite Fields GF(p) and GF(2^n): The Two Most Used Finite Worlds
AI-generated site artwork
Video explainer · Mathematical foundations: the language of cryptography

A field demands that all four operations (except division by zero) work, yet contains only finitely many elements. Do such small worlds exist? They do, and a beautiful theorem classifies them completely: a finite field has a prime power number of elements, p^k, and for each p^k such a field is unique up to isomorphism — the Galois field GF(p^k). This article focuses on the two families cryptography uses most: GF(p) with k = 1, and GF(2^n) over the base prime 2. They look entirely different, yet both are finite worlds where division works.

GF(p): residues modulo a prime already form a field

Take a prime p and consider the residues Z_p modulo p. In the previous article this was a ring; when the modulus is prime it gains one crucial property: every non-zero element is invertible. The reason is plain — a is coprime to the prime p whenever p does not divide a, so a has a modular inverse. A ring in which every non-zero element is invertible is a field. So GF(p) needs no extra construction: it is modular arithmetic itself. Addition, subtraction and multiplication are the usual modular operations; division is “multiply by the inverse”. This makes it the most approachable finite field for beginners.

GF(p) is the chassis of elliptic-curve cryptography: standard curves such as NIST P-256 are defined over GF(p), point coordinates are field elements, and the slope computations in the point-addition formulas use field division. It is also the default arena for many number-theoretic constructions, such as the arithmetic circuits inside some zero-knowledge proof systems. Intuitive operations and mature big-integer libraries explain its two-century standing.

GF(2^n): bit strings as polynomials

For k ≥ 2 the picture changes: Z_{2^n} is not a field (modulo 4, for instance, 2 has no inverse), so a different construction is needed. The trick is to read an n-bit string as a polynomial with coefficients in GF(2) = {0, 1}: the string (b_{n−1}…b_0) corresponds to b_{n−1}x^{n−1} + … + b_0. Addition is polynomial addition, which is exactly bitwise XOR — no carries, clean and simple. Multiplication first multiplies the polynomials (the degree may overflow), then reduces modulo a fixed irreducible polynomial of degree n to bring the degree back below n. Division is guaranteed by the extended Euclidean algorithm for polynomial inverses. The result is GF(2^n). Its concrete appearance depends on the chosen irreducible polynomial, but different choices yield isomorphic fields, and computations can be translated between them by a bijection.

GF(2^8) is the heart of AES: the first step of its S-box is multiplicative inversion in GF(2^8) (with 0 mapped to 0), and MixColumns multiplies each column, viewed as a polynomial over GF(2^8). Reed–Solomon error-correcting codes, many stream ciphers and hash constructions also live in GF(2^n). That its addition is XOR is exceptionally friendly to both hardware and software — one instruction performs “field addition” — which is why it endures in engineering.

A real example: one multiplication inside AES

The FIPS-197 standard contains a famous hand-computable example: in GF(2^8) (with irreducible polynomial x⁸ + x⁴ + x³ + x + 1), 0x57 · 0x83 = 0xC1. Written as polynomials, 0x57 is x⁶ + x⁴ + x² + x + 1 and 0x83 is x⁷ + x⁴ + x + 1. First multiply them as ordinary polynomials, obtaining a polynomial of degree up to 13; then fold the high-degree terms back down using the reduction rule x⁸ ≡ x⁴ + x³ + x + 1; finally merge like terms by XOR to obtain x⁷ + x⁶ + 1, which is 0xC1. This example is worth computing by hand once: afterwards it is clear that multiplication in GF(2^n) holds no mystery — it is just “polynomial multiplication plus folding by a rule”, and a computer needs only shifts and XORs to do it.

The general GF(p^k): fields can be built in storeys

One can keep building on top of GF(p). Take an irreducible polynomial f(x) of degree k with coefficients in GF(p), consider the set of all polynomials of degree less than k, and reduce the results of operations modulo f(x) — the outcome is exactly GF(p^k). This is the same construction as GF(2^n), with the base field changed from GF(2) to GF(p). The full picture of finite fields is now clear: first the prime field GF(p) as the foundation, then an irreducible polynomial builds the storey GF(p^k) on top of it. Elements of the field can equally be viewed as k-dimensional vectors over the base field — linear algebra (the subject of another article in this section) reappears here. One more small but crucial fact: all non-zero elements of GF(p^k) form a cyclic group under multiplication, guaranteeing that a “primitive root”-like generator exists; classical discrete-logarithm systems over finite fields rely on precisely this property of their parameter fields’ multiplicative groups.

Why there is no GF(6)

Beginners often ask: if GF(4) and GF(8) exist, why not GF(6)? The answer lies in the structure theorem: the additive group of a finite field must be a p-group — intuitively, adding the identity 1 to itself repeatedly must return to 0 after p steps (the field has prime characteristic p), so the total number of elements is forced to be a power of p. Since 6 is not a prime power, GF(6) does not exist; neither do GF(10), GF(12) or GF(15). The residues Z_6 modulo 6 certainly exist, but they form only a ring: neither 2 nor 3 has an inverse, division fails, and a field cannot be assembled. This also explains in hindsight why GF(p) requires p prime: modulo a composite number, the residue ring always contains zero divisors, and a field cannot be formed.

The character of a field: characteristic and one good property

A field’s “characteristic” is its character label: how many times must the identity 1 be added to itself to return to 0. GF(p) and GF(p^k) have characteristic p; the reals have characteristic 0 (one never returns to 0). The characteristic shapes many formulas. In a field of characteristic 2, for instance, (a + b)² = a² + b² — the cross term 2ab is eaten by the characteristic — an identity sometimes jokingly called the “freshman’s dream”, which makes squaring in GF(2^n) exceptionally cheap (it degenerates to a linear transformation of the coefficients) and is a hidden weapon of many efficient implementations. Finite fields also inherit a good property of polynomials: a polynomial of degree d over a field has at most d roots. This sounds trivial, yet it is the theoretical foundation for error-correcting codes being decodable and threshold secret sharing working at all: two distinct low-degree polynomials cannot agree at too many points, so the interpolation argument “enough points determine a unique polynomial” holds. Reed–Solomon codes and Shamir’s secret sharing are, in essence, this property turned into engineering.

Summary: two worlds, one grammar

GF(p) and GF(2^n) are two faces of one abstract structure, the field: remainders of integers in the first case, remainders of polynomials in the second. Cryptography chooses between them by the natural shape of the data: big-integer problems and curve coordinates take GF(p); bit strings and bytes take GF(2^n). In either case, what designers are really buying is the operational freedom the field axioms guarantee — equations can be solved, inverses found, interpolation performed.

Tags: Finite FieldsGalois FieldsAES