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

Slides:



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

Cryptography and Network Security
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.
Section 4.1: Primes, Factorization, and the Euclidean Algorithm Practice HW (not to hand in) From Barr Text p. 160 # 6, 7, 8, 11, 12, 13.
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 numbers.
Primality Testing Patrick Lee 12 July 2003 (updated on 13 July 2003)
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
Notation Intro. Number Theory Online Cryptography Course Dan Boneh
1 The RSA Algorithm Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
CNS2010handout 8 :: introduction to number theory1 computer and network security matt barrie.
CSC2110 Discrete Mathematics Tutorial 5 GCD and Modular Arithmetic
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.
Cryptography & Number Theory
Chapter 8 – Introduction to Number Theory Prime Numbers

Great Theoretical Ideas in Computer Science.
Mathematics of Cryptography Part I: Modular Arithmetic
Network and Communications Network Security Department of Computer Science Virginia Commonwealth University.
MATH 224 – Discrete Mathematics
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.
Prelude to Public-Key Cryptography Rocky K. C. Chang, February
Basic Concepts in Number Theory Background for Random Number Generation 1.For any pair of integers n and m, m  0, there exists a unique pair of integers.
Introduction to Algorithms Second Edition by Cormen, Leiserson, Rivest & Stein Chapter 31.
Basic Number Theory Divisibility Let a,b be integers with a≠0. if there exists an integer k such that b=ka, we say a divides b which is denoted by a|b.
RSA Prepared by: SITI ZAINAH ADNAN
The RSA Algorithm. Content Review of Encryption RSA An RSA example.
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.
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.
22C:19 Discrete Structures Integers and Modular Arithmetic Fall 2014 Sukumar Ghosh.
CS/ECE Advanced Network Security Dr. Attila Altay Yavuz
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.
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)
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
Week 4 - Wednesday.  What did we talk about last time?  Finished DES  AES.
Pertemuan #5 Pengantar ke Number Theory Kuliah Pengaman Jaringan.
Dan Boneh Intro. Number Theory Fermat and Euler Online Cryptography Course Dan Boneh.
Introduction to Number Theory Department of Computer Engineering Sharif University of Technology 3/8/2006.
Cryptography and Network Security Chapter 4 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
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.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Number-Theoretic Algorithms
Mathematical Background : A quick approach to Group and Field Theory
Discrete Math II Howon Kim
Introduction to Number Theory
Numerical Algorithms x x-1 Numerical Algorithms
Great Theoretical Ideas in Computer Science
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
Discrete Math for CS CMPSC 360 LECTURE 12 Last time: Stable matching
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Mathematical Background : A quick approach to Group and Field Theory
Presentation transcript:

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

Computer Science CSC 474Dr. Peng Ning2 Basic Number Theory We are talking about integers! Divisor –We say that b  0 divides a if a = mb for some m, denoted b|a. b is a divisor of a. –If a|1, then a = 1 or –1. –If a|b and b|a, then a = b or –b. –Any b  0 divides 0. –If b|g and b|h, then b|(mg+nh) for arbitrary integers m and n.

Computer Science CSC 474Dr. Peng Ning3 Basic Number Theory (Cont’d) Prime numbers –An integer p > 1 is a prime number if its only divisors are 1, –1, p, and –p. –Examples: 2, 3, 5, 7, 11, 13, 17, 19, 31,… Any integer a > 1 can be factored in a unique way as –where each p 1 >p 2 >…>p t are prime numbers and where each a i >0. –Examples: 91=13  7, 11011=13  11 2  7.

Computer Science CSC 474Dr. Peng Ning4 Basic Number Theory (Cont’d) Another view of a|b: –Let P be the set of all prime numbers –Represent a as –Represent b as –a|b means that a i  b i.

Computer Science CSC 474Dr. Peng Ning5 Basic Number Theory (Cont’d) Greatest common divisor: gcd(a,b) –gcd(a,b) =max{k | k|a and k|b} –Examples gcd(6,15)=3. gcd(60,24)=gcd(60,-24)=12. gcd(a,0) = a. –gcd(a,b) can be easily derived if we can factor a and b. Relatively Prime Numbers –Integers a and b are relatively prime if gcd(a,b) = 1. –Example: 8 and 15 are relatively prime.

Computer Science CSC 474Dr. Peng Ning6 Modulo Operator Given any positive integer n and any integer a, we have a = qn+r, where 0  r<n and q=  a/n . –We write r = a mod n. –The remainder r is often referred to as a residue. –Example: 2 = 12 mod 5. Two integer a and b are said to be congruent modulo n if a mod n = b mod n. –We write a  b mod n –Example: 7  12 mod 5.

Computer Science CSC 474Dr. Peng Ning7 Modulo Operator (Cont’d) 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 imply a  c mod n.

Computer Science CSC 474Dr. Peng Ning8 Modular Arithmetic Observation: –The (mod n) operator maps all integers into the set of integers{0, 1, 2, …, (n-1)}. Modular addition. –[(a mod n) + (b mod n)] mod n = (a+b) mod n Modular subtraction. –[(a mod n) – (b mod n)] mod n = (a – b) mod n Modular multiplication. –[(a mod n)  (b mod n)] mod n = (a  b) mod n

Computer Science CSC 474Dr. Peng Ning9 An Exercise (n=5) AdditionMultiplication Exponentiation mod 5 = ____

Computer Science CSC 474Dr. Peng Ning10 Properties of Modular Arithmetic Z n ={0, 1, …, (n-1)} Commutative laws –(w + x) mod n = (x + w) mod n –(w  x) mod n = (x  w) mod n Associative laws –[(w + x) + y] mod n = [w + (x + y)] mod n –[(w  x)  y] mod n = [w  (x  y)] mod n Distributive law –[w  (x + y)] mod n = [(w  x)+(w  y)] mod n Identities –(0 + w) mod n = w mod n –(1  w) mod n = w mod n Additive inverse (–w) –For each w  Z n, there exists a z such that w + z=0 mod n.

Computer Science CSC 474Dr. Peng Ning11 About Multiplicative Inverse Not always exist –Example: There doesn’t exist a z such that 6  z = 1 mod 8. An integer a  Z n has a multiplicative inverse if gcd(a, n) = 1. In particular, if n is a prime number, then all elements in Z n have multiplicative inverse. Z8Z 6 Residues

Computer Science CSC 474Dr. Peng Ning12 Fermat’s Theorem If p is prime and a is a positive integer not divisible by p, then a p-1  1 mod p. –Observation: {a mod p, 2a mod p, …, (p-1)a mod p} = {1, 2, …, (p-1)}. –a  2a ..  (p-1)a  [(a mod p)  (2a mod p)  …  ((p-1)a mod p)] mod p –(p-1)!  a p-1  (p-1)! mod p –Thus, a p-1  1 mod p.

Computer Science CSC 474Dr. Peng Ning13 Totient Function Totient function ø(n): number of integers less than n and relatively prime to n –If n is prime, ø(n)=n-1 –If n=p  q, and p, q are primes, ø(n)=(p-1)(q-1) Examples: –ø(7)=____ –ø(21)=____

Computer Science CSC 474Dr. Peng Ning14 Euler’s Theorem For every a and n that are relatively prime, a ø(n)  1 mod n. –Proof leaves as an exercise. Examples –a=3, n=10, ø(10)= ____, 3 ø(10) mod 10 = ____ –a=2, n=11, ø(11)=____, 2 ø(11) mod 11=____.

Computer Science CSC 474Dr. Peng Ning15 Modular Exponentiation x y mod n = x y mod ø(n) mod n if y = 1 mod ø(n) then x y mod n = x mod n Example: –2 100 mod 33 = ____

Computer Science CSC 474Dr. Peng Ning16 Euclid’s Algorithm Observation –gcd(a, b) = gcd(b, a mod b) Eulid (d, f), 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

Computer Science CSC 474Dr. Peng Ning17 Extended Euclid Algorithm 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 Observation –fX1 + dX2 = X3; fY1 + dY2 = Y3 –If Y3 = 1, then fY1 + dY2 = 1 –Y2 = d  1 mod f

Computer Science CSC 474Dr. Peng Ning18 The Power of An Integer Modulo n Consider the following expression –a m  1 mod n If a and n are relatively prime, then there is at least one integer m that satisfies the above equation. –That is, the Euler’s totient function  (n). The least positive exponent m for which the above equation holds is referred to as: –The order of a (mod n) –The exponent to which a belongs (mod n) –The length of the period generated by a.

Computer Science CSC 474Dr. Peng Ning19 Understanding The Order of a (mod n) Powers of Integers Modulo 19 aa2a2 a3a3 a4a4 a5a5 a6a6 a7a7 a8a8 a9a9 a 10 a 11 a 12 a 13 a 14 a 15 a 16 a 17 a

Computer Science CSC 474Dr. Peng Ning20 Observations in The Previous Table All sequences end in 1. The length of a sequence divides  (19) = 18. –Lengths: 1, 2, 3, 6, 9, 18. Some of the sequences are of length 18. –The base integer a generates (via powers) all nonzero integers modulo 19.

Computer Science CSC 474Dr. Peng Ning21 Primitive Root The highest possible order of a (mod n) is  (n). Primitive root –If the order of a (mod n) is  (n), then a is referred to as a primitive root of n. –The powers of a: a, a 2, …, a n-1 are distinct (mod n) and are all relatively prime to n. For a prime number p, if a is a primitive root of p, then a, a 2, …, a p-1 are all the distinct numbers mod p.

Computer Science CSC 474Dr. Peng Ning22 Discrete Logarithm Given a primitive root a for a prime number p: –The expression b  a i mod p, 0≤i ≤(p-1), produces the integers from 1 to (p-1). –The exponent i is referred to as the index of b for the base a (mod p), denoted as ind a,p (b). –ind a,p (1)=0, because a 0 mod p = 1. –ind a,p (a)=1, because a 1 mod p = a. Example: –Integer 2 is a primitive root of prime number 19 Number Index Number Index

Computer Science CSC 474Dr. Peng Ning23 Discrete Logarithm (Cont’d) Consider x=a ind a,p (x) mod p, y=a ind a,p (y) mod p, and xy=a ind a,p (xy) mod p, –a ind a,p (xy) mod p = (a ind a,p (x) mod p)(a ind a,p (y) mod p) –a ind a,p (xy) mod p = (a ind a,p (x)+ind a,p (y) ) mod p –By Euler’s theorem: a z  a q mod p iff z  q mod  (p). –ind a,p (xy) = ind a,p (x)+ind a,p (y) mod  (p). –ind a,p (y r ) = [r  ind a,p (y)] mod  (p). Discrete logarithm mod p: index mod p. Computing a discrete logarithm mod a large prime number p is in general difficult –Used as the basis of some public key cryptosystems.