Binary Galois Field Table Representation Using C++
Binary Galois Field Table Representation Using C++
Assignment
A Report on
Submitted by
Faculty In-charge
Prof. Deepa N P
1
Table of Contents
❖ Introduction
❖ Galois Field
❖ Irreducible Polynomial
❖ Primitive Polynomial
❖ Basic Properties of Galois Field
❖ Construction Of Galois Field GF(2^m) from GF(2)
❖ C++ code for Galois Field Table Representation
❖ Output
❖ Applications Of Galois Field
❖ Conclusion
❖ References
2
Introduction
A field is an algebraic structure that lets you do everything you’re used to from basic math.
All finite fields have p^m elements where p is prime and m is an integer at least 1.
Conversely, for every number of the form p^m there is a field that size.The field with p^m
elements is sometimes called the Galois field.
The Galois fields of order GF(p) are simply the integers mod p. For m> 1, the elements of
GF(p^m) are polynomials of degree m-1 with coefficients coming from GF(p).
Galois Field
A Galois field is an algebraic field that has a finite number of members. Galois fields having
2^m members are used in error-control coding and are denoted GF(2^m).
❖ The order of any finite field is a power of a prime. Finite fields are also called Galois
fields A large portion of algebraic coding theory, code construction, and decoding is
built around finite fields.
❖ Because finite- field arithmetic is very similar to ordinary arithmetic, most of the rules
of ordinary arithmetic apply to finite-field arithmetic.
Irreducible Polynomial
For a polynomial f(X) over GF(2), if the polynomial has an even number of terms, it is
divisible by X + 1.
A polynomial p(X) over GF(2) of degree m is said to be irreducible over GF(2) if p(X) is not
divisible by any polynomial over GF(2) of degree less than m but greater than zero.
Examples
1. x^3 + x^2 + 1 is irreducible in GF(2) as it is not factorable having a degree of less than 3.
2. x^4 + x^2 + 1 is not irreducible in GF(2), since the polynomial is divisible by the
polynomial x^2 +x+1 with coefficients in GF(2) and with degree of 2 less than 4.
3
Primitive Polynomial
An irreducible polynomial p(X) of degree m is said to be primitive if the smallest positive
integer n for which p(X) divides X^n + 1 is n = 2^m - 1.
We may check that p(X) = X^4 + X + 1 divides X^15 + 1 but does not divide any X^n + 1 for
1 ≤ n < 15. Hence, X^4 + X + 1 is a primitive polynomial.
The polynomial X^4 + X^3 + X^2 + X + 1 is irreducible but it is not primitive, since it
divides X^5 + 1.
It is not easy to recognize a primitive polynomial. However, there are tables of irreducible
polynomials in which primitive polynomials are indicated.
For a given m, there may be more than one primitive polynomial of degree m.
4
BASIC PROPERTIES OF GALOIS FIELD GF(2m)
THEOREM 1: Let f (X) be a polynomial with coefficients from GF(2). Let b(beta) be an
element in an extension field of GF(2).If b is a root of f(X), then for any l>= 0, b^(2^l) is also
a root of f(X).The element b^(2^l)is called a conjugate of b.
THEOREM 2 :The 2^(m) - 1 nonzero elements of GF(2^m) form all the roots of X^(2^m-1) + 1.
THEOREM 3: The minimal polynomial phy(X) of a field element b is irreducible.
THEOREM 4:Let f (X) be a polynomial over GF(2). Let phy(X) be the minimal polynomial of a field
element b. If b is a root of f (X), then f (X) is divisible by phy(X).
5
Construction of Galois Field GF(2^m) from GF(2)
The 2^m elements of GF(2^m) can be written as {0, 1, a, a^2 , · · · , a^(2^m-2)}. All the
nonzero elements of GF(2^m) are generated by the powers of the primitive element a that
satisfies the condition a^(2^m-1) = 1.
The polynomial representation of the elements of GF(2^m) is given by the remainder of x^n
upon division by the polynomial p(x) which is primitive in GF(2).
p(x) = x^3 + x + 1 which is primitive in GF(2). Let a be a root of p(x). This implies that
Since every field must contain zero and one element, we have
0=0
a^0 = 1
Since the reminders of x and x^2 upon division by the primitive polynomial
p(x) = x^3 + x + 1 are themselves, the other two possible assignments are as follows:
a^1= x
a^2 = x^2
6
The remainder is -(x+1): Hence, a^3 = a + 1
The remainder is -(x^2 + x + )1 : Hence, a^5 = a^2 + a + 1: Similarly, x^6 and x^7 follow the
same procedure to get the polynomial representations
7
Representations of elements of GF(8)
#endif // FUNC_H
8
Func_cpp:
#include "func.h"
#include <algorithm>
#include <vector>
#include <math.h>
vector<int> result;
result.clear();
rotate(result.begin(),result.begin()+result.size()-1,result.end());
result[j]=(result[j]+b[j]*a[(int)a.size()-i-1])%2;
while(result[(int)result.size()-1]==0)result.pop_back();
return result;
vector<vector<int>> matrix;
vector<int> vect;
matrix.clear();
9
for(int i=0;i<GF;i++) vect.push_back(0); // add 0,0,..,0
matrix.push_back(vect);
matrix.push_back(vect);
vect.clear();
if (matrix[i-1][GF-1]==1){
if (j==0) vect.push_back((primitive_poly[j]+0)%2);
if (j>0) vect.push_back((primitive_poly[j]+matrix[i-1][j-1])%2);
else{
if (j==0) vect.push_back(0);
if (j>0) vect.push_back(matrix[i-1][j-1]);
matrix.push_back(vect);
return matrix;
10
Main program:
#include <iostream>
#include <math.h>
#include <algorithm>
#include<vector>
#include "func.h"
ECC galoisfield;
int GF=4;
int main()
vector<vector<int>> poly_table =
galoisfield.primitive_poly_table_bin(GF,primitive_poly); //Generate representation GF(2^x)
return 0;
11
Output:
2. Galois field is used in Coding theory and Combinatorial design and Quantum error
correction.
4. All CD and DVD players use computation in Galois Field, as do many disk storage system.
5. Galois Field is used to develop some Mathematical Theories , which have a lot of real life
application
Conclusion:
The report gives a detailed explanation on how a Binary Galois Field Table is constructed for
GF(p^m) using a primitive polynomial. The C++ code produces the galois field table upon
giving proper inputs.
12
References:
file:///D:/ECC/ECC%20MOD%201.pdf
Shu Lin, Daniel J Costello Jr., “Error Control Coding”, Pearson Education Asia, Second
Edition, 2004.
https://sci-hub.se/https://link.springer.com/chapter/10.1007/978-81-322-2292-7_3
https://www.slideshare.net/MadhumitaTamhane/basic-galois-field-arithmatics-required-for-er
ror-control-codes
https://www.slideshare.net/HazrataliNaim/a-short-study-of-galois-field
https://in.mathworks.com/help/comm/ug/error-detection-and-correction.html#bql4k5c
https://www.jmilne.org/math/CourseNotes/FT.pdf
13