1 / 23

IE MS5710 Introduction to Number Theory II

IE MS5710 Introduction to Number Theory II. 5 Feb 20 13 Prof. CHAN Yuen-Yan, Rosanna Department of Information Engineering The Chinese University of Hong Kong. Basic Number Theory Divisor. say a non-zero number b divides a if for some m have a=mb ( a,b,m all integers)

liliha
Download Presentation

IE MS5710 Introduction to Number Theory II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. IEMS5710Introduction to Number Theory II 5 Feb 2013 Prof. CHAN Yuen-Yan, Rosanna Department of Information Engineering The Chinese University of Hong Kong

  2. Basic Number TheoryDivisor • say a non-zero number bdividesa if for some m have a=mb (a,b,m all integers) • that is b divides into a with no remainder • denote this b|a • and say that b is a divisor of a • eg. all of 1,2,3,4,6,8,12,24 divide 24 • eg. 13 | 182; –5 | 30; 17 | 289; –3 | 33; 17 | 0 IEMS5710 - Lecture 4

  3. Basic Number TheoryDivisor Properties • If a|1, then a = ±1. • If a|b and b|a, then a = ±b. • Any b ≠ 0 divides 0. • If a | b and b | c, then a | c • e.g. 11 | 66 and 66 | 198  11 | 198 • If b|g and b|h, then b|(mg + nh) for arbitrary integers m and n e.g. b = 7; g = 14; h = 63; m = 3; n = 2 hence 7|14 and 7|63 IEMS5710 - Lecture 4

  4. Basic Number TheoryDivisor Algorithm • if divide a by n get integer quotient q and integer remainder r such that: • a = qn + r where 0 <= r < n; q = floor(a/n) • remainder r often referred to as a residue IEMS5710 - Lecture 4

  5. Basic Number Theory Greatest Common Divisor (GCD) • a common problem in number theory • gcd(a,b) of a and b is the largest integer that divides both a and b • eg gcd(60,24) = 12 • define gcd(0, 0) = 0 • often want no common factors (except 1) define such numbers as relatively prime • eg gcd(8,15) = 1 • hence 8 & 15 are relatively prime IEMS5710 - Lecture 4

  6. Basic Number TheoryModular Arithmetic mod (mod n) • The modfunction • x (mod y) • Inputs a number xand the base y • Outputs xmod y,a number between 0 and y–1 inclusive • i.e. the remainder of ab • In JAVA: use % • The (mod) congruence • Relates two numbers a, a’ to each other relative to some base b • a  a’ (mod b) means that a and a’ are equivalent in “mod b” • a and a’ have the same remainder when dividing by b (mod 7) (mod 3) (mod p) IEMS5710 - Lecture 4

  7. Basic Number TheoryModular Arithmetic Formal Definition: Let a, a’ be integers and b be a positive integer. We say that a is congruent to a’ modulo b (denoted by a  a’ (mod b)) iff b | (a – a’). Equivalently: a mod b = a’ mod b • Which of the following are true? • 3  3 (mod 7) • 3  4 (mod 7) • 3  -2 (mod 5) • 13  15 (mod 5) • -13  13 (mod 26) IEMS5710 - Lecture 4

  8. Basic Number TheoryModular Arithmetic • In the “world of mod”, we can think in this way: • The function “mod 7” will only produce the following outputs {0, 1, 2, 3, 4, 5, 6} • We need to “map” everything to these seven numbers when we are talking about “mod 7” (We will talk about the concept of “field” in subsequent slides) • {0, 1, 2, 3, 4, 5, 6} is a prime field, or F7 • A field has a zero-element: 0 • A field has a unity-element: 1 • Each element in the field has an (multiplicative) inverse • Inverse is an other element in the same field, when an element being multiplied by its inverse, the result equal unity. • From now on, we will have a new concepts on + - * / IEMS5710 - Lecture 4

  9. Basic Number TheoryModular Arithmetic • What are the answers of the following? • 2 + 3 mod 7 • 2 – 3 mod 7 • 2 * 3 mod 7 • How about 2/3 mod 7? • Answer: the steps: • 2/3 mod 7 = 2 * (1/3) mod 7 • 1/3 i.e. 3-1 mod 7 means the inverse of 3 in the world of mod 7 • Ask yourself: which number, when multiplied by 3, results in 1 in the world of mod 7? • Ah~~ the answer is 5, because 5*3 = 15 = 1 mod 7 • Therefore 3-1 = 5 mod 7 • Therefore 2/3 mod 7 = 2*5 mod 7 = 3 mod 7 Remark: we have formal method to obtain modulo inverses, but this is out of the scope of this course. IEMS5710 - Lecture 4

  10. Basic Number TheoryModular Arithmetic • Modular Exponentials • Similar to normal exponentials, but remember to “mod” in the end, for example • 31 = 3 mod 7 • 32 = 9 = 2 mod 7 • 33 = 27 = 6 mod 7 • 34 = 81 = 4 mod 7 • 35 = 243 = 5 mod 7 • 36 = 729 = 1 mod 7 • A primitive element in a group is an element whose powers exhaust the non-zero elements in the group • 3 is a primitive element in 7 • How about 4 (mod 7)? • 41 = 4, 42 = 16 = 2, 43 = 64 = 1, 44 = 256 = 4, 45 = 1024 = 2 … IEMS5710 - Lecture 4

  11. Basic Number TheoryGroups • Almost all cryptography algorithms (RSA, Elliptic Curves, Diffie-Hellman … ) are done in modular arithmetic • Modular arithmetic is operated in finite fields • Group  Ring  Fields • A Group is a set of elements or “numbers” with some operations whose result is also in the set (closure) that obeys: • associative law: (a  b) c = a (b c) • has identity e: e a = a e = a • has inverse a-1: a a-1 = e IEMS5710 - Lecture 4

  12. Basic Number TheoryGroups •  is an abstract operator, and could be any actions including addition or multiplication • E.g. the set of elements can be the fruits, and * is the action of mixing two pieces of fruit together • Abelian group • If the group is commutative i.e. a  b = b a then it is called an Abelian group IEMS5710 - Lecture 4

  13. Basic Number TheoryGroups Example 1 For a set {0, 1, 2, 3} Define an operator  as addition in modulo 4 • For a, b, and c in this set, the set obeys: • associative law: (a +b) +c = a +(b + c) (mod 4) • There exists an identity e=0 where 0 + a = a + 0 = a (mod 4) • There exists inverses a-1 = -a a + a-1 = a + (-a)=0=e (mod 4) • Therefore the set and the operator forms a group • It is commutative: a + b = b + a (mod 4) • Therefore, the above forms an Abelian group IEMS5710 - Lecture 4

  14. Basic Number TheoryGroups Example 2 For a set {0, 1, 2, 3} Define an operator  as multiplication in modulo 4 • a set: {0,1,2,3} with operator(mod 4) • obeys: • associative law: (a b)  c = a (b c) (mod 4) • identity e=1: 1  a = a 1 = a • How about inverses a-1? • First of all, 0 has no inverse • 1 has an inverse (itself) • 3 has an inverse (itself) 3 3=9=1 (mod 4) • 2 has no inverse • Cannot be a group IEMS5710 - Lecture 4

  15. Basic Number TheoryCyclic Groups • define exponentiation as repeated application of operator • example: a3 = aaa • and let identity be: e=a0 • a group is cyclic if every element is a power of some fixed element • i.e.b =ak for some a and every b in group • a is said to be a generator of the group IEMS5710 - Lecture 4

  16. Basic Number TheoryRings • A Ring is a group under addition. Furthermore, a ring satisfies the following properties under multiplication: • Closure: a*b is in the set if both a and b are in the set • Associative: (a*b)*c =a*(b*c) • Distributive over addition: a*(b+c) = a*b + a*c • If multiplication operation is commutative, it forms a commutative ring • The additive identity is denoted by 0 (called the zero-element) • If multiplication operation has an identity and nozero divisors (i.e. if xy = 0 implies x = 0 or y = 0), it forms an integral domain • The multiplicative identity is denote by 1 (called the unity-element) IEMS5710 - Lecture 4

  17. Basic Number TheoryFields A Field F is a nonempty set F together with two binary operations (denoted as addition (+) and multiplication (*) below) such that: • (F,+) is an Abelian group • (F\{0}, *) is an Abelian group • Note: 0 doesn’t have multiplicative inverse • a * (b + c) = a * b + a * c and (a + b) * c = a * c + b * c for all a, b, c in F (left and right distributive laws) • A finite field is a field with a finite field order (i.e., number of elements). The order of a finite field is always a prime or a power of a prime. IEMS5710 - Lecture 4

  18. Basic Number TheoryGroup, Rings, Fields IEMS5710 - Lecture 4

  19. Basic Number TheoryModular Arithmetic Properties IEMS5710 - Lecture 4

  20. Basic Number TheoryFinite (Galois) Fields • finite fields play a key role in cryptography • number of elements in a finite field must be a power of a prime pn • known as Galois fields • denoted GF(pn) • in particular often use the fields: • GF(p) • GF(2n) IEMS5710 - Lecture 4

  21. Basic Number TheoryFinite (Galois) Fields • GF(p) is the set of integers {0,1, … , p-1} with arithmetic operations modulo prime p • For GF(2n), for example: • The elements are expressed in polynomials with coefficients modulo 2 • since coefficients are 0 or 1, can represent any such polynomial as a bit string • E.g. in GF(23) have (x2+1) is 1012 & (x2+x+1) is 1112 • addition becomes XOR of these bit strings • multiplication is shift & XOR • Similar to those in long-hand multiplication IEMS5710 - Lecture 4

  22. E.g. (x2+1) and (x2+x+1) in GF(23) • so addition is • (x2+1) + (x2+x+1) = x • 101 XOR 111 = 0102 • and multiplication is • (x+1)(x2+1) = x (x2+1) + 1.(x2+1) = x3+x+x2+1 = x3+x2+x+1 • 011101 = (101)<<1 XOR (101)<<0 = 1010 XOR 101 = 11112 <<x means shift leftward by x places IEMS5710 - Lecture 4

  23. References • William Stallings, Cryptography and Network Security Principles and Practices, 5/e, Pearson • Chapter 4 IEMS5710 - Lecture 4

More Related