0% found this document useful (0 votes)
150 views37 pages

Security Lec4

This document discusses Galois fields and provides examples and homework problems related to the topic. It begins by defining a Galois field as a finite field with a number of elements that is always a power of a prime number. It then gives examples of Galois fields with different numbers of elements represented in various ways. The document goes on to cover operations on polynomials in Galois fields such as addition, subtraction, and multiplication. It also discusses divisors, irreducible and primitive polynomials, and calculating inverse elements. It concludes by providing 10 homework problems related to these topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
150 views37 pages

Security Lec4

This document discusses Galois fields and provides examples and homework problems related to the topic. It begins by defining a Galois field as a finite field with a number of elements that is always a power of a prime number. It then gives examples of Galois fields with different numbers of elements represented in various ways. The document goes on to cover operations on polynomials in Galois fields such as addition, subtraction, and multiplication. It also discusses divisors, irreducible and primitive polynomials, and calculating inverse elements. It concludes by providing 10 homework problems related to these topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Kufa University

Faculty of Computer Science and Mathematics


Department of Computer Science

Public Cryptography
Galois Field
• Finite Field:
Field A field with finite number of elements, also 
known as Galois Field.
• The number of elements is always a power n of a prime 
number p. Hence, denoted as GF(pn).
• GF(p) ≡ Zp is the set of integers {0,1, … , p-1} with arithmetic 
operations modulo prime p .
 Example(1.1) :
 GF(2) = { 0 , 1 }
 GF(6) 
GF(8)= { 0, 1,2,3,4,5,6,7} 
GF(9)= { 0, 1,2,3,4,5,6,7,8}
Évariste Galois 
 25 October 1811 – 31 May 1832
GF(12)= { 0,1,2,3,4,5,6,7,8,9,10,11} 
Galois Field
• Field elements in GF(2m) can be represented in several ways 
including:
• Polynomial: x3 + x2 +1 = 1 x3 + 1 x2 + 0 x + 1
• Binary: (1101)2
• Integer: (13)10 
GF(8)= { 0, 1,2,3,4,5,6,7}                                        Integer
GF(8)= {000,001,010,011,100,101,110,111}      Binary
GF(8)={0 ,1 ,x ,x+1 ,x2 ,x2+1 ,x2+x , x2+x+1}          Polynomial

H.W(1) Galois Field : Write the polynomial elements of GF(24)?

H.W(2) Galois Field : Write the polynomial elements of GF(32)?


Galois Field

GF(9)= { 0, 1,2,3,4,5,6,7,8}
GF(9)= {00,01,02,10,11,12,20,21,22} 
GF(9)={0 ,1 ,2 ,x ,x+1,x+2,2x, 2x+1,2x+2} 

H.W(1) Galois Field : Write the polynomial elements of GF(24)?

H.W(2) Galois Field : Write the polynomial elements of GF(2


H.W(3) GF(316
2)?
)?
Operations on Polynomials of GF
1) The polynomial arithmetic operation of GF(pm) on GF(p) with mod p
coefficients.

f(x)= 8 x4 -3 x3+ 5 x2 -7 x+ 2
Operations on Polynomials of GF
1) The polynomial arithmetic operation of GF(pm) on GF(p) with 
mod p coefficients.
2) The polynomial arithmetic operation of GF(pm) on GF(p) with 
coefficients on mod (p) or Zp , and the operation on mod(m(x)).
The operations are:
Add, subtract, multiply, divide polynomials, and remainders.
Example(1.2):
 1) let f(x)=2x4+x2+6x , g(x)=4x+5 on GF(7),
2) Let f(x)=x5+x+1 , g(x)=x+1 on GF(2),
3) let f(x)=x5+x3+x+1 , g(x)=x2+x+1 on GF(27), where m(x)=x7+x+1, 
Find f(x)+g(x) , f(x)-g(x) , f(x) g(x)?
 
f(x)+g(x)
1)  (2x4+x2+6x) + (4x+5) =2x4+x2+3x+5 mod(7)
2)  (x5+x+1) + (x+1) =x5 mod(2)
3)  (x5+x3+x2+1) + (x2+x+1) = x5+x3+x  mod(x7+x+1)
f(x)-g(x)
1) (2x4+x2+6x) - (4x+5)= (2x4+x2+6x) + (3x+2)
       =2x4+x2+2x+2 mod(7)
2) (x5+x+1) - (x+1) = (x5+x+1) +(x+1)= x5 mod(2)
3) (x5+x3+x2+1) - (x2+x+1) =  (x5+x3+x2+1) +(x2+x+1) 
      = x5+x3+x mod(x7+x+1)

H.W(4) Galois Field: Find (9x3+4x2-10x-6) + (6x3+10x2-5x-5) mod 11 ?


Multiplication
30 mod 7=2
1) f(x) g(x) = (2x +x +6x) (4x+5) mod( 7)
4 2

                                                      2x 4+x2+6x
24 mod 7=3
                                                              4x+5
                                                            -------------
10 mod 7=3

                                                          3x 4+5x2+2x
8 mod 7=1
                                                          x +4x +3x
8 mod 7=1 5 3 2

                                                           --------------
                                                        x
(2x4+x2+6x) (4x+5) mod (7)= 5+3x4+4x3+x2+2x

H.W(5) Galois Field : Find (x3+4x2-2x-7) (x7+9x2-x-1) mod 11 ?


Multiplication
2) f(x) g(x) = (x5+x+1) (x+1) mod (2)
                                                            x 5+x+1
                                                                x+1
                                                            -------------
Other
                                                             x
Method 5+x+1

                                                            x 6+x2+x
                                                           --------------
                                                           x
(x5+x+1) (x+1) mod (2)= 6+x5+x2+1
Multiplication
  2) f(x) g(x) = (x5+x+1) (x+1) mod (2)
                                                           100011
                                                                11
                                                            -------------
Other
                                                             100011
Method
                                                           1000110
                                                           --------------
                                                           1100101
1x6+1x5+0x4+0x3+1x2+0x+1

(x5+x+1) (x+1) mod (2)= x6+x5+x2+1
Multiplication
3) f(x) g(x) = (x5+x3+x+1) (x2+x+1) mod m(x)
                                                            
where m(x)=x +x+1 7

1) m(x) mod m(x)≡0
Example(1.3) :
x2+x+1 mod (x2+x+1)=0

2)

then

Example(1.4) :
x7 mod (x7+x+1)=x+1
x5 mod (x5+x3+x+1)= x3+x+1
Multiplication
3) f(x) g(x) = (x5+x3+x+1) (x2+x+1) mod m(x)
                                                            
where m(x)=x7+x+1
The degree of m(x) is 7

(x5+x3+x+1) (x2+x+1)=x7+x6+x4+1  =x+1+x6+x4+1= x6+x4+x

The degree m(x) equal 7
H.W(6)Galois Field
Since : Calculate x5 mod (x3+x+1) on GF(23)?
x7≡x+1
H.W(7)Galois Field:Calculate (x2+x) (x3+x2+1)mod (x4+x3+1) on GF(24)?

H.W(8)Galois Field : Calculate (x3) (x3+1) mod (x3+x+1) on GF(23)?

H.W(9)Galois Field : Calculate (x) (x4+x3+x) mod (x5+x2+1) on GF(23)?

H.W(10)Galois Field : Show that x15 mod (x4+x+1) =1 on GF(24)?


H.W(6)Galois Field : Calculate x5 mod (x3+x+1) on GF(23)?

H.W(7)Galois Field:Calculate (x2+x) (x3+x2+1)mod (x4+x3+1) on GF(24)?

H.W(8)Galois Field : Calculate (x3) (x3+1) mod (x3+x+1) on GF(23)?

H.W(9)Galois Field : Calculate (x) (x4+x3+x) mod (x5+x2+1) on GF(23)?

H.W(10)Galois Field : Show that x15 mod (x4+x+1) =1 on GF(24)?


H.W(6)Galois Field : Calculate x5 mod (x3+x+1) on GF(23)?

H.W(7)Galois Field:Calculate (x2+x) (x3+x2+1)mod (x4+x3+1) on GF(24)?

H.W(8)Galois Field : Calculate (x3) (x3+1) mod (x3+x+1) on GF(23)?

H.W(9)Galois Field : Calculate (x) (x4+x3+x) mod (x5+x2+1) on GF(23)?

H.W(10)Galois Field : Show that x15 mod (x4+x+1) =1 on GF(24)?


x5 = x2 x3
= x2 (x+1)
=x3+x2
=(x+1)+x 2
x5 mod (x3+x+1)=x2+x+1
=x2+x+1

H.W(6)Galois Field : Calculate x5 mod (x3+x+1) on GF(23)?

H.W(7)Galois Field:Calculate (x2+x) (x3+x2+1)mod (x4+x3+1) on GF(24)?

H.W(8)Galois Field : Calculate (x3) (x3+1) mod (x3+x+1) on GF(23)?

H.W(9)Galois Field : Calculate (x) (x4+x3+x) mod (x5+x2+1) on GF(23)?

H.W(10)Galois Field : Show that x15 mod (x4+x+1) =1 on GF(24)?


Divisor of Polynomial
The polynomial g(x) is divisor of  f(x) then there exist h(x) 
such that :         f(x)= g(x) h(x).
Example(2.1): Show that g(x)=x2+1 is divisor of f(x)= 
x5+x3+x2+1? 
then h(x)=x3+1 .

H.W(1) DP.: Show that g(x)= x4+x3+x2+x+1 is divisor of f(x)=x5+1?
Irreducible polynomial
The polynomials are reducible polynomial is have zeros, 
otherwise  are irreducible polynomial .
f(x) =x2+x+1                                  irreducible 
f(x) =1+x+x3+x4 = (1+x)(1+x3)     reducible
f(x) =x+x3+x7 = x (1+x2+x6)          reducible
f(x) = 1+x+x4                                  irreducible 
f(x) = x+x2+x3+x5= x (1+x+x2+x4) reducible
H.W(1) PrimPoly: is x3+x+1 reducible or irreducible ?

H.W(2) PrimPoly : is x4+x2+x reducible or irreducible ?

H.W(3) PrimPoly : is x5+x3+x2+1 reducible or irreducible ?


Primitive Polynomial
f(x) is a primitive polynomial of degree n, if
Ø  f(x) irreducible  polynomial.
Ø  f(x) is not divisor 1+xm , for any m<2n-1
Example(2.2)
• f(x)=1+x+x2 is not a factor of 1+xm for m < 3 so 
f(x) is a primitive polynomial
• f(x)= 1+x+x2+x3+x4 is irreducible but 
1+x5=(1+x)(1+x+x2+x3+x4) and m=5 < 24-1=15 so 
f(x) is not a primitive polynomial
H.W(4) PrimPoly : is x4+x2+1 Primitive or not ?
H.W(5) PrimPoly : is x3+x+1 Primitive or not ?
Inverse element in GF(Pn)
o If n=1, then GF(P)≡Zp.
Example(2.3): let p=7, calculate 1/3=3-1 ? 3-1=5.
o If p=2, and n>1, must there exist primitive 
polynomial.
Example(2.4): let p=2, and n=3,
The primitive polynomial of GF(23) is x3+x+1
corresponding in binary 1011 , and in hexadecimal is B.
GF(23)={0,1,2,3,4,5,6,7}, Integer
GF(23)={0,1, x, x+1, x2,x2+1, x2+x, x2+x+1}, Polynomial
GF(23)={000,001,010,011,100,101,110,111}, Binary
Inverse element in GF(Pn)
qExample(2.5): Calculate g=(x2+1)-1 mod
(x3+x+1)?
then g=x.
other method by using α3=α+1
0 0
1 1
α α
α2 α2
α3 α +1 α7= α6 α
α4 α2 + α
α5 α2 + α+1
α6 α2 + 1
Inverse element in GF(Pn)
Find inverse of x2+x+1 under GF(24), module  m(x)=x4+x3+1?

(x4+x3+1) = (x2+1)(x2+x+1) + (x)


(x2+x+1)= (x+1)(x) + 1
=============================
1= (x2+x+1) – (x+1) (x)
1= (x2+x+1) – (x+1) {(x4+x3+1) - (x2+1)(x2+x+1) }
1= {(x+1) (x2+1)+1} (x2+x+1) – (x+1)(x4+x3+1) ) }
1= (x3+x2+x) (x2+x+1) – (x+1)(x4+x3+1) ) }
0

(x2+x+1)-1= (x3+x2+x)
Inverse element in GF(Pn)
Find inverse of x2+x+1 under GF(24), module  m(x)=x4+x3+1?
0 α7 α2+α+1
- 1 α8 α3+α2+α
α α α9 α2+1
α2 α2 α10 α3+α
α3 α3 α11 α3+α2+1
α4 α3+1 α12 α+1
α5 α3+α+1 α13 α2+α
α6 α3+α2+α+1 α14 α3+α2
Inverse element in GF(Pn)
Find inverse of x2+x+1 under GF(24), module  m(x)=x4+x3+1?
0 α7 α2+α+1 α15= α7 α8
- 1 α8 α3+α2+α
α α α9 α2+1
α2 α2 α10 α3+α
α3 α3 α11 α3+α2+1
α4 α3+1 α12 α+1
α5 α3+α+1 α13 α2+α
α6 α3+α2+α+1 α14 α3+α2
Inverse element in GF(Pn)
Find inverse of x2+x+1 under GF(24), module  m(x)=x4+x3+1?
0 α7 α2+α+1 α15= α7 α8
- 1 α8 α3+α2+α
α α α9 α2+1
α2 α2 α10 α3+α
α3 α3 α11 α3+α2+1
α4 α3+1 α12 α+1
α5 α3+α+1 α13 α2+α
α6 α3+α2+α+1 α14 α3+α2

(x2+x+1)-1= (x3+x2+x)
Goppa Code
Let a Goppa polynomial be defined as a polynomial over GF(ᵅ ᵅ ), 
that is,

Example(3.1):
Suppose GF(24)={0,1,α, α2, α3, α4,…, α14} on  primitive polynomial m(x)=x4+x+1,let 
the Goppa polynomial of degree 2 ( t=2) is 0 α7 α3+α+1
- 1 α8 α2+1
g(x) = (x + α)(x +α14)= x2+ α7 x+1 on GF(24)
α α α9 α3+α
x 2+αx+ α14x+α15 m=4, p=2, α 2
t=2,
α 2
n=12
α 10 α2+α+1
g(x)≠0  x≠α , x≠α 14
The coefficients of g(x) belong
x2+(α+ to•15the
α14)x+α GF dimension k of Γ(L, g(x)) must
4) x2+(α+ α3+1) x+1 α α
3 3 α 11 α +α +α
3 2
(2
L={ α  | 2 ≤ i ≤ 13 } x2+(α3+α+1) x+1
i be at least k≥n-mt=12- 2*4=4
x +α x+1
2 7 • The minimum
α4 α+1 distance
α12 of the
α3+α 2+α+1

why code satisfied d≥t+1=2+1=3


5α 2 α +α 13 α
3 2 α +α +1

α6 α3+α2 α14 α3+1


Parity Check Matrix and Goppa Matrix
Parity Check Matrix of the Goppa Code, is used in order to decode a 
message, A parity check matrix of a Goppa code is defined to be a 
matrix ᵃ  such that
ᵃᵅ ᵄ  = 0 for all code vectors ᵅ  in GF(2ᵅ ) that satisfy the Goppa code 
requirement.
Special case ( in this course ):-
t=2, g(x)=g0+g1x+g2x2 ,
 the party check Matrix H ( where hi = g(αi)-1 ) is 

The Goppa Matrix is G , such that  GHT=0


Goppa Matrix
• Goppa codes under Goppa Polynomial g(x) ≠0  of 
degree t on GF(2m) , m≥1 is define by 
    [n, k, d]-codes, 
• Let G be a generating matrix of an [n, k,d] Goppa code 
H, where 
  n = 2m.
  k=n-mt.
  d=2t+1.
Example(3.2):
Calculate  Goppa matrix of Goppa code g(x)=x2+ α7 x+1, on  GF(24)
under module  primitive polynomial m(x)=x4+x+1?
Solution:
from example (3.1) , then m=4, p=2, t=2, n=12, the dimension k of Γ(L, g(x)) must 
be at least k≥n-mt=12- 2*4=4, and the minimum distance of the code satisfied 
d≥t+1=2+1=3. The representation of elements of GF (2 4 ) as the powers of α , 
using α4 =α+ 1.
0 (0 0 0 0)T α7 α3+α+1 (1 1 0 1)T
- 1 (1 0 0 0)T α8 α2+1 (1 0 1 0)T
α α (0 1 0 0)T α9 α3+α (0 1 0 1)T
α2 α2 (0 0 1 0)T α10 α2+α+1 (1 1 1 0)T
α3 α3 (0 0 0 1)T α11 α3+α2+α (0 1 1 1)T
α4 α+1 (1 1 0 0)T α12 α3+α2+α+1 (1 1 1 1)T
α5 α2+α (0 1 1 0)T α13 α3+α2+1 (1 0 1 1)T
α6 α3+α2 (0 0 1 1)T α14 α3+1 (1 0 0 1)T
To find the parity check matrix H we can use the formula of 
 previous page,  and  g(x)= x2+ α7 x+1 , then g1= α7 , g2 =1, and since
L={ αi | 2 ≤ i ≤ 13 } , α1= α2, α2= α3, …. , α12= α13. The factors hi = g(αi)-1 are computed 
for 1 ≤ i ≤ 12 as follow :-

h1 = g(α2)-1 = (α4 + α9 +1 )-1 = ( (1 1 0 0)T + (0 1 0 1)T + (1 0 0 0)T )-1 =
( ( 0 0 0 1)T )-1 = (α3 )-1 = α12.  
h2 = g(α3)-1 = (α6 + α10 +1 )-1 = ( (0 0 1 1)T + (1 1 1 0)T + (1 0 0 0)T )-1 =
( ( 0 1 0 1)T)-1 = (α9 )-1 = α6.  
h3 = g(α4)-1 = (α8 + α11 +1 )-1 = ( (1 0 1 0)T + (0 1 1 1)T + (1 0 0 0)T )-1 =
( ( 0 1 0 1)T)-1 = (α9 )-1 = α6.  
h4 = g(α5)-1 = (α10 + α12 +1 )-1 = ( (1 1 1 0)T + (1 1 1 1)T + (1 0 0 0)T )-1 =
( ( 1 0 0 1)T)-1 = (α14 )-1 = α.  
h5 = g(α6)-1 = (α12 + α13 +1 )-1 = ( (1 1 1 1)T + (1 0 1 1)T + (1 0 0 0)T )-1 =
( ( 1 1 0 0)T)-1 = (α4 )-1 = α11.  
h6 = g(α7)-1 = (α14 + α14 +1 )-1 = (1)-1 =( ( 1 0 0 0)T)-1 = 1.  
h7 = g(α8)-1 = (α16 + α15 +1 )-1 = (α + 1 +1 )-1 = (α)-1  = α14.  
h8 = g(α9)-1 = (α18 + α16 +1 )-1 = (α3 + α +1 )-1 = (α7 )-1 = α8
h9 = g(α10)-1 = (α20 + α17 +1 )-1 = (α5 + α2 +1 )-1 =
( (0 1 1 0)T + (0 0 1 0)T + (1 0 0 0)T )-1 =( ( 1 1 0 0)T )-1 = (α4 )-1 = α11.
h10 = g(α11)-1 = (α22 + α18 +1 )-1 = (α7 + α3 +1 )-1 = 
( (1 1 0 1)T + (0 0 0 1)T + (1 0 0 0)T )-1 =( ( 0 1 0 0)T )-1 = (α )-1 = α14.  
h11 = g(α12)-1 = (α24 + α19 +1 )-1 = (α9 + α4 +1 )-1 = 
( (0 1 0 1)T + (1 1 0 0)T + (1 0 0 0)T )-1 =( ( 0 0 0 1)T )-1 = (α3)-1 = α12.  
h12 = g(α13)-1 = (α26 + α20 +1 )-1 = (α11 + α5 +1 )-1 = 
( (0 1 1 1)T + (0 1 1 0)T + (1 0 0 0)T )-1 =( ( 1 0 0 1)T )-1 = (α14 )-1 = α.  
since
The generator matrix G can be computed from H by using GHT = 0, so the
vectors in the nullspace of H modulo 2 form the rowspace of G. In this case, G
is as follow:
H.W (1) Goppa matrix:
Calculate  Goppa matrix of Goppa code g(x)=x2-1, on  GF(24) under module  
primitive polynomial m(x)=x4+x+1 ,
with p=2, m=4, t=2, and n=9, where L={ αi | 1≤i≤9} ?

H.W (2) Goppa matrix:


Calculate  Goppa matrix of Goppa code g(x)=x2+x+α, on  GF(24) under module  
primitive polynomial m(x)=x4+x3+1 ,
with p=2, m=4, t=2, and n=16 , where L={ αi | 1≤i≤16} ?
H.W (3) Goppa matrix:
Calculate  Goppa matrix of Goppa code g(x)=x2+x+α3, on  GF(24) under 
module  primitive polynomial m(x)=x4+x+1 ,
with p=2, m=4, t=2, and n=12, where L={ αi | 2≤i≤13} ?

H.W (4) Goppa matrix:


Calculate  Goppa matrix of Goppa code g(x)=x2+x+α, on  GF(24) under module  
primitive polynomial m(x)=x4+x3+1 ,
with p=2, m=4, t=2, and n=16 , where L={ αi | 1≤i≤16} ?
McEliece cryptosystem
Just like in the knapsack cryptosystem, McEliece cryptosytem is 
based on tranforming an easy to break cryptosystem into one that 
is hard to break.
The public key specifies a random binary Goppa code.
Goppa Codes are a type of error correcting code,

Robert J. McEliece 
(May 21, 1942 – May 8, 2019)
In order to construct the public and private keys, Bob 
must first choose an arbitrary Goppa polynomial ᵅ (x) 
with a degree ᵆ  over ᵃ F(2ᵅ ).
The Goppa code defined by this polynomial and by ᵃ  
has parameters [ᵅ , ≥ ᵅ − ᵅ t, ≥ 2ᵆ + 1].

• Bob Compute the ᵅ ᵆ ᵅ generator matrix ᵃ  of the Goppa 


code.
• Bob randomly chooses a ᵅ ᵆ ᵅ invertible matrix ᵄ .
• Bob randomly chooses a ᵅ ᵆ ᵅ permutation matrix ᵄ , which 
means that ᵄ  has exactly one 1 in every row and column, 
with all other entries being zero.
• Then he computes ᵃ ′ =ᵄ GP , where   ᵃ ′ is his encoding 
matrix.
Alice can encode her message 
ᵅ =(ᵅ 1, ᵅ 2,…, ᵅ ᵅ )
by computing
 ᵆ = ᵅ G′ + ᵅ

• Bob receives Alice’s codeword and uses his permutation 
matrix ᵄ  to compute
ᵆ ′ = ᵆᵄ −1 = ᵅᵃ ′ᵄ −1 + ᵅᵄ −1 = ᵅ SGᵄᵄ −1 + ᵅ ′ = (ᵅ S)ᵃ  + ᵅ ′.
• Bob can then decode ᵆ ′ into the message ᵅ ′ = ᵅ S by 
finding ᵅ ′, which is done by Bob applying 
Patterson’s algorithm. Once this is done, Bob can is 
calculate ᵆ  − ᵅ ′=ᵅ SG and since Bob knows what ᵄ  is, he 
can calculate ᵄ −1, and then recover the original message 
ᵅ =ᵅ ′ᵄ −1.

You might also like