1 Lect. 12: Number Theory. Contents Prime and Relative Prime Numbers Modular Arithmetic Fermat’s and Euler’s Theorem Extended Euclid’s Algorithm.

Slides:



Advertisements
Similar presentations
Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.3 Basic Number Theory.
Advertisements

Cryptography and Network Security
Chapter 4 Finite Fields. Introduction of increasing importance in cryptography –AES, Elliptic Curve, IDEA, Public Key concern operations on “numbers”
Cryptography and Network Security Chapter 4 Fourth Edition by William Stallings.
Chapter 4 – Finite Fields. Introduction will now introduce finite fields of increasing importance in cryptography –AES, Elliptic Curve, IDEA, Public Key.
Chapter 8 – Introduction to Number Theory. Prime Numbers prime numbers only have divisors of 1 and self –they cannot be written as a product of other.
1 Section 2.4 The Integers and Division. 2 Number Theory Branch of mathematics that includes (among other things): –divisibility –greatest common divisor.
Number Theory and Cryptography
1 Chapter 7– Introduction to Number Theory Instructor: 孫宏民 Room: EECS 6402, Tel: , Fax :
Cryptography and Network Security Chapter 4
Cryptography and Network Security Chapter 4 Fourth Edition by William Stallings.
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
Complexity1 Pratt’s Theorem Proved. Complexity2 Introduction So far, we’ve reduced proving PRIMES  NP to proving a number theory claim. This is our next.
Chapter 4 – Finite Fields Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic Curve, IDEA, Public.
Lecture 3.2: Public Key Cryptography II CS 436/636/736 Spring 2012 Nitesh Saxena.
BY MISS FARAH ADIBAH ADNAN IMK
Great Theoretical Ideas in Computer Science.
1 Properties of Integers Objectives At the end of this unit, students should be able to: State the division algorithm Apply the division algorithm Find.
Rings,Fields TS. Nguyễn Viết Đông Rings, Integral Domains and Fields, 2. Polynomial and Euclidean Rings 3. Quotient Rings 2.
Mathematics of Cryptography Part I: Modular Arithmetic
Module :MA3036NI Cryptography and Number Theory Lecture Week 7
CPSC 3730 Cryptography and Network Security
1 Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown Chapter 4 – Finite Fields.
Information Security and Management 4. Finite Fields 8
Cryptography and Network Security Introduction to Finite Fields.
CompSci 102 Discrete Math for Computer Science February 16, 2012 Prof. Rodger.
Chapter 4 – Finite Fields
Data Security and Encryption (CSE348) 1. Lecture # 12 2.
YSLInformation Security -- Public-Key Cryptography1 Prime and Relatively Prime Numbers Divisors: We say that b  0 divides a if a = mb for some m, where.
Rational Numbers and Fields
Chinese Remainder Theorem Dec 29 Picture from ………………………
Fall 2002CS 395: Computer Security1 Chapters 4 and 8: The Mathematics Required for Public Key Cryptography In case you’re beginning to worry that this.
Scott CH Huang COM5336 Cryptography Lecture 11 Euclidean Domains & Division Algorithm Scott CH Huang COM 5336 Cryptography Lecture 10.
Information Security Lab. Dept. of Computer Engineering 87/121 PART I Symmetric Ciphers CHAPTER 4 Finite Fields 4.1 Groups, Rings, and Fields 4.2 Modular.
Chapter 4 With Question/Answer Animations. Section 4.1.
MA/CSSE 473 Day 08 Extended Euclid's Algorithm Modular Division Fermat's little theorem.
Cryptography and Network Security Chapter 4. Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic.
Tuesday’s lecture: Today’s lecture: One-way permutations (OWPs)
Great Theoretical Ideas in Computer Science for Some.
Modular Arithmetic and the RSA Cryptosystem Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 9Sept 27, 2005Carnegie.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
Introduction to Number Theory
Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2015 Nitesh Saxena.
Cryptography and Network Security Chapter 4 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Chapter 13 Mathematic Structures 13.1 Modular Arithmetic Definition 1 (modulo). Let a be an integer and m be a positive integer. We denoted by a mod m.
Great Theoretical Ideas In Computer Science COMPSCI 102 Fall 2010 Lecture 16October 27, 2010Duke University Modular Arithmetic and the RSA Cryptosystem.
Cryptography Lecture 14 Arpita Patra © Arpita Patra.
Divisibility and Modular Arithmetic
Multiplicative Group The multiplicative group of Z n includes every a, 0
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Chapter 4 With Question/Answer Animations 1. Chapter Motivation Number theory is the part of mathematics devoted to the study of the integers and their.
Great Theoretical Ideas in Computer Science.
Modular Arithmetic and the RSA Cryptosystem Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2005 Lecture 8Feb 3, 2005Carnegie.
Chapter4: Finite Fields
Discrete Math II Howon Kim
Modular Arithmetic and the RSA Cryptosystem
Advanced Algorithms Analysis and Design
Advanced Algorithms Analysis and Design
Lecture 3.2: Public Key Cryptography II
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Number Theory and Modular Arithmetic
Numerical Algorithms x x-1
Prime and Relatively Prime Numbers
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Modular Arithmetic and the RSA Cryptosystem
Lecture 3.1: Public Key Cryptography I
Divisibility and Modular Arithmetic
Lecture 3 Strings and Things (Section 1.1)
Presentation transcript:

1 Lect. 12: Number Theory

Contents Prime and Relative Prime Numbers Modular Arithmetic Fermat’s and Euler’s Theorem Extended Euclid’s Algorithm

Divisors b|a (“b divides a”, “b is a divisor of a”) if a = kb f or some k, where a, b, and k are integers, and b  0 –If a|1, then a =  1 –If a|b and b|a, then a =  b –Any b  0 divides 0 –If b|g and b|h, then b|(mg + nh) for arbitrary intege rs m and n

Prime Numbers An integer p > 1 is a prime number if its only divisors are  1 and  p Prime Factorization –Any integer a>1 can be factored in a unique way as a = p 1  1 p 2  2 … p t  t where p 1 0 –If P is the set of all prime numbers, then any positive integer can be written un iquely in the following form –Multiplication of two numbers is equivalent to adding two corresponding exp onents: k = mn  k p = m p + n p for all p –a|b  a p  b p for all p

Primes Under 2000, How many ?

Relatively Prime Numbers Greatest common divisor –c = gcd(a, b) if c|a and c|b and  d that divides a and b: d|c –Equivalently, gcd(a, b) = max{c: c|a and c|b} k = gcd(a, b)  k p = min(a p, b p ) for all p a and b are relatively prime if gcd(a, b) = 1

Modular Arithmetic For any integer a and positive integer n, if a is divided by n, the following relationship holds: –a = qn + r 0  r  n; q =  a/n  (q: quotient, r: remainder or residue) If a is an integer and n is a positive integer, a mod n is defined to be the remainder when a is divided by n –a =  a/n   n + (a mod n) Two integers a and b are said to be congruent modulo n if (a mod n) = (b mod n), and this is written a  b mod n Properties of modulo operator –a  b mod n if n|(a – b) –(a mod n) = (b mod n) implies a  b mod n –a  b mod n implies b  a mod n –a  b mod n and b  c mod n implies a  c mod n

Modular Arithmetic Operations Modulo arithmetic operation over Z n = {0, 1, …, n-1} Properties –[(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 = (a  b) mod n

Properties of Modular Arithmetic Modulo arithmetic over Z n = {0, 1, …, n-1} (called a set of residues of modulo n) Integers modulo n with addition and multiplication form a commutative ring –Commutative laws(a + b) mod n = (b + a) mod n (a  b) mod n = (b  a) mod n –Associative laws[(a + b) + c] mod n = [a + (b + c)] mod n [(a  b)  c] mod n = [a  (b  c)] mod n –Distributive laws[a  (b + c)] mod n = [(a  b) + (a  c)] mod n –Identities(a + 0) mod n = a mod n (a  1) mod n = a mod n –Additive inverse (-a)  a  Z n  b s.t. a + b  0 mod n –Multiplicative inverse (a -1 )  a (  0)  Z n, if a is relative prime to n,  b s.t. a  b  1 mod n If n is not prime, Z n is a ring, but not a field Z p is a field

Modular 7 Arithmetic

Groups, Rings, Fields Group –A set of numbers with some addition operation whose result is also in the set (closure) –Obeys associative law, has an identity, has inverses –If also is commutative its an Abelian group Ring –An Abelian group with a multiplication operation also –Multiplication is associative and distributive over addition –If multiplication is commutative, its a commutative ring –e.g., integers mod N for any N Field –An Abelian group for addition –A ring –An Abelian group for multiplication (ignoring 0) –e.g., integers mod P where P is prime

Fermat’s Little Theorem If p is prime and a is a positive integer not divisible by p, then a p-1  1 mod p Proof –Start by listing the first p – 1 positive multiples of a: a, 2a, 3a, …, (p-1)a Suppose that ra and sa are the same modulo p, then we have r  s mod p, so the p-1 multiples of a above are distinct and nonzero; that is, they must be congruent to 1, 2, 3, …, p-1 in some order. Multiply all these congruences together and we find a  2a  3a  …  (p-1)a  1  2  3  …  (p-1) mod p or better, a p-1 (p-1)!  (p-1)! mod p. Divide both side by (p-1)! to complete the proof Corollary –If p is prime and a is any positive integer, then a p  a mod p

Euler’s Totient Function Euler’s totient function  (n) is the number of positive integers less than n (including 1) and relatively prime to n  (p) = p-1  (1) = 1 (Definition) Let p and q be distinct prime numbers, n = pq. Then  (pq) =  (p)  (q) = (p-1)(q-1) Proof –Consider Z n = {0, 1, …, pq-1} –The residues not relatively prime to n are 0, {p, 2p, …, (q-1)p}, and {q, 2q, …, (p-1)q} –So  (pq) = pq - (1 + (q-1) + (p-1)) = pq - p - q + 1 = (p-1)(q-1)

Euler’s Totient Function

Euler’s Theorem Generalization of Fermat’s little theorem For every a and n that are relatively prime, a  (n)  1 mod n Proof –The proof is completely analogous to that of the Fermat's Theorem except that instead of the set of residues {1,2,...,n-1} we now consider the set of residues {x 1,x 2,...,x  (n) } which are relatively prime to n. In exactly the same manner as before, multiplication by a modulo n results in a permutation of the set {x 1, x 2,..., x  (n) }. Therefore, two products are congruent: x 1 x 2... x  (n)  (ax 1 )(ax 2 )... (ax  (n) ) mod n dividing by the left-hand side proves the theorem. Corollary a  (n)+1  a mod n

Euler’s Theorem Corollaries –Given two prime numbers, p and q, and integers n = pq and m, with 0<m<n, m  (n)+1 = m (p-1)(q-1)+1  m mod n ( Demonstrate the validity of the RSA algorithm) m k  (n)  1 mod n m k  (n)+1  m mod n

Euclid’s Algorithm – Finding GCD(1) Based on the following theorem –gcd(a, b) = gcd(b, a mod b) –Proof If d = gcd(a, b), then d|a and d|b For any positive integer b, a = kb + r ≡ r mod b, a mod b = r a mod b = a – kb (for some integer k) –because d|b, d|kb –because d|a, d|(a mod b) ∴ d is a common divisor of b and (a mod b) Conversely, if d is a common divisor of b and (a mod b), then d|kb and d|[ kb+(a mod b)] d|[ kb+(a mod b)] = d|a ∴ Set of common divisors of a and b is equal to the set of common divisors of b and (a mod b) ex) gcd(18,12) = gcd(12,6) = gcd(6,0) = 6 gcd(11,10) = gcd(10,1) = gcd(1,0) = 1

Euclid’s Algorithm – Finding GCD(II) Recursive algorithm Function Euclid (a, b) /* assume a  b  0 */ if b = 0 then return a else return Euclid(b, a mod b) Iterative algorithm Euclid(d, f)/* assume d > f > 0 */ 1. X  d; Y  f 2. if Y=0 return X = gcd(d, f) 3. R = X mod Y 4. X  Y 5. Y  R 6. goto 2

Extended Euclid’s Alg. – Finding Multiplicative Inverse(1) Extended Euclid(d, f) 1.(X1, X2, X3)  (1, 0, f); (Y1, Y2, Y3)  (0, 1, d) 2.If Y3 = 0 return X3 = gcd(d, f); no inverse 3.If Y3 = 1 return Y3 = gcd(d, f); Y2 = d -1 mod f 4.Q =  X3/Y3  5.(T1, T2, T3)  (X1  QY1, X2  QY2, X3  QY3) 6.(X1, X2, X3)  (Y1, Y2, Y3) 7.(Y1, Y2, Y3)  (T1, T2, T3) 8.goto 2 If gcd(d, f) =1, d has a multiplicative inverse modulo f Euclid’s algorithm can be extended to find the multiplicative inverse –In addition to finding gcd(d, f), if the gcd is 1, the algorithm returns multiplicative inverse of d (modulo f) Note: Always f  Y1 + d  Y2 = Y3

Extended Euclid’s Alg. – Finding Multiplicative Inverse(II)