Finite Fields (Galois Field)
Finite field rules, GF(p) arithmetic, polynomials over GF(2), irreducible and primitive polynomials, the construction of GF(2^m), conjugates and minimal polynomials.
Galois Field GF(2^3) = GF(8)Bill Kinney · building GF(2^3) from an irreducible polynomial, 24 min
AES II - Finite Field ( Galois Field ) Arithmetic for Advanced Encryption Standard - CSE4003Satish C J · GF(2^8) arithmetic for AES: add, multiply, reduce, 27 min
Lecture 7: Introduction to Galois Fields for the AES by Christof PaarIntroduction to Cryptography by Christof Paar · full university lecture on Galois fields for AES, 91 minFinite field basicsSearch on YouTube
DefinitionSearch on YouTube
A finite field is also called a Galois field. The course notes name the mathematician "Pierre Galois". His real name is Évariste Galois. A Galois field with elements has the name .
A finite field has these formal properties:
- It has two defined operations: addition and multiplication.
- The sum or product of two field elements is always a field element (closure).
- It has a zero element: .
- It has a unity element: .
- Each element has an additive inverse , with . Subtraction is addition of the inverse.
- Each non-zero element has a multiplicative inverse , with . Division is multiplication by the inverse.
- The associative, commutative and distributive laws apply.
Field sizesSearch on YouTube
Not all field sizes can satisfy these properties. They are satisfied when the field size is a prime number or an integer power of a prime.
AES uses . The size is a power of the prime 2, so a field of this size exists.
Prime size field GF(p)Search on YouTube
Arithmetic modulo pSearch on YouTube
For a field with a prime number of elements, do the arithmetic modulo . Take two elements in the range to . Add or multiply them. Then take the result modulo .
- GF(2): modulo-2 addition and multiplication. The elements are 0 and 1.
- GF(3): the elements are 0, 1 and 2.
In GF(3), the additive inverse of 0 is 0. The additive inverse of 1 is 2, and the additive inverse of 2 is 1. To find a multiplicative inverse, find the pair of elements with product 1 in the table. In GF(3), and , because .
Primitive elementSearch on YouTube
In each prime size field, at least one element has powers that give all the non-zero elements. This element is primitive. In , the number 3 is primitive:
Higher powers of 3 repeat the pattern, because . You can multiply two elements if you add their powers of 3:
The multiplicative inverse of is . In GF(7):
- The inverse of () is ().
- The inverse of () is ().
- The inverse of () is ().
GF(7) subtraction and divisionSearch on YouTube
Example 3 builds the addition and multiplication tables of GF(7) with the elements 0 to 6. Use the addition table also for subtraction. Use the multiplication table for division.
- Subtract 6 from 3. The additive inverse of 6 is 1. Thus .
- Divide 3 by 2. The multiplicative inverse of 2 is 4. Thus .
In a finite field, "minus" means "add the additive inverse". "Divide" means "multiply by the multiplicative inverse". Do not use ordinary integer subtraction or division.
Polynomials over GF(2)Search on YouTube
Degree and countSearch on YouTube
A polynomial over GF(2) has coefficients from GF(2):
The degree is the largest power of with a non-zero coefficient. If , has degree . The degree of is zero.
- Degree 1 has two polynomials: and .
- Degree 2 has four polynomials: , , and .
- In general, degree has polynomials.
AdditionSearch on YouTube
To add and , add the coefficients of the same power of modulo 2. Subtraction gives the same result, because .
Example 6. Add and :
DivisionSearch on YouTube
When you divide by , you get one pair of polynomials: the quotient and the remainder :
Example 7. Divide by .
- . Subtract . The result is .
- . Subtract . The result is .
- The degree is now less than 3, so the division stops.
Check: .
If , then is divisible by , and is a factor of .
Roots and the X + 1 factorSearch on YouTube
For real numbers, if is a root of , then is divisible by . The same rule applies over GF(2).
Example 8. Let . Put :
Thus 1 is a root, and is divisible by . The long division gives:
Even-terms rule: a polynomial over GF(2) with an even number of terms is divisible by .
Irreducible polynomialsSearch on YouTube
DefinitionSearch on YouTube
A polynomial over GF(2) of degree is irreducible if it has no factor of lower degree. The factor degree must be greater than zero and less than .
Example 9. Check the four polynomials of degree 2:
- and are divisible by .
- is divisible by .
- has no root at 0 or 1. Thus no degree-1 polynomial divides it. It is irreducible.
Homework from the notes: check if is irreducible over GF(2). Put : the result is 1. Put : the result is . It has no degree-1 factor. A degree-3 polynomial that has a factor must have a degree-1 factor. Thus is irreducible.
Divisor of X^(2^m - 1) + 1Search on YouTube
For each , an irreducible polynomial of degree exists that divides .
Example 10. divides . The long division gives:
Primitive polynomialsSearch on YouTube
DefinitionSearch on YouTube
An irreducible polynomial of degree is primitive if the smallest positive for which divides is .
- divides . It does not divide for . Thus it is primitive.
- is irreducible. It divides , so it is not primitive.
Primitive test: degree , first divisor of . For , the first must be 15. If a smaller works, the polynomial is not primitive.
Primitive polynomial tableSearch on YouTube
It is not easy to find a primitive polynomial. Tables of irreducible polynomials show which ones are primitive. One degree can have more than one primitive polynomial. Some entries from the table in the notes:
| Primitive polynomial | Primitive polynomial | ||
|---|---|---|---|
| 3 | 8 | ||
| 4 | 9 | ||
| 5 | 10 | ||
| 6 | 11 | ||
| 7 | 12 |
Construction of GF(2^m)Search on YouTube
Powers of alphaSearch on YouTube
Start with the elements 0 and 1 from GF(2) and a new symbol . Define a multiplication "" with these rules:
Here ( times). This gives the set:
Closing the setSearch on YouTube
Let be a primitive polynomial of degree , and set . Because divides :
Put . Because , the right side is 0. Thus:
The powers repeat after steps. The set becomes finite:
is a Galois field of elements, . GF(2) is a subfield of .
GF(2^4) exampleSearch on YouTube
Example 11. Let and , a primitive polynomial. Set . Then:
Use this identity again and again to write each power as a polynomial of degree 3 or less:
| Power | Polynomial | Power | Polynomial |
|---|---|---|---|
The next power is . The field has 15 non-zero elements and 0, so it has 16 elements.
In : , and the inverse of is . To add two elements, add their polynomial forms modulo 2.
Roots in GF(2^m)Search on YouTube
Roots in an extension fieldSearch on YouTube
A polynomial with real coefficients can have roots that are not real. An example is , with the complex roots and . Similarly, a polynomial over GF(2) can have no roots in GF(2), but have roots in an extension field of GF(2).
Example 12. is irreducible over GF(2), so it has no roots in GF(2). It has four roots in : , , and . To verify, multiply out the product with the GF(16) table:
ConjugatesSearch on YouTube
Let be a polynomial over GF(2), and let be an element in an extension field of GF(2). If is a root of , then is also a root for each . The element is a conjugate of .
Example. has as a root. With :
The conjugates of are , and . Thus , and are also roots of . The element and its conjugate are also roots.
Roots of X^(2^m - 1) + 1Search on YouTube
Let be a non-zero element of . Then , so . Thus each non-zero element of is a root of . This polynomial has degree . Thus the non-zero elements are all its roots.
Minimal polynomialsSearch on YouTube
Definition and rulesSearch on YouTube
The minimal polynomial of a field element is the polynomial of smallest degree over GF(2) with as a root.
- The minimal polynomial of a field element is irreducible.
- Let be a root of a polynomial over GF(2). Then is divisible by .
- An element and its conjugates have the same minimal polynomial.
Minimal polynomial of alpha^3Search on YouTube
Example 13. In , let . The conjugates are , and . Thus:
Multiply out the product with the GF(16) table:
Minimal polynomials of GF(2^4)Search on YouTube
The minimal polynomials of all elements in , made by :
| Conjugate roots | Minimal polynomial |
|---|---|
The elements of are polynomials over GF(2) modulo . They are not integers modulo . For example, and are the same element.
Link to AESSearch on YouTube
AES uses , which is made in the same way. It uses the irreducible polynomial:
The AES S-box and MixColumns do their calculations in this field. The AES lecture shows the five roles of field arithmetic in the cipher.
Quick self-testSearch on YouTube
Which field sizes give a finite field?
A prime number or an integer power of a prime. AES uses , a power of the prime 2.
Calculate 3 − 6 and 3 ÷ 2 in GF(7).
The additive inverse of 6 is 1, so . The multiplicative inverse of 2 is 4, so .
Why is 3 primitive in GF(7)?
The powers to give 3, 2, 6, 4, 5, 1. These are all six non-zero elements.
Divide by over GF(2).
The quotient is . The remainder is .
Is divisible by ?
Yes. It has an even number of terms, so . The quotient is .
Which degree-2 polynomial over GF(2) is irreducible?
Only . It has no root at 0 or 1. and are divisible by . is divisible by .
Why is primitive, but is not?
first divides at . The other polynomial already divides .
How do you build GF(16) from ?
Set , so . Use this identity to write to as polynomials of degree 3 or less. Then , and the field has 16 elements with 0.
What are the conjugates of in GF(16), and what is its minimal polynomial?
The conjugates are , and . The minimal polynomial is .
Give the roots of in GF(16).
, , and . They are conjugates of each other.
- A finite field (Galois field) exists for a prime size or a prime power size. Subtraction and division use the inverses.
- uses arithmetic modulo . In GF(7), 3 is primitive, so products become sums of powers.
- Polynomials over GF(2) add with coefficients modulo 2. Division gives a quotient and a remainder.
- An even number of terms means the polynomial is divisible by .
- An irreducible polynomial has no factor of lower degree. A primitive polynomial of degree first divides .
- Set for a primitive to build . For , and .
- If is a root, its conjugates are also roots. Conjugates share one irreducible minimal polynomial.
- AES works in modulo .