Mathematical Background for Cryptography

Slides:



Advertisements
Similar presentations
Number Theory Algorithms and Cryptography Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms.
Advertisements

Cryptography and Network Security
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.
Chapter 8 Introduction To Number Theory. Prime Numbers Prime numbers only have divisors of 1 and Prime numbers only have divisors of 1 and self. self.
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)
and Factoring Integers (I)
1 Chapter 7– Introduction to Number Theory Instructor: 孫宏民 Room: EECS 6402, Tel: , Fax :
The RSA Cryptosystem and Factoring Integers (II) Rong-Jaye Chen.
and Factoring Integers
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.
Chapter 8 – Introduction to Number Theory Prime Numbers
Cryptography and Network Security Chapter 8. Chapter 8 – Introduction to Number Theory The Devil said to Daniel Webster: "Set me a task I can't carry.
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.
Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Copyright © The McGraw-Hill Companies, Inc. Permission required.
Cryptography A little number theory Public/private key cryptography –Based on slides of William Stallings and Lawrie Brown.
Integers Number Theory = Properties of Integers

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
CPSC 490 Number Theory Primes, Factoring and Euler Phi-function Mar.31 st, 2006 Sam Chan.
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.
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.
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.
9/22/15UB Fall 2015 CSE565: S. Upadhyaya Lec 7.1 CSE565: Computer Security Lecture 7 Number Theory Concepts Shambhu Upadhyaya Computer Science & Eng. University.
Cryptography and Network Security Chapter 4. Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic.
Ch1 - Algorithms with numbers Basic arithmetic Basic arithmetic Addition Addition Multiplication Multiplication Division Division Modular arithmetic Modular.
Ref: Pfleeger96, Ch.31 Properties of Arithmetic Reference: Pfleeger, Charles P., Security in Computing, 2nd Edition, Prentice Hall, 1996.
Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2015 Nitesh Saxena.
Pertemuan #5 Pengantar ke Number Theory Kuliah Pengaman Jaringan.
15-499Page :Algorithms and Applications Cryptography II – Number theory (groups and fields)
9.1 Primes and Related Congruence Equations 23 Sep 2013.
MA/CSSE 473 Day 09 Modular Division Revisited Fermat's Little Theorem Primality Testing.
CS480 Cryptography and Information Security
MA/CSSE 473 Day 07 Extended Euclid's Algorithm Modular Division Fermat's little theorem intro.
MA/CSSE 473 Day 07 Extended Euclid's Algorithm Modular Division
CS480 Cryptography and Information Security
Mathematical Background : A quick approach to Group and Field Theory
Public Key Encryption Major topics The RSA scheme was devised in 1978
Introduction to Number Theory
B504/I538: Introduction to Cryptography
CSE565: Computer Security Lecture 7 Number Theory Concepts
Handbook of Applied Cryptography - CH4, from 4.1~4.3
Lecture 3.2: Public Key Cryptography II
Numerical Algorithms x x-1 Numerical Algorithms
Number-Theoretic Algorithms (UNIT-4)
Cryptography and Network Security
Introduction to Number Theory
MATH301- DISCRETE MATHEMATICS Copyright © Nahid Sultana Dr. Nahid Sultana Chapter 4: Number Theory and Cryptography.
Number Theory (Chapter 7)
Cryptography and Network Security
RSA Cryptosystem Bits PCs Memory MB ,000 4GB 1,020
Computer Security Modular Arithmetic November 12, 2018
Parallel Quadratic Sieve
Prime and Relatively Prime Numbers
Cryptography and Network Security
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Cryptography and Network Security
Lecture 3.1: Public Key Cryptography I
Patrick Lee 12 July 2003 (updated on 13 July 2003)
Cryptology Design Fundamentals
Cryptography Lecture 20.
Cryptography Lecture 19.
Mathematical Background : A quick approach to Group and Field Theory
Presentation transcript:

Mathematical Background for Cryptography Dr. Ron Rymon Efi Arazi School of Computer Science IDC, Herzliya. 2005 Pre-Requisites: None

Overview Modular Arithmetic Relatively Prime Numbers Generating Prime Numbers Factoring

Modular Arithmetic

Fields A field is a set of elements with two operations (+,*) a “zero”, s.t. a, a+0=a a “one”, s.t. a, a*1=a a-1 iff a*a-1 =1 -a iff a+(-a)=0

Galois Fields: GF(p) Elements: {0,1, …p-1} Operations: (+,*) modulo a prime p Examples: 4+6 mod 7 = 3 4*6 mod 7 = 3 -4 = 3 4-1 = 2 Properties: (a mod p) +/- (b mod p) = (a+/-b) mod p (a mod p) * (b mod p) = (a*b) mod p

Fermat’s Little Theorem in GF(p), a0, a(p-1) mod p = 1 note that there is a cycle here, because ap mod p = a * a(p-1) mod p = a * 1 mod p = a Example a6 mod 7 = 1 a0 in GF(7) hence, for any b, s.t. b=a2 mod 7, b3 mod 7 =1

The Field GF(2n) Elements: n-bits binary vectors , e.g., (1101) in GF(24) Polynomial Representation In GF(24), (1101) is represented with the polynomial X3+ X2+1 Addition = XOR of coefficients Note: addition = subtraction Multiplication = multiplication of polynomials modulo an irreducible polynomial Irreducible polynomial is divisible only by 1 and by itself Analogous to a prime number Usually, the polynomial Xn+X+1 is used Other irreducible polynomials can also be used

The Field GF(2n) – Examples Addition: (0100) + (1101) = (1001) Multiplication (0100) x (1101) = X2(X3+X2+1) mod (X3+X+1) = X5+X4+X2 mod (X3+X+1) = X2(X3+X+1) – X3 – X 2 + X4 + X2 mod (X3+X+1) = X4 + X3 mod (X3+X+1) = X(X3+X+1 ) – X2 – X + X3 = (1110)

Relatively Prime Numbers

Relatively Prime Numbers Two numbers a and b are relatively prime if they share no common factors i.e. GCD (a,b) =1, GCD = Greatest Common Divisor Examples GCD(21,7) = 7 GCD(21,8) = 1 GCD(a,p) = 1, unless a|p

Computing GCD Euclidean GCD Algorithm: Iteratively take modulo of each other until 0 135 40 105 41 15 23 10 18 5 3 2 1

Euler Totient Function Definition f(n) is the number of elements a<n s.t., a is relatively prime to n (i.e. GCD(a,n)=1) Examples: f(12)=4 {1,5,7,11} f(p)=p-1, for a prime p {1,2,…p-1} Euler’s Generalization of Fermat’s Little Theorem If a is relatively prime to n, then a f(n) mod n = 1 Corollary: ab mod n = a(b mod f(n)) mod n Makes it easier to compute powers e.g., a703 mod 12 = a3 mod 12

Calculating Inverses In general, in GF(n), there is not always an inverse. In GF(n), a has an inverse iff a is relatively prime to n In particular, if n is prime then there is always an inverse (a<n) The Extended Euclidean Algorithm If r is the GCD(a,b), then r=xa+yb (linear combination) x and y can be computed by reversing the Euclidean Algorithm If a and n are relatively prime, then 1=xa+yn Under mod n, we have 1=xa+0, or x=a-1

Generating Prime Numbers

Primality Tests: Fermat According to Fermat’s Little Theorem If p is prime then a(p-1) mod p=1 Test 1: Generate a number a<n, and test if holds Test 2: Test for 2, 2p mod p =2 Most non-primes will fail the test, but the test does not guarantee primality Pseudoprimes satisfy the Fermat’s condition for some a’s, but are not primes Carmichael numbers are non-primes for which the Fermat condition is satisfied for all a<p Examples: 561, 1105 Unfortunately, there are infinitely many Carmichael numbers Fortunately, they are sparse and easy to detect

Primality Tests: Rabin-Miller Let p=1+2b m p is odd; m is the odd number past the trailing zero bits Pick arbitrary a<p Calculate z=am mod p if z = 1 mod p, then p may be a prime Calculate z=a2j m mod p , for each 0<=j<b if z = -1 mod p, then p may be a prime (-1 = p-1 ) Theorem: chances of p qualifying for an arbitrary a<1/4 Algorithm: Repeat the test enough times to reduce the chance of coincidence a ** (p-1) = a ** (m2**b) if a**m = 1 then a**(p-1)=1

Practical Implementation Generate an odd number p with enough bits Simply set the high and low bits to 1 Check to see that p is not divisible by small primes Usually, check against all primes <2000 Use the Rabin-Miller test on a few a’s Note: Primes are actually quite dense within the natural numbers (about 1:k among k-bit numbers)

Factoring

Factoring Factoring a number means to find its prime factors e.g., 60=2*2*3*5 In general, this can be a hard problem, especially if the number has few factors, and these factors are large e.g., 2113-1=3391*23279*65993*1868569*1066818132868207 Factoring is an old problem, and is not difficult, but it can be time consuming The Number Field Sieve (NFS) algorithm is considered the fastest for very large numbers Has sub-exponential run-time !!

How Hard Is It Number of decimal digits factored using Quadratic Number Sieve algorithm 1983 – 71 digits 1989 – 100 digits 1993 – 129 digits QS is based on an observation of Fermat Every odd composite number can be written as difference of two squares: X2 – Y2 (hence (X+Y),(X-Y) are factors) NFS is faster than QS, and is getting better with new optimizations Uses non-integers also (roots) RSA-211 = (10211-1)/9 factored in 1999 RSA-155 (512 bits) is more difficult and was also factored in 1999 35 computing years on Unix/Pentium machines, over the course of 7 calendar months

Strong Primes In many cryptographic algorithms, the key is made of a product of two primes p,q It is desirable that p,q be hard to discover (strong primes): GCD(p-1,q-1) is small Both p-1 and q-1 have large prime factors p’, q’ Also p’-1 and q’-1 have large prime factors (p-1)/2 and (q-1)/2 are both prime This is not a formal definition, only a wishlist