COMPUTER ARITHMETIC. 13/05/2010 cryptography - math background pp. 1 / 162

Size: px
Start display at page:

Download "COMPUTER ARITHMETIC. 13/05/2010 cryptography - math background pp. 1 / 162"

Transcription

1 COMPUTER ARITHMETIC 13/05/2010 cryptography - math background pp. 1 / 162

2 RECALL OF COMPUTER ARITHMETIC computers implement some types of arithmetic for instance, addition, subtratction, multiplication of integers and reals necessary for basic computations as found in the programming languages arithemtic operations directly supported by the processor but normally unsuited for cryptography 13/05/2010 cryptography - math background pp. 2 / 162

3 COMPUTER ARITHMETIC computers can perform standard arithmetic operations on: integers, i.e reals, i.e. 1,2 4,3 1, sometimes also other kinds of numbers, i.e., complex numbers and normally NOTHING ELSE 13/05/2010 cryptography - math background pp. 3 / 162

4 COMPUTER ARITHMETIC standard computer operations are: arithmetic 1 st species: addition, subtraction. arithmetic 2 nd species: multiplication, division (integer or real). possibly arithmetic 3 rd species: power, root, sometimes (unfrequently) trascendental: exp, log, trigonometry, 13/05/2010 cryptography - math background pp. 4 / 162

5 COMPUTER ARITHMETIC all the previous operations can be computed directly by the processor of the computer machine (assembler) instrucitons exist for each operation numbers are normally represented in: two s complement (integers) IEEE 754 Floating Point (reals) 13/05/2010 cryptography - math background pp. 5 / 162

6 INTEGERS NATURAL natural binary: binary digit b { 0, 1 } b n b n 1 b n 2 b 3 b 2 b 1 = = b n 1 n n 2 + b n b b 1 2 range: [0, 2 n 1]. for instance: = = = = /05/2010 cryptography - math background pp. 6 / 162

7 INTEGERS TWO S COMPLEMENT two s Complement: binary digit b { 0, 1 } σb n 1 b n b 3 b 2 b 1 = = σ2 n 1 + b n 1 2 n b b bit σ is called sign bit range: [ 2 n 1, 2 n 1 1]. for instance: = = = 45 and: = = = 84 13/05/2010 cryptography - math background pp. 7 / 162

8 ADDITION OF NATURAL INTEGERS 13/05/2010 cryptography - math background pp. 8 / 162

9 ADDITION OF TWO S COMPLEMENT INTEGERS 13/05/2010 cryptography - math background pp. 9 / 162

10 NATURAL MULTIPLICATION 13/05/2010 cryptography - math background pp. 10 / 162

11 FULL ADDER a b a b cin cout sum = cout Full Adder cin sum sum = a XOR b XOR cin cout = a AND b OR a AND cin OR b AND cin 13/05/2010 cryptography - math background pp. 11 / 162

12 RIPPLE CARRY ADDER addition of natural integers of 3 bits a2 b2 a1 b1 a0 b0 c3 Full Adder c2 Full Adder c1 Full Adder c0 s2 s1 s0 13/05/2010 cryptography - math background pp. 12 / 162

13 CONSIDERATIONS integer and real computer arithmetic is NOT used (or seldom used) for cryptography instead, finite algebraic structures are generally adopted for instance, finite FIELDS or RINGS theory of such structures follows 13/05/2010 cryptography - math background pp. 13 / 162

14 ALGEBRAIC STRUCTURES 13/05/2010 cryptography - math background pp. 14 / 162

15 ALGEBRAIC STRUCTURE an algebraic structure A is: A = S, op 1, op 2,, s 0, s 1, where: S is a set of elements, or numbers (in a very broad sense), called support set op i is a binary operatore over the elements of the support set S s i is a special element of the support set S 13/05/2010 cryptography - math background pp. 15 / 162

16 STRUCTURES EXAMPLES natural integers (semigroup): N = {1, 2, 3, }, + natural numbers, equipped with the binary operator of addition (+) natural integers plus 0 (monoid): N 0 = {0, 1, 2, 3, }, +, 0 natural numbers, equipped with the binary operator of addition (+), plus the special element 0 (neutral element for +) 13/05/2010 cryptography - math background pp. 16 / 162

17 STRUCTURES EXAMPLE relative integers (abelian group): {, 2, 1, 0, 1, 2, }, +, 0 relative integer numbers, equipped with: the binary operator of addition (+) the special element 0, neutral for (+) this an algebraic structure with one operation and one special element 13/05/2010 cryptography - math background pp. 17 / 162

18 STRUCTURES EXAMPLE natural integers (semiring): {1, 2, 3, }, +,, 1 natural integer numbers, equipped with: the binary operator of addition (+) the binary operator of multiplication ( ) the special element 1, neutral for ( ) an algebraic structure with two operations and one special element 13/05/2010 cryptography - math background pp. 18 / 162

19 STRUCTURES EXAMPLE relative integers (commutative ring): Z = {, 2, 1, 0, 1, 2, }, +,, 0, 1 Relative integer numbers, equipped with: the binary operator of addition (+) + the binary operator of multiplication ( ) the special element 0, neutral for (+) the special element 1, neutral for ( ) an algebraic structure with two operations and two special elements 13/05/2010 cryptography - math background pp. 19 / 162

20 CONSIDERATIONS there are many possible algebraic structures each of them is characterized by properties (axioms and theorems) for instance: a + b = b + a (axiom for N) a 2 b 2 = (a + b) (a b) (theorem for Z) 13/05/2010 cryptography - math background pp. 20 / 162

21 GROUPS 13/05/2010 cryptography - math background pp. 21 / 162

22 DEFINITION a GROUP G is an algebraic structure: G = S,, 1 WHERE: S is the support set is a binary operator, called product 1 is a special element, neutral for ( ) if the support S is a finite set, G is said to be a finite group 13/05/2010 cryptography - math background pp. 22 / 162

23 AXIOMS OF GROUP groups must satisfy (by definition) the following axioms for every a, b, c S: a b S (closure) (a b) c = a (b c) (associativity) 1 a = a 1 (1 is neutral and commutes) a a a = a a = 1 ( of inverse) 13/05/2010 cryptography - math background pp. 23 / 162

24 GROUPS EXAMPLE the group of non-singular square matrices of order 2, with real elements M = M 2, 2, matrix product, identity matrix I M is closed the matrix product is associative the matrix I is the neutral element for product each matrix admits an inverse one NOTE: matrix product is NOT commutative 13/05/2010 cryptography - math background pp. 24 / 162

25 ABELIAN GROUPS in some groups, the product operator is commutative, i.e., a b = b a abelian (or commutative) group: a group G such that the operator ( ) is commutative G = S, +, 1 in abelian groups, the symbol ( ) is normally replaced by (+), which is called addition instead of product PAY ATTENTION: a few mathematicians still go on calling (+) a product operator!! 13/05/2010 cryptography - math background pp. 25 / 162

26 ABELIAN GROUPS EXAMPLES the world is plenty of abelian groups for instance: relative integers, with addition Z = {, 2, 1, 0, 1, 2, }, +, 0 rational integers, with multiplication Q = {, p / q, },, 1 and many others 13/05/2010 cryptography - math background pp. 26 / 162

27 ITERATED OPERATION given a group G (not necessarily abelian), an element g of the group G, and a positive or null integer k 0, it is defined: g k = g g g (for k times) g 0 = 1 (if k = 0) the operation g k is called iterated multiplication (or power ) most cryptography lives on it 13/05/2010 cryptography - math background pp. 27 / 162

28 ITERATION EXAMPLES given Z = {, 2, 1, 0, 1, 2, },, 1 z k = z z z (k times) usually called power of order k. in groups with an operation denoted (+) + instead of ( ), the writing kg replaces g k given Z = {, 2, 1, 0, 1, 2, }, +, 0 which is an abelian group: kz = z + z + + z the usual multiple times k (k times) 13/05/2010 cryptography - math background pp. 28 / 162

29 GROUP GENERATORS given a finite group G, an element g G is said to be a generator for G, if its powers cover all the elements of G: f G k 0 such that f = g k in the practice a generator is a single element that allows to construct the whole group by iteration a group G may admit no generators, a single generator or more generators 13/05/2010 cryptography - math background pp. 29 / 162

30 DISCRETE LOGARITHM (DH) given a generator element g G for the group, and whatever element f G, define: k = log g f - discrete log. base g the (smallest) integer k 0 such that f = g k the (smallest) integer k 0 necessarily exists, since g is a generator element for G given a group G, it is relatively simple to compute f = g k, but it may be very complex to compute k starting from g and f 13/05/2010 cryptography - math background pp. 30 / 162

31 CONSIDERATIONS groups (usually abelian) are an important algebraic structure for cryptography normally finite groups are used (examples will come soon) the basic operations for cryptographic applications are iteration and discrete logarithm however, abelian groups appear also under the form of rings and fields (see next slides) 13/05/2010 cryptography - math background pp. 31 / 162

32 RINGS AND FIELDS 13/05/2010 cryptography - math background pp. 32 / 162

33 RINGS DEFINITION a RING R is an algebraic structure: R = S, +,, 0, and usually also 1 where: S, +, 0 is an abelian group w.r.t. (+) and for every a, b, c S: a b S (closure) a (b + c) = (a b) + (a c) (left distribution) (b + c) a = (b a) + (c a) (right distribution) 13/05/2010 cryptography - math background pp. 33 / 162

34 RINGS DETAILS the operator (+) must be commutative if the operator ( ) commutes as well, R is said to be a commutative ring if ( ) has its own neutral element 1, R is said to be a a ring with unity if the support set S of R is a finite set, R is said to be a finite ring 13/05/2010 cryptography - math background pp. 34 / 162

35 RINGS EXAMPLE the ring R of relative integer numbers, with ordinary addition and multiplication: Z = {, 2, 1, 0, 1, 2, }, +,, 0, 1 R is a commutative ring, since the operator ( ) commutes and R is said to have a unity, since the operation ( ) has its own neutral element, 1 the symbol Z is worldwide used for denoting this particular ring 13/05/2010 cryptography - math background pp. 35 / 162

36 FIELDS DEFINITION a FIELD F is an algebraic structure: F = S, +,, 0, 1 where: S, +, 0 is an abelian group w.r.t. (+) S,, 1 is an abelian group w.r.t. ( ) and for every a, b, c S: a (b + c) = (a b) + (a c) (left distribution) (b + c) a = (b a) + (c a) (right distribution) if the support set S of F is finite, F is said to be a finite field 13/05/2010 cryptography - math background pp. 36 / 162

37 FIELDS EXAMPLES the field Q of rational integer numbers, with ordinary addition and multiplication: Q = {, p / q, }, +,, 0, 1 Q is an infinite field other examples of infinite fields: real numbers, with addition and multiplication complex numbers, with addition and multiplication and many others 13/05/2010 cryptography - math background pp. 37 / 162

38 CONSIDERATIONS rings and fields are the most popular and used algebraic structures in particular, the mathematical theory of fields is well developed, and for finite fields (almost) everything that is of some interest has been investigated and clarified and an important part of cryptography actually relies upon finite fields 13/05/2010 cryptography - math background pp. 38 / 162

39 MODULAR OPERATIONS 13/05/2010 cryptography - math background pp. 39 / 162

40 PRELIMINARIES there are many finite rings, but few finite fields, here: modular finite rings modular finite fields finite extension fields in particular, binary finite extension fields all these are used in cryptography 13/05/2010 cryptography - math background pp. 40 / 162

41 MODULAR RINGS everybody knows what integer division is given: an integer N an integer D (dividend, positive, null or neg.) (divisor, always positive, non-null) there are two uniquely determined positive or null integers Q and R, such that: N = Q D + R and 0 R < D Q: quotient, R: remainder 13/05/2010 cryptography - math background pp. 41 / 162

42 INTEGER DIVISION EXAMPLES N = Q D + R 5 = Q = 2, R = 1, 1 < 2 9 = Q = 3, R = 0, 0 < 3 20 = Q = 3, R = 2, 2 < 3 5 = Q = 3, R = 1, 1 < 2 8 = Q = 2, R = 0, 0 < 4 9 = Q = 3, R = 3, 3 < 4 13/05/2010 cryptography - math background pp. 42 / 162

43 COMPUTING mod n from the definition and the examples, it is clear that (for n 1): if a 0 then else a mod n = r s. t. a = q n + r and r < n a mod n = n r s. t. a = q n + r and 0 r < n for instance: r = 4 mod 3 = 2 because 4 = but also 4 = and hence r = 3 1 = 2 13/05/2010 cryptography - math background pp. 43 / 162

44 THE mod OPERATOR one writes (a Z and n 1): a mod n = b to indicate the remainder b 0 of the (integer) division of a by n here the symbol mod indicates a binary operator: mod: Z N N if n = 1, then a mod n = a (trivial case) 13/05/2010 cryptography - math background pp. 44 / 162

45 MODULAR CONGRUENCE given a modulus n 1, two integers a, b Z are said to be congruent modulus n, iff: a = b mod n a mod n = b mod n i.e., iff the remainder of a divided by n equals the remainder of b divided by n the modular congruence = mod n has the usual formal properties of equality: Riflexivity: a = a mod n Simmetry: a = b mod n b = a mod n Transitivity: a = b mod n and b = c mod n a = c mod n here mod is a side indication, meaning that equality = is interpreted in the modular way 13/05/2010 cryptography - math background pp. 45 / 162

46 CONGRUENCE EXAMPLES It holds: 4 = 0 mod 2 In fact: 4 mod 2 = 0 = 0 mod 2 It holds: 5 = 1 mod 2 In fact: 5 mod 2 = 1 = 1 mod 2 It holds: 11 = 7 mod 4 In fact: 11 mod 4 = 3 = 7 mod 4 It holds: 13 = 2 mod 5 In fact: 13 mod 5 = 2 = 2 mod 5 It holds: 9 = 5 mod 2 In fact: 9 mod 2 = 1 = 5 mod 2 13/05/2010 cryptography - math background pp. 46 / 162

47 RESIDUE CLASSES given any modulus n 1, the set A of all the integers a Z that are congruent mod n, has the following form: A = {b ± k n k Z and 0 b < n} each set A is called a residue class (mod n). there are exactly n 1 such classes the integer b A is the reduced form of every other element of the class A A = {, 4, 1, 0, 2, 5, } is the residue class of 5 mod 3; 2 is the reduced form 13/05/2010 cryptography - math background pp. 47 / 162

48 IMPORTANT DETAIL it is true that, for any modulus n 1: n = 0 mod n put another way, 0 and n can always be freely exchanged more generally: k kn = 0 mod n 13/05/2010 cryptography - math background pp. 48 / 162

49 COMPUTATION mod n an algebraic expression over the integers, containing (+) and ( ), is said to be computed mod n (for n 1), if the result of the integer division by n is taken (instead of the full result) for instance: = 2 mod 4 13/05/2010 cryptography - math background pp. 49 / 162

50 PROPERTIES OF mod given n 1 and any two integers a, b Z: (a + b) mod n = ((a mod n) + (b mod n)) mod n (a b) mod n = ((a mod n) (b mod n)) mod n (a b) mod n = ((a mod n) (b mod n)) mod n put another way, the operator mod commutes with (+), ( ) and ( ) this is very useful for optimizing expression computations 13/05/2010 cryptography - math background pp. 50 / 162

51 COMPUTING mod n EXAMPLE it holds: = 2 mod 4 in fact: = 10 and 10 mod 4 = 2 but also: 5 mod 4 = 1 and 3 2 mod 4 = 2 and 1 mod 4 = 3 and ( ) mod 4 = 6 mod 4 = 2 13/05/2010 cryptography - math background pp. 51 / 162

52 MODULAR RINGS 13/05/2010 cryptography - math background pp. 52 / 162

53 THE MODULAR RING Z n given a positive integer n 1, the following algebraic structure: Z n = {0, 1, 2,, n 1}, +,, 0, 1 is called modular ring of order n, provided, for every a, b Z n : a + b a b is computed mod n is computed mod n Z n contains exactly n elements Z 1 contains only 0 (n = 1, trivial case) 13/05/2010 cryptography - math background pp. 53 / 162

54 MODULAR ADDITION suppose for instance n = 6 modular addition works in Z 6 as follows: = 3 mod 6 = 3 (1 + 2 = 3 mod 6) = 7 mod 6 = 1 (3 + 4 = 1 mod 6) = 10 mod 6 = = 1 mod 6 = = 5 mod 6 = 1 13/05/2010 cryptography - math background pp. 54 / 162

55 OPPOSITE ELEMENT suppose for instance n = 10 opposite elements in Z 10 can be found as follows: 5 = 5 mod 10 = 1 ( 5 = 1 mod 10) 3 = 3 mod 10 = 7 ( 3 = 7 mod 10) 8 = 8 mod 10 = 2 ( 8 = 2 mod 10) clearly: a = n a mod n this is coherent with: a + ( a) = a + (n a) = a + n a = n = 0 mod n 13/05/2010 cryptography - math background pp. 55 / 162

56 MODULAR MULTIPLICATION suppose for instance n = 9 modular multiplication works in Z 9 as follows: 1 2 = 6 mod 9 = 6 (1 2 = 6 mod 9) 3 4 = 12 mod 9 = 3 (3 4 = 12 mod 9) 5 5 = 25 mod 9 = = 20 mod 9 = = 0 mod 9 = 0 13/05/2010 cryptography - math background pp. 56 / 162

57 MODULAR POWERS modular powers: a m = a a a mod n (for m 1 times) a 0 = 1 mod n (by definition) for instance, given n = 6: 2 2 = 4 mod 6 = 4 (2 2 = 4 mod 6) 2 3 = 8 mod 6 = 2 (2 3 = 2 mod 6) 2 6 = 64 mod 6 = 4 (2 6 = 4 mod 6) note: 2 6 = (2 3 ) 2 = (2) 2 = 4 mod 6 i.e., one can use the normal, well-known properties of exponents 13/05/2010 cryptography - math background pp. 57 / 162

58 HINTS ON GENERATORS consider the ring Z 5 and the element 2: 1 2 mod 5 = 2 mod 5 = mod 5 = 4 mod 5 = mod 5 = 6 mod 5 = mod 5 = 8 mod 5 = mod 5 = 10 mod 5 = 0 Z mod 5 = 12 mod 5 = 2 (periodic) the element 2 is an additive generator for the ring Z 5 theorem: for any ring Z n, any element e 0 such that (e, n) = 1 is an additive generator 13/05/2010 cryptography - math background pp. 58 / 162

59 HINTS ON GENERATORS consider the ring Z 5 and the element 3: 3 1 mod 5 = 3 mod 5 = mod 5 = 9 mod 5 = mod 5 = 27 mod 5 = mod 5 = 81 mod 5 = mod 5 = 243 mod 5 = 3 (periodic ) Z 5 (excluding 0) the element 3 is a multiplicative generator for the ring Z 5 how to determine the multiplicative generators for a modular ring Z n, of a generic modulus n, is a very complex problem 13/05/2010 cryptography - math background pp. 59 / 162

60 MORE ON MODULAR RINGS 13/05/2010 cryptography - math background pp. 60 / 162

61 MODULAR COMPUTATION frequently, computing the operator mod does not really require to perform a division remember in fact that n = 0 mod n whenever in an expression to be computed mod n, a term +n (or n) occurs, delete it (since it is = 0 mod n) whenever in an expression to be computed mod n, a factor n occurs, delete the product chain it is contained in (since it is = 0 mod n) 13/05/2010 cryptography - math background pp. 61 / 162

62 MOD. COMPUT. EXAMPLES one should immediately see that: (2 + 3) = 0 mod 4 in fact (this must become instinctive): a 4 = 0 mod 4 (whatever a is) 8 b = 0 mod 4 (whatever b is) and 16 = 0 mod 4 a well-known application: mod 3 = ( ) mod 3 = ( ) mod 3 = 21 mod 3 = = 0 mod 3 since 10 x = 1 mod 3 for every x 0 it is the well-known rule for checking the divisibility by 3 of decimal integer numbers 13/05/2010 cryptography - math background pp. 62 / 162

63 MOD. COMPUT. PROBLEM what is the check rule of divisibility by 3 for binary natural numbers? that is, given: B = how do I quickly check whether the binary number B is divisible by 3? i might first convert B to decimal, but 13/05/2010 cryptography - math background pp. 63 / 162

64 MODULAR REDUCTION given any modulus n 1 and any integer a n, the task of finding an integer 0 b < n, such that a = b mod n is called reduction for instance, taken n = 7 and a = 20: b = a mod n = 20 mod 7 = 6 20 = 6 mod 7 it is said that 6 is the reduced form of 20, modulus 7 (as already seen before) actually reduction is nothing but another name for taking the result of a mod n 13/05/2010 cryptography - math background pp. 64 / 162

65 GREATEST COMMON DIVISOR given any two integers a, b Z, their greatest common divisor, g.c.d., usually denoted (a, b) = d, is the largest positive integer d (i.e., d 1) dividing exactly (remainder 0) both a and b for instance: (2, 3) = 1, (12, 8) = 4, ( 30, 12) = 6, ( 2, 5) = 1 (not 1!) two integers a, b Z are said to be co-prime (or relatively prime), i.e., they share no common integer factor 2, if and only if (a, b) = 1 for finding the g.c.d. efficiently: Euclid algorithm 13/05/2010 cryptography - math background pp. 65 / 162

66 ABOUT THE INVERSION IN Z n given a Z n (n 2), when is it possible to find b Z n, such that: a b = 1 mod n (b is the multiplicative inverse of a)? theorem: the multiplicative inverse b of a exists (and is unique) if and only if (a, n) = 1, i.e., if a and n are co-prime (they share no common integer factor 2) 13/05/2010 cryptography - math background pp. 66 / 162

67 INVERSION IN Z n EXAMPLE let n = 6, i.e., work in Z 6 : 2 1 mod 6 does not exist, (2, 6) = mod 6 does not exist, (3, 6) = mod 6 does not exist, (4, 6) = mod 6 = 5 exists, (5, 6) = 1 and is 5, since 5 5 = 25 = 1 mod 6 clearly, if n is a prime integer, any positive integer a < n is co-prime with n, hence 13/05/2010 cryptography - math background pp. 67 / 162

68 LINEAR EQUATIONS IN Z n take the modular equation: a y = b mod n where a, b Z n are fixed coefficients, and y Z n is the unknown variable to be found theorem: there exists a unique solution if and only if a, n are co-prime i.e. iff a, n share no common factor 2 i.e. iff (a, n) = 1 how to find the solution in some cases, later 13/05/2010 cryptography - math background pp. 68 / 162

69 FERMAT LITTLE THEOREM theorem: take any prime integer p 2, and any integer a 0, then: a p = a mod p (P. Fermat) for instance, taken p = 3 (prime): 2 3 = 8 = 2 mod = 27 = 0 = 3 mod = 64 = 1 = 4 mod 3 13/05/2010 cryptography - math background pp. 69 / 162

70 CONSEQUENCES if p 2 is a prime integer: Since: a p = a mod p It follows: a p 1 = 1 mod p (with the condition that a 0 mod p) for instance, taken p = 5 (prime): 2 4 = 16 = 1 mod = 81 = 1 mod = 256 = 1 mod 5 13/05/2010 cryptography - math background pp. 70 / 162

71 SOLVING LIN. EQ.S IN Z p linear equations of the form: a y = b mod p (p 2 prime) a, b Z p coeff.s and y Z p variable, admit the following (unique, mod p) solution: y = a 1 b = a p 2 b mod p (by Fermat) since, being p prime, (a, p) = 1 caution: be sure that a mod p 0! the same can be instanced for systems of linear equations (see later) 13/05/2010 cryptography - math background pp. 71 / 162

72 MODULAR FIELDS 13/05/2010 cryptography - math background pp. 72 / 162

73 MODULAR FIELDS we have seen that Z n (for any n 2) is a modular (finite) ring of n 1 elements to be a (finite) field, Z n only lacks the inverse elements for multiplication, i.e. the possibility to invert all its elements that is, given any a Z n, how do I find a Z n such that a a = 1 (of course, mod n)? Is it possible to find such an a for any integer a < n and any value of n? 13/05/2010 cryptography - math background pp. 73 / 162

74 MODULAR FIELDS we know that, given any positive a < n, there exists a positive integer a such that a a = 1, if and only if a, n are co-prime clearly, if n is a prime integer, every positive integer a < n will be co-prime with n conversely, if n is not a prime integer, there must exist some a < n that is not co-prime with n theorem: all elements of Z n (but 0) are invertible if and only if n is a prime integer pay attention: if n is not a prime integer, a few elements of Z n may be invertible, but not all of them 13/05/2010 cryptography - math background pp. 74 / 162

75 MODULAR INVERSION given any prime integer p 2 (Fermat): a p = a mod p a p 1 = 1 mod p (with the condition that a 0 mod p) let us go on with the idea a p 2 = a 1 mod p (still with the condition that a 0 mod p) that is, a p 2 behaves as the multiplicative inverse element of a (if p is prime!) 13/05/2010 cryptography - math background pp. 75 / 162

76 INVERSION EXAMPLES for instance, taken p = 5 (prime), and knowing that p 2 = 3, one has: 1 3 = 1 mod 5 and 1 1 = 1 mod = 3 mod 5 and 2 3 = 1 mod = 2 mod 5 and 3 2 = 1 mod = 4 mod 5 and 4 4 = 1 mod = 0 mod 5 no inverse (since 5 = 0 mod 5) 6 3 = 1 mod 5 and 6 1 = 1 mod 5 (the behaviour is periodic) 13/05/2010 cryptography - math background pp. 76 / 162

77 INVERSION THAT IS taken p = 5 (prime) one has: 1 1 = 1 mod = 3 mod = 2 mod = 4 mod 5 while 0 has no inverse, of course note that for each element of Z 5 we have found an inverse (but for 0) 13/05/2010 cryptography - math background pp. 77 / 162

78 MODULAR FIELD F p (or GF(p)) every (finite) modular ring Z n, such that n 2 is a prime integer, can be turned into a (finite) field simply add inversion to it, and compute the inverse using Fermat s litte theorem such a field is denoted F p (or also Galois Field of order p, GF(p)) a different field for every prime p 13/05/2010 cryptography - math background pp. 78 / 162

79 MODULAR FIELD F p (or GF(p)) given a prime integer p 2: F p = {0, 1, 2,, p 1}, +,, 0, 1 is called modular (Galois) field of order p, or GF(p), provided, for every element a, b F p : a + b a b is computed mod p is computed mod p a = p a so that a + ( a) = p = 0 mod p a 1 = a p 2 so that a a 1 = a a p 2 = a p 1 = 1 mod p F p is finite and contains exactly p elements 13/05/2010 cryptography - math background pp. 79 / 162

80 LINEAR EQUATIONS IN F p given a prime integer p 2, take the modular linear equation: a y = b mod p where a, b F p are fixed coefficients, and y F p is the unknown variable to be found: the unique solution (mod p) is: y = a 1 b mod p for instance, given p = 7 (prime): 5 y = 3 mod 7 y = = = = 9375 = 2 mod 7 and actually 5 2 = 10 = 3 mod 7 13/05/2010 cryptography - math background pp. 80 / 162

81 LINEAR SYSTEMS IN F p given a prime integer p 2, take the system of modular linear equations: A Y = B mod p where: A [F p ] m,m is a square matrix of order m 2 of fixed coefficients in F p B [F p ] m is a vector of order m 2 of constant terms in F p and Y [F p ] m is the vector of the unknown variables to be found in F p 13/05/2010 cryptography - math background pp. 81 / 162

82 LINEAR SYSTEMS IN F p the above system of linear equations admits a unique solution (mod p) iff det(a) 0 in this case (det(a) 0), the solution is: Y = A 1 B mod p the determinant det(a), the matrix inverse A 1 and the matrix-vector product A 1 B are computed as usual, remembering to take all the operations mod p over their entries 13/05/2010 cryptography - math background pp. 82 / 162

83 THE BINARY FIELD 13/05/2010 cryptography - math background pp. 83 / 162

84 THE BINARY FIELD F 2 (or GF(2)) when p = 2 (smallest prime excluding 1): F 2 = {0, 1}, +,, 0, 1 this is a well-know structure, since = = 0 0 = 2 0 = 2 = = = 0 1 = 2 1 = = = 0 IDENTITY = 2 = = = 1 XOR gate AND gate IDENTITY 13/05/2010 cryptography - math background pp. 84 / 162

85 THE BINARY FIELD F 2 (or GF(2)) in F 2 addition and subtraction coincide! observe in fact: = = 0 + ( 0) = = = = 0 + ( 1) = = = = 1 + ( 0) = = = = 1 + ( 1) = = 0 XOR gate still XOR gate do not extend this feature to p > 2! 13/05/2010 cryptography - math background pp. 85 / 162

86 THE BINARY FIELD F 2 (or GF(2)) the field F 2 (or GF(2)) is also called the binary field and is the simplest its hardware counterpart are the XOR and AND gates it is the natural field where to compute arithmetic (most arithmetic circuits are formed by XOR and AND gates only) 13/05/2010 cryptography - math background pp. 86 / 162

87 POLYNOMIALS 13/05/2010 cryptography - math background pp. 87 / 162

88 POLYNOMIALS everybody knows univariate polynomials (i.e., containing a single variable x) with integer coefficients: C(x) = c n x m + c m 1 x m c 1 x + c 0 where c i Z, for every 0 i m the integer m 0 is the degree of C(x) here, we are interested in polynomials not as functions of the variable x, but as objects that can be manipulated in various ways 13/05/2010 cryptography - math background pp. 88 / 162

89 POLYNOMIALS the set of all the polynomials (of any degree) with integer coefficients is denoted Z[x] polynomials in Z[x] can be added, subtracted and multiplied. They form a commutative ring with unity (the ring Z[x] is infinite): Z[x] = Z[x], +,, 0, 1 in general however, there is no multiplicative inverse element, i.e. given any polynomial P(x) Z[x] it is not possible to find P (x) Z[x] such that P(x) P (x) = 1 13/05/2010 cryptography - math background pp. 89 / 162

90 POLYNOMIAL DIVISION given any two polynomials P(x), D(x) Z[x], there exist two unique polynomials Q(x), R(x) Q[x] (with rational coeff.s), such that: P(x) = Q(x) D(x) + R(x) degree(r(x)) < degree(d(x)) Q(x) is the quotient, R(x) is the remainder this property resembles integer division but note that Q(x), R(x) have rational coeff. s, i.e., in general the coeff.s are not integer the algorithm for finding R(x) is well-known 13/05/2010 cryptography - math background pp. 90 / 162

91 EXAMPLE OF DIVISION IN Z[x] take x 4 + 2x 3 1, x Z[x] +1x 4 +2x x x 4 +2x 3 +0x 2 +0x 1 +1x 2 1x 4 3x 2 +0x 4 +2x 3 3x 2 +0x 1 +1x 2 +2x 2x 3 6x +0x 4 +0x 3 3x 2 6x 1 +1x 2 +2x 3 +3x x 4 +0x 3 +0x 2 6x +8 end 6x +8 x 2 +2x 3 remainder quotient in this special case, no need of rational numbers (because the most significant coefficient of the divisor x is 1!) verify: (x 2 + 2x 3) (x 2 + 3) + ( 6x + 8) = x 4 + 3x 2 + 2x 3 + 6x 3x 2 9 6x + 8 = x 4 + 2x 3 1 as it is expected to be 13/05/2010 cryptography - math background pp. 91 / 162

92 POLYNOMIALS OVER MODULAR RINGS AND FIELDS 13/05/2010 cryptography - math background pp. 92 / 162

93 POLYNOMIALS OVER RINGS restrict the set of the coeff. s of polynomials to the modular ring Z n (for a fixed n 2) such polynomials can be added, subtracted and multiplied mod n, in the obvious way Z n [x] = Z n [x], + mod n, mod n, 0, 1 but in general, it is not possible to find multiplicative inverse elements the structure Z n [x] is still an infinite commutative ring with unity, as is Z[x] sample additions and multiplications 13/05/2010 cryptography - math background pp. 93 / 162

94 POLYNOMIALS OVER FIELDS restrict the set of the coeff. s of polynomials to the finite field F p (for a fixed prime p 2) such polynomials can be added, subtracted and multiplied mod n, in the obvious way F p [x] = F p [x], + mod p, mod p, 0, 1 but in general, it is not possible to find multiplicative inverse elements the structure F p [x] is still an infinite commutative ring with unity, as are Z[x], Z n [x] 13/05/2010 cryptography - math background pp. 94 / 162

95 POLYNOMIAL DIVISION IN F p [x] given any two polynomials P(x), D(x) F p [x], there exist two unique polynomials Q(x), R(x) F p [x], such that: P(x) = S(x) D(x) + R(x) degree(r(x)) < degree(d(x)) S(x) is the quotient, R(x) is the remainder this property resembles integer division note that S(x), R(x) have coeff. s in F p [x]! the algorithm for finding S(x), R(x) is wellknown (same as for the polynomials in Z[x]) 13/05/2010 cryptography - math background pp. 95 / 162

96 EXAMPLE OF DIVISION IN F 3 [x] take x 4 + 2x 3 + 1, 2x F 3 [x] x 4 +2x x x 4 +2x 3 +0x 2 +0x +1 +2x 2 1x 4 2x 2 +0x 4 +2x 3 +1x 2 +0x +1 +2x 2 +1x 2x 3 1x +0x 4 +0x 3 +1x 2 +2x +1 +2x 2 +1x + 2 1x x 4 +0x 3 +0x 2 +2x +2 end 2x +2 2x 2 + x + 2 remainder quotient pay attention to: 1 = 2, 2 = 1, 2 1 = 2 mod 3. verify (remember also that: 4 = 1, 6 = 0, 3 = 0 mod 3): (2x 2 + x + 2) (2x 2 + 1) + (2x + 2) = 4x 4 + 2x 2 + 2x 3 + x + 4x x + 2 = = 4x 4 + 2x 3 + 6x 2 + 3x + 4 = x 4 + 2x 3 + 0x 2 + 0x + 1 = x 4 + 2x mod 3 13/05/2010 cryptography - math background pp. 96 / 162

97 POLYNOMIAL MOD. CONGRUENCE given any polynomials P(x), D(x) ( Z[x] or Z n [x] or F p [x]), write: P(x) mod D(x) = R(x) with R(x) the remainder of P(x) / D(x) modulus D(x) congruence: P(x) = Q(x) mod D(x) P(x) mod D(x) = Q(x) mod D(x) 13/05/2010 cryptography - math background pp. 97 / 162

98 PROPERTIES OF POLY MOD. CONGRUENCE the operator mod commutes: (P(x) + Q(x)) mod D(x) = ((P(x) mod D(x)) + (Q(x) mod D(x))) mod D(x) the same holds for subtraction (P(x) Q(x)) mod D(x) = ((P(x) mod D(x)) (Q(x) mod D(x))) mod D(x) same properties as mod n modular reduction by a polynomial D(x) defined as for modular reduction by an integer n 13/05/2010 cryptography - math background pp. 98 / 162

99 POLY MOD. COMPUTATION IN PARTICULAR taking mod D(x) is equivalent to assuming that D(x) = 0 (remember n = 0 mod n!) for instance (in Z[x]), see immediately that: x 3 + 2x + 5 = 2x + 7 mod (x 3 2) because: x 3 2 = 0 x 3 = 2 and: x 3 + 2x + 5 = 2 + 2x + 5 = 2x + 7 verify dividing: (x 3 + 2x + 5) mod (x 3 2)! 13/05/2010 cryptography - math background pp. 99 / 162

100 POLYNOMIALS OVER THE BINARY FIELD F 2 (GF(2)) 13/05/2010 cryptography - math background pp. 100 / 162

101 POLYNOMIALS OVER F 2 (GF(2)) when the field of the coefficients is F 2 (or GF(2)), things become very simple a coefficient is either 0 or 1 (i.e., a bit) a power x i is either present (coeff. 1, usually not written) or absent (coeff. 0) a polynomial in F 2 [x] is nothing but a list of powers of x 13/05/2010 cryptography - math background pp. 101 / 162

102 EXAMPLES OF OP.S IN F 2 [x] let A(x), B(x) F 2 [x]: A(x) = x 2 + x + 1 and B(x) = x 3 + x then: A(x) + B(x) = (x 2 + x + 1) + (x 3 + x) = = x 3 + x 2 + x + x + 1 = x 3 + x 2 + (1 + 1)x + 1 = = x 3 + x 2 + 0x + 1 = x 3 + x A(x) B(x) = (x 2 + x + 1) (x 3 + x) = = x 5 + x 4 + x 3 + x 3 + x 2 + x = x 5 + x 4 + x 2 + x pay attention to: = 0! in general: (even times) = 0! 13/05/2010 cryptography - math background pp. 102 / 162

103 EXAMPLES OF OP.S IN F 2 [x] sometimes peculiarities may occur: (x + 1) 2 = (x + 1)(x + 1) = x 2 + x + x + 1 = = x (different from ordinary algebra) (x + 1) 3 = (x + 1)(x + 1)(x + 1) = x 3 + x x 2 + x 2 + x + x + x + 1 = x 3 + x 2 + x + 1 (different from ordinary algebra) can you infer the general rule? 13/05/2010 cryptography - math background pp. 103 / 162

104 PLYNOMIAL DIVISION IN F 2 [x] take x 4 + x 3 + 1, x F 2 [x] x 4 x 3 1 x 2 1 x 4 x 3 1 x 2 x 4 x 2 x 3 x 2 1 x 2 x x 3 x x 2 x 1 x 2 x 1 x 2 1 x end x x 2 + x + 1 remainder quotient pay attention to: 1 = 1 mod 2, i.e. add. and sub. coincide verify: (x 2 + x + 1) (x 2 + 1) + x = x 4 + x 2 + x 3 + x + x x = = x 4 + x mod 2 as it is expected to be hence we can write: (x 4 + x 3 + 1) = x mod (x 2 + 1) 13/05/2010 cryptography - math background pp. 104 / 162

105 PLYNOMIAL REDUCTION IN F 2 [x] computing polynomial division of F(x) by G(x) is like setting G(x) = 0 and replacing in F(x) from the previous slide: G(x) = x 2 + 1, hence G(x) = 0 x = 0 x 2 = 1 and replacing in F(x) = x 4 + x 3 + 1, it yields: x 4 + x = (x 2 ) 2 + x x = x = 1 + x + 1 = x hence we have: (x 4 + x 3 + 1) = x mod (x 2 + 1) as seen before by performing a full division. but reduction DOES NOT REALLY REQUIRE TO COMPUTE A FULL DIVISION (since we are not interested in the quotient, but only in the remainder) 13/05/2010 cryptography - math background pp. 105 / 162

106 POLYNOMIALS OVER F 2 a polynomial in F 2 [x] can be identified to a string of bits for instance: x 5 + x 4 + x (degree 5 6 bits) in general: F(x) string of n + 1 bits (supposing F(x) is of degree n) for any degree n, how many different polynomials? answer: 2 n /05/2010 cryptography - math background pp. 106 / 162

107 IRREDUCIBLE POLYNOMIALS 13/05/2010 cryptography - math background pp. 107 / 162

108 IRREDUCIBLE POLYNOMIALS a polynomial of degree m 2 is said to be irreducible if it cannot be factored into two or more polynomials of lower degree A(x) is irreducible if there do not exist any two polynomials B(x), C(x) (not reducing to pure constant terms) such that A(x) = B(x) C(x) for every degree, there exist irreducible polynomials in Z[x], Z n [x] and F p [x], for any integer n and prime integer p 13/05/2010 cryptography - math background pp. 108 / 162

109 IRREDUCIBLE POLYNOMIALS x and x + 1 are irreducible by definition is x 2 + x irreducible? no, because x 2 + x = x (x + 1) is x irreducible? no, because x = (x + 1) (x + 1) is x 2 + x + 1 irreducible? yes, but why? 13/05/2010 cryptography - math background pp. 109 / 162

110 RUFFINI RULE a polynomial F(x) admits the linear factor (x a) iff a is a root of F(x) for the polynomials over F 2 (or GF(2)): F(x) admits the factor (x 1), which coincides with (x + 1), iff 1 is a root of F(x) hence, replace x in F(x) with 1 and see if F(1) = 0; if so, F(x) = F (x) (x + 1) in practice, just count the terms of F(x) 13/05/2010 cryptography - math background pp. 110 / 162

111 USE OF RUFFINI RULE Ruffini rule gives an easy way for checking whether a polynomial F(x) F 2 [x] admits the linear factor (x + 1) does (x 2 + x + 1) admit factor (x + 1)? no, since it has 3 terms (and 3 is odd) does moreover (x 2 + x + 1) admit factor x? no, since it contains the constant term +1 since the only linear factors in F 2 [x] are (x + 1) and x, and a F(x) of degree 2 can only be split into linear factors, (x 2 + x + 1) is irreducible of course, Ruffini rule works also in F p [x] 13/05/2010 cryptography - math background pp. 111 / 162

112 BINARY EXTENSION FIELDS 13/05/2010 cryptography - math background pp. 112 / 162

113 MOVING TOWARDS FIELDS remember that F 2 [x] is not a polynomial field (there are no multiplicative inverse elements, in general) how to make it into a polynomial field? the answer is contained in irreducible polynomials 13/05/2010 cryptography - math background pp. 113 / 162

114 THE EXTENSION FIELD GF(2 n ) select an irreducible polynomial G(x) F 2 [x] of degree n G(x) is called generator polynomial the extension field GF(2 n ) (for n 2) is: GF(2 n ) = F 2 [x n ], +,, 0, 1 where: F 2 [x n ] set of all the polynomials over F 2 of degree under n +, are the polynomial addition and multiplication modulus the selected (and fixed) polynomial G(x) G(x) is the generator polynomial of GF(2 n ). 13/05/2010 cryptography - math background pp. 114 / 162

115 THE EXTENSION FIELD GF(2 n ) fixed a generator G(x) of degree n, take A(x), B(x) GF(2 n ), and compute addition and multiplication as follows: A(x) + B(x) mod G(x) and similarly for subtraction A(x) B(x) mod G(x) always take the result mod G(x) 13/05/2010 cryptography - math background pp. 115 / 162

116 EXAMPLE IN GF(2 2 ) the elements of GF(2 n ) with n = 2 (i.e. GF(2 2 )) are all the polynomials in F 2 [x] of degree under n = 2, i.e. deg. 0 or 1 0, 1 degree 0 x, x + 1 degree 1 then GF(2 2 ) contains 2 2 = 4 elements this is, in some sense, the simplest possible field of polynomials 13/05/2010 cryptography - math background pp. 116 / 162

117 EXAMPLE IN GF(2 2 ) fix the generator polynomial G(x) = x 2 + x + 1 (degree n = 2, irred.): (x + 1) + x = 1 mod G(x) (x + 1) 2 = x = x = x mod G(x) remember in fact that taking mod G(x) is equivalent to setting G(x) = 0, hence: x 2 + x + 1 = 0 x 2 = x + 1 an replacing x 2 in x yields x 13/05/2010 cryptography - math background pp. 117 / 162

118 EXAMPLE IN GF(2 3 ) the elements of GF(2 3 ) are all the polynomials in F 2 [x] of degree under n = 3, i.e. degree 0, 1 or 2 0, 1 degree 0 x, x + 1 degree 1 x 2, x 2 + 1, x 2 + x, x 2 + x + 1 degree 2 then GF(2 2 ) contains 2 3 = 8 elements in general, GF(2 n ) contains 2 n elements 13/05/2010 cryptography - math background pp. 118 / 162

119 EXAMPLE IN GF(2 3 ) fix gen. G(x) = x 3 + x (deg. n = 3, irred.). it holds: x 3 + x = 0, i.e., x 3 = x (x + 1) 3 = x 3 + x 2 + x + 1 = = x x 2 + x + 1 = x mod G(x) (x 2 + 1) (x 2 + x + 1) = = x 4 + x 3 + x 2 + x 2 + x + 1= x 4 + x 3 + x + 1 = = = x x 3 + x 3 + x + 1 = x(x 2 + 1) + x x + 1 = = x 3 + x + x 2 + x = x 3 + x 2 = = x x 2 = 1 mod G(x) note that: x 2 + x + 1 = (x 2 + 1) 1 mod G(x) 13/05/2010 cryptography - math background pp. 119 / 162

120 FINITENESS OF GF(2 n ) the elements of GF(2 n ) (with n 2) are all the polynomials of F 2 [x] of degree under n (i.e. of deg. n 1, n 2,, 1, 0) then they can be identified to the strings of bits of length exactly n there are 2 n such strings the field GF(2 n ) is finite and its cardinality is of 2 n elements (which are polynomials) 13/05/2010 cryptography - math background pp. 120 / 162

121 HOW TO FIND THE INVERSE we have not yet spoken of multiplicative inverse elements in GF(2 n ) but it is necessary to have inverse elements for GF(2 n ) to be a field inverse elements can be found in GF(2 n ) using the generalization of Fermat little theorem 13/05/2010 cryptography - math background pp. 121 / 162

122 FERMAT LITTLE THEOREM take an irreducible generator polynomial G(x) of degree n 2 and any polynomial F(x) GF(2 n ), pose k = 2 n, then: F(x) k = F(x) mod G(x) (generalisation of Fermat little theorem) for instance, taken G(x) = x 2 + x + 1 (of deg. n = 2, irred.), it holds k = 2 2 = 4 and hence: (x + 1) 4 = ((x + 1) 2 ) 2 = (x 2 + 1) 2 = (x ) 2 = = x 2 = x + 1 mod G(x) as it is expected to be 13/05/2010 cryptography - math background pp. 122 / 162

123 CONSEQUENCES if the generator G(x) is an irreducible polynomial of degree n 2 and k = 2 n : since: F(x) k = F(x) mod G(x) it follows: F(x) k 1 = 1 mod G(x) and also: F(x) k 2 = F(x) 1 mod G(x) (with the condition that F(x) 0 mod G(x)) therefore F(x) k 2 is the multiplicative inverse element of F(x) (mod G(x)) 13/05/2010 cryptography - math background pp. 123 / 162

124 INVERSION EXAMPLE taken the generator G(x) = x 2 + x + 1 (of deg. n = 2, irred.), it holds k = 2 2 = 4, and hence: (x + 1) 4 2 = (x + 1) 2 = x = = x = x mod G(x) and in fact: (x + 1) x = x 2 + x = x x = 1 mod G(x) this means that x is the inverse element of (x + 1) (of course, mod G(x)) 13/05/2010 cryptography - math background pp. 124 / 162

125 MULTIPLICATIVE GENERATORS the monomial x is a multiplicative generator for binary extension fields for instance: G(x) = x 2 + x + 1 (irred.) x 0 mod G(x) = 1 x 1 mod G(x) = x x 2 mod G(x) = x + 1 GF(2 2 ) (excluding 0) x 3 mod G(x) = x x 2 mod G(x) = x (x + 1) mod G(x) = = x 2 + x = x x = 1 (periodic ). the same holds for GF(p n ) 13/05/2010 cryptography - math background pp. 125 / 162

126 FIELD GF(2 n ) IN SUMMARY given an irreducible generator polynomial G(x) of degree n 2, the algebraic structure: GF(2 n ) = < F 2 [x n ], +,, 0, 1 > is a finite field of 2 n elements. the elements of GF(2 n ) are polynomials with coefficients over GF(2) (or F 2 ) all the operations are computed mod G(x). multiplicative inverse exist for all the elements of GF(2 n ) (but for 0), and can by found by Fermat little theorem 13/05/2010 cryptography - math background pp. 126 / 162

127 MODULAR EXTENSION FIELDS 13/05/2010 cryptography - math background pp. 127 / 162

128 POLINOMYALS OVER F p (GF(p)) consider polynomials with coefficients over F p (also called GF(p)), for a fixed prime integer p 2 a coefficient can be: 0, 1, 2, p 1 then a polynomial in F p [x] is a list of powers of x, with coefficients as above example: x 2 + 2x + 1 (for p = 3, prime) 13/05/2010 cryptography - math background pp. 128 / 162

129 POLYNOMIALS OVER F p EXAMPLES for the prime p = 3: (x + 1) + (x 2 + 2x + 1) = x x 2 + 2x + 1 = = x 2 + 3x + 2 = x since 3 = 0 mod 3 for the prime p = 5: (x 2 + 3) (x 3 + 2x + 4) = = x 5 + 2x 3 + 4x 2 + 3x 3 + 6x + 12 = = x 5 + 5x 3 + 4x 2 + 6x + 12 = = x 5 + 4x 2 + x + 2 since 5 = 0, 6 = 1 and 12 = 2 mod 5 13/05/2010 cryptography - math background pp. 129 / 162

130 THE EXTENSION FIELD GF(p n ) the ideas for building modular fields F p (p 2 prime), and binary extension fields F 2 [x n ] (n 2), can be combined the result is the family of modular extension fields F p [x n ] (p, n 2, p is a prime integer) fields F p [x n ] are also denoted GF(p n ) (Galois Fields of order p n, p is prime) 13/05/2010 cryptography - math background pp. 130 / 162

131 THE EXTENSION FIELD GF(p n ) take an irreducible generator polynomial G(x) F p [x], for a prime integer p 2, of degree n 2, the algebraic structure: GF(p n ) = F p [x n ], +,, 0, 1 is a finite field of p n elements the elements of GF(p n ) are polynomials with coefficients over GF(p) (or F p ) all the operations are computed mod G(x) the field GF(p n ) contains p n elements 13/05/2010 cryptography - math background pp. 131 / 162

132 FERMAT LITTLE THEOREM take an irreducible generator polynomial G(x) F p [x], for a prime p 2, of degree n 2, and take any polynomial F(x) GF(p n ), pose k = p n, then: F(x) k = F(x) mod G(x) (generalisation of Fermat little theorem) hence it follows (as in previous cases): F(x) k 1 = 1 mod G(x) F(x) k 2 = F(x) 1 mod G(x) (inverse!) (with the cond. that F(x) 0 mod G(x)) 13/05/2010 cryptography - math background pp. 132 / 162

133 FIELD EXAMPLE GF(3 2 ) fix p = 3 (prime) and n = 2 the elements of GF(3) are: 0, 1, 2 the elements of GF(3 2 ) are: 0, 1, 2 (deg. 0, 3 poly. s) x, 2x, x + 1, x + 2, 2x + 1, 2x + 2 (deg. 1, 6 poly. s) there are k = 3 2 = 9 elements in GF(3 2 ) take the generator G(x) = x in GF(3) the polynomial G(x) is irreducible were not so, G(x) should split into two linear factors of the type (x + a), with a = 0, 1 or 2 but none of the a s is a root of G(x) 13/05/2010 cryptography - math background pp. 133 / 162

134 INVERSION EXAMPLE IN GF(3 2 ) remember that: G(x) = 0 x = 0 x 2 = 1 = 2 as 1 = 2 mod 3 to compute an inverse element: (2x + 1) 1 = (2x + 1) 9 2 = (2x + 1) 7 = = (2x + 1) 6 (2x + 1) = ((2x + 1) 2 ) 3 (2x + 1) = = (4x 2 + 4x + 1) 3 (2x + 1) = (x 2 + x + 1) 3 (2x + 1) = = (2 + x + 1) 3 (2x + 1) = (x + 3) 3 (2x + 1) = x 3 (2x + 1) = = x 2 x (2x + 1) = 2x (2x + 1) = 4x 2 + 2x = = x 2 + 2x = 2x + 2 mod G(x) and in fact: (2x + 1)(2x + 2) = 4x 2 + 4x + 2x + 2 = 4x 2 + 6x + 2 = = x = = 4 = 1 mod G(x) as it is expected to be 13/05/2010 cryptography - math background pp. 134 / 162

135 COMPOSITE GALOIS FIELDS suppose GF(p h ) is a modular extension field, the elements of which consist of polynomials of degree under h with coeff.s that are integers mod p construct a new, larger modular extension field, using the elements of GF(p h ) as coefficients of new polynomials, of degree under k this new field is GF(GF(p h )) k = GF(p hk ), and is called a composite (Galois) field the elements of GF(p hk ) are polynomials, the coefficients of which are themselves polynomials (the coeff.s of the latter ones are integers mod p) 13/05/2010 cryptography - math background pp. 135 / 162

136 COMPOSITE GALOIS FIELDS dually: let GF(p m ) be a modular extension field. It can be constructed by using polynomials of degree under m, with coeff.s that are integers mod p but, if m = hk (for h, k 2), i.e. if m is decomposable into non-trivial factors, then the field GF(p m ) can be itself decomposed into two nested fields: coefficient field GF(p h ) - internal field complete field GF(GF(p h ) k ) = GF(p hk ) - external field (the roles of h, k are interchangeable) this decomposition may be very helpful in the implementations, but does not always apply if m is itself prime, no decomposition is possible 13/05/2010 cryptography - math background pp. 136 / 162

137 EXAMPLE COMPOSITE FIELD take p = 2 (binary extension fields). G(x) = x 4 + x (irreducible, check yourself!) G(x) generates GF(2 4 ), with 2 4 = 16 elements. but 4 = 2 2, hence GF(2 4 ) = GF(GF(2 2 ) 2 ) (here h = k = 2) construct the two nested fields: Internal field, use the gen. G 2 1 (y) = y + y + 1 (irred. over GF(2)) External field, use the gen. G 2 (x) = x 2 + y x + 1 (irred. over GF(2 2 )) elem.s of GF(2 4 ): (ay 1 + by 0 )x 1 + (cy 1 + dy 0 )x 0 (a, b, c, d = 0, 1) of course, interpret G 2 (x) as follows: G 2 (x) = (0y + 1) x 2 + (1y + 0) x 1 + (0y + 1) x 0 since its coeff.s are themselves polynomials (use two distinct variables y and x to avoid confusion). complete yourself (in particular, check that G 2 (x) is irreducible over GF(2 2 )). Try with the field GF(2 6 ). 13/05/2010 cryptography - math background pp. 137 / 162

138 CONCLUSIONS ON FINITE FIELDS 13/05/2010 cryptography - math background pp. 138 / 162

139 THE COMPLETION THEOREM there exist only three familes of finite fields: modular fields: GF(p) for every prime p 2 the elements are 0, 1,, p 1 GF(2) is the simplest case, called binary field binary extension fields: GF(2 n ) for every integer n 2 the elements are the polynomials of degree under n with coefficients 0 or 1 modular extension fields: GF(p n ) for every prime p 3 and integer n 2 the elements are the polynomials of degree under n with coefficients 0, 1,,, p 1 no other family of finite fields exist 13/05/2010 cryptography - math background pp. 139 / 162

140 FIELD ISOMORPHISM two fields F, F are isomorphic iff there exists a one-to-one function θ: F F such that, taken the elements a, b F, it holds: θ(a + b) = θ(a) + θ(b) and θ( a) = θ(a) θ(a b) = θ(a) θ(b) and θ(a 1 ) = θ(a) 1 θ(0) = 0 and θ(1) = 1 in practice, ϕ commutes with field operations two isomorphic fields need have the same number of elements (θ is one-to-one) 13/05/2010 cryptography - math background pp. 140 / 162

141 THE ISOMORPHISM THEOREM let F, F be any two extension fields generated by the irred. polynomials G (x), G (x), respectively theorem: if F, F are of the same size, they are necessarily isomorphic, i.e. there exists an isomorphism θ: F F in other terms, each element f of F admits a corresponding element θ(f) in F, behaving in the same way (and viceversa) 13/05/2010 cryptography - math background pp. 141 / 162

142 THE ISOMORPHISM THEOREM the extension fields GF(2 n ) (and GF(p n )) DO NOT DEPEND on the chosen irreducible generator polynomial that is, fixed an integer n 2 (and prime p 2), there exists a unique GF(2 n ) (and GF(p n )) put another way, if G (x), G (x) are both irreducible generators of degree n, they are equivalent for building GF(2 n ) (and GF(p n )) hence, select G (x) or G (x) at will (but do not mix them during the computation, of course) 13/05/2010 cryptography - math background pp. 142 / 162

143 ISOMORPHISM EXAMPLE the binary extension field GF(2 3 ) (size 2 3 = 8) can be generated in two different ways: G (x) = x 3 + x G (x) = x 3 + x + 1 since both G (x) and G (x) are irreducible over GF(2) each of G (x) and G (x) yields a representation of GF(2 3 ) constructing the isomorphism θ is not so immediate, though not really difficult 13/05/2010 cryptography - math background pp. 143 / 162

144 FIELD REPRESENTATION it is said that two irreducible polynomials G (x), G (x), of identical degree, generate two DIFFERENT REPERSENTATIONS of the SAME FINITE EXTENSION FIELD the isomorphism function θ can be effectively determined, starting from G (x), G (x) the function θ is actually a linear transformation an extension field admits as many different representations as the number of irreducible polynomials of identical degree 13/05/2010 cryptography - math background pp. 144 / 162

Chapter 4 Finite Fields

Chapter 4 Finite Fields Chapter 4 Finite Fields Introduction will now introduce finite fields of increasing importance in cryptography AES, Elliptic Curve, IDEA, Public Key concern operations on numbers what constitutes a number

More information

A field F is a set of numbers that includes the two numbers 0 and 1 and satisfies the properties:

A field F is a set of numbers that includes the two numbers 0 and 1 and satisfies the properties: Byte multiplication 1 Field arithmetic A field F is a set of numbers that includes the two numbers 0 and 1 and satisfies the properties: F is an abelian group under addition, meaning - F is closed under

More information

Finite Fields. Mike Reiter

Finite Fields. Mike Reiter 1 Finite Fields Mike Reiter reiter@cs.unc.edu Based on Chapter 4 of: W. Stallings. Cryptography and Network Security, Principles and Practices. 3 rd Edition, 2003. Groups 2 A group G, is a set G of elements

More information

Mathematical Foundations of Cryptography

Mathematical Foundations of Cryptography Mathematical Foundations of Cryptography Cryptography is based on mathematics In this chapter we study finite fields, the basis of the Advanced Encryption Standard (AES) and elliptical curve cryptography

More information

Finite Fields: An introduction through exercises Jonathan Buss Spring 2014

Finite Fields: An introduction through exercises Jonathan Buss Spring 2014 Finite Fields: An introduction through exercises Jonathan Buss Spring 2014 A typical course in abstract algebra starts with groups, and then moves on to rings, vector spaces, fields, etc. This sequence

More information

ECEN 5022 Cryptography

ECEN 5022 Cryptography Elementary Algebra and Number Theory University of Colorado Spring 2008 Divisibility, Primes Definition. N denotes the set {1, 2, 3,...} of natural numbers and Z denotes the set of integers {..., 2, 1,

More information

Rings. EE 387, Notes 7, Handout #10

Rings. EE 387, Notes 7, Handout #10 Rings EE 387, Notes 7, Handout #10 Definition: A ring is a set R with binary operations, + and, that satisfy the following axioms: 1. (R, +) is a commutative group (five axioms) 2. Associative law for

More information

2a 2 4ac), provided there is an element r in our

2a 2 4ac), provided there is an element r in our MTH 310002 Test II Review Spring 2012 Absractions versus examples The purpose of abstraction is to reduce ideas to their essentials, uncluttered by the details of a specific situation Our lectures built

More information

Lecture 7: Polynomial rings

Lecture 7: Polynomial rings Lecture 7: Polynomial rings Rajat Mittal IIT Kanpur You have seen polynomials many a times till now. The purpose of this lecture is to give a formal treatment to constructing polynomials and the rules

More information

Fields in Cryptography. Çetin Kaya Koç Winter / 30

Fields in Cryptography.   Çetin Kaya Koç Winter / 30 Fields in Cryptography http://koclab.org Çetin Kaya Koç Winter 2017 1 / 30 Field Axioms Fields in Cryptography A field F consists of a set S and two operations which we will call addition and multiplication,

More information

Finite Fields and Error-Correcting Codes

Finite Fields and Error-Correcting Codes Lecture Notes in Mathematics Finite Fields and Error-Correcting Codes Karl-Gustav Andersson (Lund University) (version 1.013-16 September 2015) Translated from Swedish by Sigmundur Gudmundsson Contents

More information

Polynomials. Chapter 4

Polynomials. Chapter 4 Chapter 4 Polynomials In this Chapter we shall see that everything we did with integers in the last Chapter we can also do with polynomials. Fix a field F (e.g. F = Q, R, C or Z/(p) for a prime p). Notation

More information

Public-key Cryptography: Theory and Practice

Public-key Cryptography: Theory and Practice Public-key Cryptography Theory and Practice Department of Computer Science and Engineering Indian Institute of Technology Kharagpur Chapter 2: Mathematical Concepts Divisibility Congruence Quadratic Residues

More information

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer? Chapter 3: Theory of Modular Arithmetic 25 SECTION C Solving Linear Congruences By the end of this section you will be able to solve congruence equations determine the number of solutions find the multiplicative

More information

LECTURE NOTES IN CRYPTOGRAPHY

LECTURE NOTES IN CRYPTOGRAPHY 1 LECTURE NOTES IN CRYPTOGRAPHY Thomas Johansson 2005/2006 c Thomas Johansson 2006 2 Chapter 1 Abstract algebra and Number theory Before we start the treatment of cryptography we need to review some basic

More information

NUMBER THEORY. Anwitaman DATTA SCSE, NTU Singapore CX4024. CRYPTOGRAPHY & NETWORK SECURITY 2018, Anwitaman DATTA

NUMBER THEORY. Anwitaman DATTA SCSE, NTU Singapore CX4024. CRYPTOGRAPHY & NETWORK SECURITY 2018, Anwitaman DATTA NUMBER THEORY Anwitaman DATTA SCSE, NTU Singapore Acknowledgement: The following lecture slides are based on, and uses material from the text book Cryptography and Network Security (various eds) by William

More information

MTH310 EXAM 2 REVIEW

MTH310 EXAM 2 REVIEW MTH310 EXAM 2 REVIEW SA LI 4.1 Polynomial Arithmetic and the Division Algorithm A. Polynomial Arithmetic *Polynomial Rings If R is a ring, then there exists a ring T containing an element x that is not

More information

Math 312/ AMS 351 (Fall 17) Sample Questions for Final

Math 312/ AMS 351 (Fall 17) Sample Questions for Final Math 312/ AMS 351 (Fall 17) Sample Questions for Final 1. Solve the system of equations 2x 1 mod 3 x 2 mod 7 x 7 mod 8 First note that the inverse of 2 is 2 mod 3. Thus, the first equation becomes (multiply

More information

Commutative Rings and Fields

Commutative Rings and Fields Commutative Rings and Fields 1-22-2017 Different algebraic systems are used in linear algebra. The most important are commutative rings with identity and fields. Definition. A ring is a set R with two

More information

Groups, Rings, and Finite Fields. Andreas Klappenecker. September 12, 2002

Groups, Rings, and Finite Fields. Andreas Klappenecker. September 12, 2002 Background on Groups, Rings, and Finite Fields Andreas Klappenecker September 12, 2002 A thorough understanding of the Agrawal, Kayal, and Saxena primality test requires some tools from algebra and elementary

More information

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. 2 Arithmetic This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. (See [Houston, Chapters 27 & 28]) 2.1 Greatest common divisors Definition 2.16. If a, b are integers, we say

More information

1. Group Theory Permutations.

1. Group Theory Permutations. 1.1. Permutations. 1. Group Theory Problem 1.1. Let G be a subgroup of S n of index 2. Show that G = A n. Problem 1.2. Find two elements of S 7 that have the same order but are not conjugate. Let π S 7

More information

Mathematics for Cryptography

Mathematics for Cryptography Mathematics for Cryptography Douglas R. Stinson David R. Cheriton School of Computer Science University of Waterloo Waterloo, Ontario, N2L 3G1, Canada March 15, 2016 1 Groups and Modular Arithmetic 1.1

More information

Galois fields/1. (M3) There is an element 1 (not equal to 0) such that a 1 = a for all a.

Galois fields/1. (M3) There is an element 1 (not equal to 0) such that a 1 = a for all a. Galois fields 1 Fields A field is an algebraic structure in which the operations of addition, subtraction, multiplication, and division (except by zero) can be performed, and satisfy the usual rules. More

More information

Chapter 3. Rings. The basic commutative rings in mathematics are the integers Z, the. Examples

Chapter 3. Rings. The basic commutative rings in mathematics are the integers Z, the. Examples Chapter 3 Rings Rings are additive abelian groups with a second operation called multiplication. The connection between the two operations is provided by the distributive law. Assuming the results of Chapter

More information

Chapter 4 Mathematics of Cryptography

Chapter 4 Mathematics of Cryptography Chapter 4 Mathematics of Cryptography Part II: Algebraic Structures Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4.1 Chapter 4 Objectives To review the concept

More information

Finite Fields. SOLUTIONS Network Coding - Prof. Frank H.P. Fitzek

Finite Fields. SOLUTIONS Network Coding - Prof. Frank H.P. Fitzek Finite Fields In practice most finite field applications e.g. cryptography and error correcting codes utilizes a specific type of finite fields, namely the binary extension fields. The following exercises

More information

AN ALGEBRA PRIMER WITH A VIEW TOWARD CURVES OVER FINITE FIELDS

AN ALGEBRA PRIMER WITH A VIEW TOWARD CURVES OVER FINITE FIELDS AN ALGEBRA PRIMER WITH A VIEW TOWARD CURVES OVER FINITE FIELDS The integers are the set 1. Groups, Rings, and Fields: Basic Examples Z := {..., 3, 2, 1, 0, 1, 2, 3,...}, and we can add, subtract, and multiply

More information

CHAPTER 3. Congruences. Congruence: definitions and properties

CHAPTER 3. Congruences. Congruence: definitions and properties CHAPTER 3 Congruences Part V of PJE Congruence: definitions and properties Definition. (PJE definition 19.1.1) Let m > 0 be an integer. Integers a and b are congruent modulo m if m divides a b. We write

More information

MATH 361: NUMBER THEORY FOURTH LECTURE

MATH 361: NUMBER THEORY FOURTH LECTURE MATH 361: NUMBER THEORY FOURTH LECTURE 1. Introduction Everybody knows that three hours after 10:00, the time is 1:00. That is, everybody is familiar with modular arithmetic, the usual arithmetic of the

More information

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer? Chapter 3: Theory of Modular Arithmetic 25 SECTION C Solving Linear Congruences By the end of this section you will be able to solve congruence equations determine the number of solutions find the multiplicative

More information

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography David R. Wilkins Copyright c David R. Wilkins 2000 2013 Contents 9 Introduction to Number Theory 63 9.1 Subgroups

More information

Discrete Logarithms. Let s begin by recalling the definitions and a theorem. Let m be a given modulus. Then the finite set

Discrete Logarithms. Let s begin by recalling the definitions and a theorem. Let m be a given modulus. Then the finite set Discrete Logarithms Let s begin by recalling the definitions and a theorem. Let m be a given modulus. Then the finite set Z/mZ = {[0], [1],..., [m 1]} = {0, 1,..., m 1} of residue classes modulo m is called

More information

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography David R. Wilkins Copyright c David R. Wilkins 2006 Contents 9 Introduction to Number Theory and Cryptography 1 9.1 Subgroups

More information

3 The fundamentals: Algorithms, the integers, and matrices

3 The fundamentals: Algorithms, the integers, and matrices 3 The fundamentals: Algorithms, the integers, and matrices 3.4 The integers and division This section introduces the basics of number theory number theory is the part of mathematics involving integers

More information

Ch 7 Summary - POLYNOMIAL FUNCTIONS

Ch 7 Summary - POLYNOMIAL FUNCTIONS Ch 7 Summary - POLYNOMIAL FUNCTIONS 1. An open-top box is to be made by cutting congruent squares of side length x from the corners of a 8.5- by 11-inch sheet of cardboard and bending up the sides. a)

More information

Congruences and Residue Class Rings

Congruences and Residue Class Rings Congruences and Residue Class Rings (Chapter 2 of J. A. Buchmann, Introduction to Cryptography, 2nd Ed., 2004) Shoichi Hirose Faculty of Engineering, University of Fukui S. Hirose (U. Fukui) Congruences

More information

, a 1. , a 2. ,..., a n

, a 1. , a 2. ,..., a n CHAPTER Points to Remember :. Let x be a variable, n be a positive integer and a 0, a, a,..., a n be constants. Then n f ( x) a x a x... a x a, is called a polynomial in variable x. n n n 0 POLNOMIALS.

More information

MATH 431 PART 2: POLYNOMIAL RINGS AND FACTORIZATION

MATH 431 PART 2: POLYNOMIAL RINGS AND FACTORIZATION MATH 431 PART 2: POLYNOMIAL RINGS AND FACTORIZATION 1. Polynomial rings (review) Definition 1. A polynomial f(x) with coefficients in a ring R is n f(x) = a i x i = a 0 + a 1 x + a 2 x 2 + + a n x n i=0

More information

Q 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today?

Q 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today? 2 Mod math Modular arithmetic is the math you do when you talk about time on a clock. For example, if it s 9 o clock right now, then it ll be 1 o clock in 4 hours. Clearly, 9 + 4 1 in general. But on a

More information

4 PRIMITIVE ROOTS Order and Primitive Roots The Index Existence of primitive roots for prime modulus...

4 PRIMITIVE ROOTS Order and Primitive Roots The Index Existence of primitive roots for prime modulus... PREFACE These notes have been prepared by Dr Mike Canfell (with minor changes and extensions by Dr Gerd Schmalz) for use by the external students in the unit PMTH 338 Number Theory. This booklet covers

More information

Mathematics 136 Calculus 2 Everything You Need Or Want To Know About Partial Fractions (and maybe more!) October 19 and 21, 2016

Mathematics 136 Calculus 2 Everything You Need Or Want To Know About Partial Fractions (and maybe more!) October 19 and 21, 2016 Mathematics 36 Calculus 2 Everything You Need Or Want To Know About Partial Fractions (and maybe more!) October 9 and 2, 206 Every rational function (quotient of polynomials) can be written as a polynomial

More information

Algebra. Modular arithmetic can be handled mathematically by introducing a congruence relation on the integers described in the above example.

Algebra. Modular arithmetic can be handled mathematically by introducing a congruence relation on the integers described in the above example. Coding Theory Massoud Malek Algebra Congruence Relation The definition of a congruence depends on the type of algebraic structure under consideration Particular definitions of congruence can be made for

More information

MA257: INTRODUCTION TO NUMBER THEORY LECTURE NOTES

MA257: INTRODUCTION TO NUMBER THEORY LECTURE NOTES MA257: INTRODUCTION TO NUMBER THEORY LECTURE NOTES 2018 57 5. p-adic Numbers 5.1. Motivating examples. We all know that 2 is irrational, so that 2 is not a square in the rational field Q, but that we can

More information

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6 CS 70 Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6 1 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes

More information

Math 511, Algebraic Systems, Fall 2017 July 20, 2017 Edition. Todd Cochrane

Math 511, Algebraic Systems, Fall 2017 July 20, 2017 Edition. Todd Cochrane Math 511, Algebraic Systems, Fall 2017 July 20, 2017 Edition Todd Cochrane Department of Mathematics Kansas State University Contents Notation v Chapter 0. Axioms for the set of Integers Z. 1 Chapter 1.

More information

Intro to Rings, Fields, Polynomials: Hardware Modeling by Modulo Arithmetic

Intro to Rings, Fields, Polynomials: Hardware Modeling by Modulo Arithmetic Intro to Rings, Fields, Polynomials: Hardware Modeling by Modulo Arithmetic Priyank Kalla Associate Professor Electrical and Computer Engineering, University of Utah kalla@ece.utah.edu http://www.ece.utah.edu/~kalla

More information

Partial Fractions. June 27, In this section, we will learn to integrate another class of functions: the rational functions.

Partial Fractions. June 27, In this section, we will learn to integrate another class of functions: the rational functions. Partial Fractions June 7, 04 In this section, we will learn to integrate another class of functions: the rational functions. Definition. A rational function is a fraction of two polynomials. For example,

More information

Solutions to Homework for M351 Algebra I

Solutions to Homework for M351 Algebra I Hwk 42: Solutions to Homework for M351 Algebra I In the ring Z[i], find a greatest common divisor of a = 16 + 2i and b = 14 + 31i, using repeated division with remainder in analogy to Problem 25. (Note

More information

Introduction to finite fields

Introduction to finite fields Chapter 7 Introduction to finite fields This chapter provides an introduction to several kinds of abstract algebraic structures, particularly groups, fields, and polynomials. Our primary interest is in

More information

Basic Concepts in Number Theory and Finite Fields

Basic Concepts in Number Theory and Finite Fields Basic Concepts in Number Theory and Finite Fields Raj Jain Washington University in Saint Louis Saint Louis, MO 63130 Jain@cse.wustl.edu Audio/Video recordings of this lecture are available at: 4-1 Overview

More information

CDM. Finite Fields. Klaus Sutner Carnegie Mellon University. Fall 2018

CDM. Finite Fields. Klaus Sutner Carnegie Mellon University. Fall 2018 CDM Finite Fields Klaus Sutner Carnegie Mellon University Fall 2018 1 Ideals The Structure theorem Where Are We? 3 We know that every finite field carries two apparently separate structures: additive and

More information

Rings. Chapter 1. Definition 1.2. A commutative ring R is a ring in which multiplication is commutative. That is, ab = ba for all a, b R.

Rings. Chapter 1. Definition 1.2. A commutative ring R is a ring in which multiplication is commutative. That is, ab = ba for all a, b R. Chapter 1 Rings We have spent the term studying groups. A group is a set with a binary operation that satisfies certain properties. But many algebraic structures such as R, Z, and Z n come with two binary

More information

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9.1 Chapter 9 Objectives

More information

(Rgs) Rings Math 683L (Summer 2003)

(Rgs) Rings Math 683L (Summer 2003) (Rgs) Rings Math 683L (Summer 2003) We will first summarise the general results that we will need from the theory of rings. A unital ring, R, is a set equipped with two binary operations + and such that

More information

Part IA Numbers and Sets

Part IA Numbers and Sets Part IA Numbers and Sets Definitions Based on lectures by A. G. Thomason Notes taken by Dexter Chua Michaelmas 2014 These notes are not endorsed by the lecturers, and I have modified them (often significantly)

More information

+ 1 3 x2 2x x3 + 3x 2 + 0x x x2 2x + 3 4

+ 1 3 x2 2x x3 + 3x 2 + 0x x x2 2x + 3 4 Math 4030-001/Foundations of Algebra/Fall 2017 Polynomials at the Foundations: Rational Coefficients The rational numbers are our first field, meaning that all the laws of arithmetic hold, every number

More information

Lecture 6: Finite Fields (PART 3) PART 3: Polynomial Arithmetic. Theoretical Underpinnings of Modern Cryptography

Lecture 6: Finite Fields (PART 3) PART 3: Polynomial Arithmetic. Theoretical Underpinnings of Modern Cryptography Lecture 6: Finite Fields (PART 3) PART 3: Polynomial Arithmetic Theoretical Underpinnings of Modern Cryptography Lecture Notes on Computer and Network Security by Avi Kak (kak@purdue.edu) January 26, 2017

More information

Moreover this binary operation satisfies the following properties

Moreover this binary operation satisfies the following properties Contents 1 Algebraic structures 1 1.1 Group........................................... 1 1.1.1 Definitions and examples............................. 1 1.1.2 Subgroup.....................................

More information

A Generalization of Wilson s Theorem

A Generalization of Wilson s Theorem A Generalization of Wilson s Theorem R. Andrew Ohana June 3, 2009 Contents 1 Introduction 2 2 Background Algebra 2 2.1 Groups................................. 2 2.2 Rings.................................

More information

MATH 115, SUMMER 2012 LECTURE 12

MATH 115, SUMMER 2012 LECTURE 12 MATH 115, SUMMER 2012 LECTURE 12 JAMES MCIVOR - last time - we used hensel s lemma to go from roots of polynomial equations mod p to roots mod p 2, mod p 3, etc. - from there we can use CRT to construct

More information

Fast Polynomial Multiplication

Fast Polynomial Multiplication Fast Polynomial Multiplication Marc Moreno Maza CS 9652, October 4, 2017 Plan Primitive roots of unity The discrete Fourier transform Convolution of polynomials The fast Fourier transform Fast convolution

More information

Many of the groups with which we are familiar are arithmetical in nature, and they tend to share key structures that combine more than one operation.

Many of the groups with which we are familiar are arithmetical in nature, and they tend to share key structures that combine more than one operation. 12. Rings 1 Rings Many of the groups with which we are familiar are arithmetical in nature, and they tend to share key structures that combine more than one operation. Example: Z, Q, R, and C are an Abelian

More information

Integration of Rational Functions by Partial Fractions

Integration of Rational Functions by Partial Fractions Title Integration of Rational Functions by MATH 1700 MATH 1700 1 / 11 Readings Readings Readings: Section 7.4 MATH 1700 2 / 11 Rational functions A rational function is one of the form where P and Q are

More information

Lecture 6: Introducing Complexity

Lecture 6: Introducing Complexity COMP26120: Algorithms and Imperative Programming Lecture 6: Introducing Complexity Ian Pratt-Hartmann Room KB2.38: email: ipratt@cs.man.ac.uk 2015 16 You need this book: Make sure you use the up-to-date

More information

CHAPTER 10: POLYNOMIALS (DRAFT)

CHAPTER 10: POLYNOMIALS (DRAFT) CHAPTER 10: POLYNOMIALS (DRAFT) LECTURE NOTES FOR MATH 378 (CSUSM, SPRING 2009). WAYNE AITKEN The material in this chapter is fairly informal. Unlike earlier chapters, no attempt is made to rigorously

More information

Basic elements of number theory

Basic elements of number theory Cryptography Basic elements of number theory Marius Zimand By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a k for some integer k. Notation

More information

Basic elements of number theory

Basic elements of number theory Cryptography Basic elements of number theory Marius Zimand 1 Divisibility, prime numbers By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a

More information

1. Algebra 1.5. Polynomial Rings

1. Algebra 1.5. Polynomial Rings 1. ALGEBRA 19 1. Algebra 1.5. Polynomial Rings Lemma 1.5.1 Let R and S be rings with identity element. If R > 1 and S > 1, then R S contains zero divisors. Proof. The two elements (1, 0) and (0, 1) are

More information

Galois Fields and Hardware Design

Galois Fields and Hardware Design Galois Fields and Hardware Design Construction of Galois Fields, Basic Properties, Uniqueness, Containment, Closure, Polynomial Functions over Galois Fields Priyank Kalla Associate Professor Electrical

More information

Modern Algebra Prof. Manindra Agrawal Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

Modern Algebra Prof. Manindra Agrawal Department of Computer Science and Engineering Indian Institute of Technology, Kanpur Modern Algebra Prof. Manindra Agrawal Department of Computer Science and Engineering Indian Institute of Technology, Kanpur Lecture 02 Groups: Subgroups and homomorphism (Refer Slide Time: 00:13) We looked

More information

Number Theory. Modular Arithmetic

Number Theory. Modular Arithmetic Number Theory The branch of mathematics that is important in IT security especially in cryptography. Deals only in integer numbers and the process can be done in a very fast manner. Modular Arithmetic

More information

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers ALGEBRA CHRISTIAN REMLING 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers by Z = {..., 2, 1, 0, 1,...}. Given a, b Z, we write a b if b = ac for some

More information

Integration of Rational Functions by Partial Fractions

Integration of Rational Functions by Partial Fractions Title Integration of Rational Functions by Partial Fractions MATH 1700 December 6, 2016 MATH 1700 Partial Fractions December 6, 2016 1 / 11 Readings Readings Readings: Section 7.4 MATH 1700 Partial Fractions

More information

We say that a polynomial is in the standard form if it is written in the order of decreasing exponents of x. Operations on polynomials:

We say that a polynomial is in the standard form if it is written in the order of decreasing exponents of x. Operations on polynomials: R.4 Polynomials in one variable A monomial: an algebraic expression of the form ax n, where a is a real number, x is a variable and n is a nonnegative integer. : x,, 7 A binomial is the sum (or difference)

More information

Quasi-reducible Polynomials

Quasi-reducible Polynomials Quasi-reducible Polynomials Jacques Willekens 06-Dec-2008 Abstract In this article, we investigate polynomials that are irreducible over Q, but are reducible modulo any prime number. 1 Introduction Let

More information

Integers and Division

Integers and Division Integers and Division Notations Z: set of integers N : set of natural numbers R: set of real numbers Z + : set of positive integers Some elements of number theory are needed in: Data structures, Random

More information

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth Sets We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth century. Most students have seen sets before. This is intended

More information

Chapter Five Notes N P U2C5

Chapter Five Notes N P U2C5 Chapter Five Notes N P UC5 Name Period Section 5.: Linear and Quadratic Functions with Modeling In every math class you have had since algebra you have worked with equations. Most of those equations have

More information

4 Number Theory and Cryptography

4 Number Theory and Cryptography 4 Number Theory and Cryptography 4.1 Divisibility and Modular Arithmetic This section introduces the basics of number theory number theory is the part of mathematics involving integers and their properties.

More information

Number Theory, Algebra and Analysis. William Yslas Vélez Department of Mathematics University of Arizona

Number Theory, Algebra and Analysis. William Yslas Vélez Department of Mathematics University of Arizona Number Theory, Algebra and Analysis William Yslas Vélez Department of Mathematics University of Arizona O F denotes the ring of integers in the field F, it mimics Z in Q How do primes factor as you consider

More information

Math 3 Variable Manipulation Part 3 Polynomials A

Math 3 Variable Manipulation Part 3 Polynomials A Math 3 Variable Manipulation Part 3 Polynomials A 1 MATH 1 & 2 REVIEW: VOCABULARY Constant: A term that does not have a variable is called a constant. Example: the number 5 is a constant because it does

More information

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5 CS 70 Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes wish to work over a

More information

POLYNOMIALS. x + 1 x x 4 + x 3. x x 3 x 2. x x 2 + x. x + 1 x 1

POLYNOMIALS. x + 1 x x 4 + x 3. x x 3 x 2. x x 2 + x. x + 1 x 1 POLYNOMIALS A polynomial in x is an expression of the form p(x) = a 0 + a 1 x + a x +. + a n x n Where a 0, a 1, a. a n are real numbers and n is a non-negative integer and a n 0. A polynomial having only

More information

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively 6 Prime Numbers Part VI of PJE 6.1 Fundamental Results Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively D (p) = { p 1 1 p}. Otherwise

More information

ECEN 5682 Theory and Practice of Error Control Codes

ECEN 5682 Theory and Practice of Error Control Codes ECEN 5682 Theory and Practice of Error Control Codes Introduction to Algebra University of Colorado Spring 2007 Motivation and For convolutional codes it was convenient to express the datawords and the

More information

1/30: Polynomials over Z/n.

1/30: Polynomials over Z/n. 1/30: Polynomials over Z/n. Last time to establish the existence of primitive roots we rely on the following key lemma: Lemma 6.1. Let s > 0 be an integer with s p 1, then we have #{α Z/pZ α s = 1} = s.

More information

Chapter 8. Exploring Polynomial Functions. Jennifer Huss

Chapter 8. Exploring Polynomial Functions. Jennifer Huss Chapter 8 Exploring Polynomial Functions Jennifer Huss 8-1 Polynomial Functions The degree of a polynomial is determined by the greatest exponent when there is only one variable (x) in the polynomial Polynomial

More information

8 Appendix: Polynomial Rings

8 Appendix: Polynomial Rings 8 Appendix: Polynomial Rings Throughout we suppose, unless otherwise specified, that R is a commutative ring. 8.1 (Largely) a reminder about polynomials A polynomial in the indeterminate X with coefficients

More information

Coding Theory ( Mathematical Background I)

Coding Theory ( Mathematical Background I) N.L.Manev, Lectures on Coding Theory (Maths I) p. 1/18 Coding Theory ( Mathematical Background I) Lector: Nikolai L. Manev Institute of Mathematics and Informatics, Sofia, Bulgaria N.L.Manev, Lectures

More information

Polynomials. In many problems, it is useful to write polynomials as products. For example, when solving equations: Example:

Polynomials. In many problems, it is useful to write polynomials as products. For example, when solving equations: Example: Polynomials Monomials: 10, 5x, 3x 2, x 3, 4x 2 y 6, or 5xyz 2. A monomial is a product of quantities some of which are unknown. Polynomials: 10 + 5x 3x 2 + x 3, or 4x 2 y 6 + 5xyz 2. A polynomial is a

More information

Algebraic Systems, Fall 2012, Skeleton notes as of 11/16/12

Algebraic Systems, Fall 2012, Skeleton notes as of 11/16/12 Algebraic Systems, Fall 2012, Skeleton notes as of 11/16/12 1. Algebraic Properties of the Integers Definition 1.1. A statement is a sentence that can be assigned a truth value. (In general there is a

More information

Linear Feedback Shift Registers (LFSRs) 4-bit LFSR

Linear Feedback Shift Registers (LFSRs) 4-bit LFSR Linear Feedback Shift Registers (LFSRs) These are n-bit counters exhibiting pseudo-random behavior. Built from simple shift-registers with a small number of xor gates. Used for: random number generation

More information

Discrete Math, Second Problem Set (June 24)

Discrete Math, Second Problem Set (June 24) Discrete Math, Second Problem Set (June 24) REU 2003 Instructor: Laszlo Babai Scribe: D Jeremy Copeland 1 Number Theory Remark 11 For an arithmetic progression, a 0, a 1 = a 0 +d, a 2 = a 0 +2d, to have

More information

Section VI.33. Finite Fields

Section VI.33. Finite Fields VI.33 Finite Fields 1 Section VI.33. Finite Fields Note. In this section, finite fields are completely classified. For every prime p and n N, there is exactly one (up to isomorphism) field of order p n,

More information

Reference Material /Formulas for Pre-Calculus CP/ H Summer Packet

Reference Material /Formulas for Pre-Calculus CP/ H Summer Packet Reference Material /Formulas for Pre-Calculus CP/ H Summer Packet Week # 1 Order of Operations Step 1 Evaluate expressions inside grouping symbols. Order of Step 2 Evaluate all powers. Operations Step

More information

CSE 20: Discrete Mathematics

CSE 20: Discrete Mathematics Spring 2018 Summary So far: Today: Logic and proofs Divisibility, modular arithmetics Number Systems More logic definitions and proofs Reading: All of Chap. 1 + Chap 4.1, 4.2. Divisibility P = 5 divides

More information

MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1

MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1 MATH 4400 SOLUTIONS TO SOME EXERCISES 1.1.3. If a b and b c show that a c. 1. Chapter 1 Solution: a b means that b = na and b c that c = mb. Substituting b = na gives c = (mn)a, that is, a c. 1.2.1. Find

More information

Algebraic structures I

Algebraic structures I MTH5100 Assignment 1-10 Algebraic structures I For handing in on various dates January March 2011 1 FUNCTIONS. Say which of the following rules successfully define functions, giving reasons. For each one

More information

MODULAR ARITHMETIC KEITH CONRAD

MODULAR ARITHMETIC KEITH CONRAD MODULAR ARITHMETIC KEITH CONRAD. Introduction We will define the notion of congruent integers (with respect to a modulus) and develop some basic ideas of modular arithmetic. Applications of modular arithmetic

More information