Factoring 1 Factoring Factoring 2 Factoring  Security of RSA algorithm depends on (presumed) difficulty of factoring o Given N = pq, find p or q and.

Slides:



Advertisements
Similar presentations
Cryptography and Network Security
Advertisements

Factoring Polynomials
22C:19 Discrete Structures Integers and Modular Arithmetic
Lecture 8: Primality Testing and Factoring Piotr Faliszewski
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
7. Asymmetric encryption-
RSA & F ACTORING I NTEGERS BY: MIKE NEUMILLER & BRIAN YARBROUGH.
Hashing Techniques.
Great Theoretical Ideas in Computer Science.
CNS2010handout 8 :: introduction to number theory1 computer and network security matt barrie.
Announcements: 1. Term project groups and topics due tomorrow midnight Waiting for posts from most of you. Questions? This week: Primality testing, factoring.
Announcements: 1. Pass in Homework 5 now. 2. Term project groups and topics due by Friday 1.Can use discussion forum to find teammates 3. HW6 posted, due.
The RSA Cryptosystem and Factoring Integers (II) Rong-Jaye Chen.
Introduction to Modern Cryptography Homework assignments.
Foundations of Network and Computer Security J J ohn Black Lecture #13 Sep 26 th 2007 CSCI 6268/TLEN 5831, Fall 2007.
Discrete Log 1 Discrete Log. Discrete Log 2 Discrete Logarithm  Discrete log problem:  Given p, g and g a (mod p), determine a o This would break Diffie-Hellman.
Foundations of Network and Computer Security J J ohn Black Lecture #12 Sep 23 rd 2009 CSCI 6268/TLEN 5550, Fall 2009.
Announcements: 1. Pass in worksheet on using RSA now. 2. DES graded soon 3. Short “pop” quiz on Ch 3 (Thursday at earliest) 4. Term project groups and.
CSE 321 Discrete Structures Winter 2008 Lecture 8 Number Theory: Modular Arithmetic.
Factoring Algorithms Ref: D. Stinson, Cryptography - Theory and Practice, 2001.
Chapter 8 – Introduction to Number Theory Prime Numbers
Dan Boneh Intro. Number Theory Modular e’th roots Online Cryptography Course Dan Boneh.
RSA Question 2 Bob thinks that p and q are primes but p isn’t. Then, Bob thinks ©Bob:=(p-1)(q-1) = Á(n). Is this true ? Bob chooses a random e (1 < e
Tallinn University of Technology Quantum computer impact on public key cryptography Roman Stepanenko.
Public key ciphers 1 Session 5.
Lecture 5 Overview Does DES Work? Differential Cryptanalysis Idea – Use two plaintext that barely differ – Study the difference in the corresponding.
1 CIS 5371 Cryptography 8. Asymmetric encryption-.
Topic 18: RSA Implementation and Security
CSE 321 Discrete Structures Winter 2008 Lecture 10 Number Theory: Primality.
Foundations of Network and Computer Security J J ohn Black Lecture #14 Oct 1 st 2007 CSCI 6268/TLEN 5831, Fall 2007.
The RSA Algorithm Rocky K. C. Chang, March
Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Copyright © The McGraw-Hill Companies, Inc. Permission required.

May 29, 2008 GNFS polynomials Peter L. Montgomery Microsoft Research, USA 1 Abstract The Number Field Sieve is asymptotically the fastest known algorithm.
MATH 224 – Discrete Mathematics
Information Security and Management 4. Finite Fields 8
The Polynomial Time Algorithm for Testing Primality George T. Gilbert.
October,2006 Higher- Degree Polynomials Peter L. Montgomery Microsoft Research and CWI 1 Abstract The Number Field Sieve is asymptotically the fastest.
Copyright, Yogesh Malhotra, PhD, 2013www.yogeshmalhotra.com SPECIAL PURPOSE FACTORING ALGORITHMS Special Purpose Factoring Algorithms For special class.
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.
Prabhas Chongstitvatana1 Factorizing large integers Finding the unique decomposition of n into a product of prime factors. Factorize(n) if n is prime done.
PRIMES is in P Manindra Agrawal NUS Singapore / IIT Kanpur.
Introduction to Algorithms Second Edition by Cormen, Leiserson, Rivest & Stein Chapter 31.
Modular Arithmetic with Applications to Cryptography Lecture 47 Section 10.4 Wed, Apr 13, 2005.
Factorization of a 768-bit RSA modulus Jung Daejin Lee Sangho.
SNFS versus (G)NFS and the feasibility of factoring a 1024-bit number with SNFS Arjen K. Lenstra Citibank, New York Technische Universiteit Eindhoven.
Sieve of Eratosthenes. The Sieve of Eratosthenes is a method that.
Public Key Systems 1 Merkle-Hellman Knapsack Public Key Systems 2 Merkle-Hellman Knapsack  One of first public key systems  Based on NP-complete problem.
Lecture 8 Overview. Analysis of Algorithms Algorithms – Time Complexity – Space Complexity An algorithm whose time complexity is bounded by a polynomial.
22C:19 Discrete Structures Integers and Modular Arithmetic Fall 2014 Sukumar Ghosh.
Scott CH Huang COM 5336 Cryptography Lecture 6 Public Key Cryptography & RSA Scott CH Huang COM 5336 Cryptography Lecture 6.
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.
Ch1 - Algorithms with numbers Basic arithmetic Basic arithmetic Addition Addition Multiplication Multiplication Division Division Modular arithmetic Modular.
A Survey on Factoring Large Numbers ~ 巨大数の因数分解に関する調査 ~ Kanada Lab. M Yoshida Hitoshi.
Implementation Issues for Public Key Algorithms
9.1 Primes and Related Congruence Equations 23 Sep 2013.
1 Diffie-Hellman (Key Exchange) Protocol Rocky K. C. Chang 9 February 2007.
Implementation of Public Key Encryption Algorithms
1 Diffie-Hellman (Key Exchange) Protocol Rocky K. C. Chang 9 February 2007.
Chapter 4 With Question/Answer Animations 1. Chapter Summary Divisibility and Modular Arithmetic - Sec 4.1 – Lecture 16 Integer Representations and Algorithms.
1 The RSA Algorithm Rocky K. C. Chang February 23, 2007.
Key Exchange in Systems VPN usually has two phases –Handshake protocol: key exchange between parties sets symmetric keys –Traffic protocol: communication.
Public Key Encryption Major topics The RSA scheme was devised in 1978
PUBLIC-KEY ENCRYPTION Focusing on RSA
Public Key Cryptosystems - RSA
Number Theory (Chapter 7)
Homework 3 As announced: not due today 
Parallel Quadratic Sieve
Factoring RSA Moduli: Current State of the Art J
Presentation transcript:

Factoring 1 Factoring

Factoring 2 Factoring  Security of RSA algorithm depends on (presumed) difficulty of factoring o Given N = pq, find p or q and RSA is broken o Rabin cipher also based on factoring  Factoring like “exhaustive search” for RSA  Lots of interest/research in factoring  What are best factoring methods? o How does RSA “key size” compare to symmetric cipher key size?

Factoring 3 Factoring Methods  Trial division o Obvious method but not practical  Dixon’s algorithm o Less obvious and much faster  Quadratic sieve o Refinement of Dixon’s algorithm o Best algorithm up to about 110 decimal digits  Number field sieve o Best for numbers greater than 100 digits o We only briefly mention this algorithm

Factoring 4 Trial Division  Given N, try to divide N by each of 2,3,5,7,9,11,…,  sqrt(N)   As soon as a factor found, we are done o So, expected work is about sqrt(N)/2  Improvement: try only prime numbers  Work is then on order of  ( N) o Where  ( N) ≈ N/ln(N) is number of primes up to N

Factoring 5 Congruence of Squares  We want to factor N = pq  Suppose we find x,y such that N = x 2  y 2  Then N = (x  y)(x + y), have factored N  More generally, congruence of squares…  Suppose x 2 = y 2 (mod N)  Then x 2  y 2 = kN for some k  Which implies (x  y)(x + y) = kN

Factoring 6 Congruence of Squares  Suppose x 2 = y 2 (mod N)  Then (x  y)(x + y) = kN  Implies (x  y) or (x + y) is factor of N o Or x  y = k and x + y = N (or vice versa)  With probability at least 1/2, we obtain a factor of N o If so, gcd(N, x  y) or gcd(N, x + y) factors N o And the gcd is easy to compute

Factoring 7 Congruence of Squares  For example 10 2 = 3 2 (mod 91)  That is, (10  3)(10 + 3) = 91 o Factors of 91 are, in fact, 7 and 13  Also, 34 2 = 8 2 (mod 91) o Then 26  42 = 0 (mod 91) and we have gcd(26,91) = 13 and gcd(42,91) = 7  In general, gcd is necessary

Factoring 8 Congruence of Squares  Find congruence of squares: x 2 = y 2 (mod N) and we can likely factor N  How to find congruence of squares?  Consider, for example, 41 2 = 32 (mod 1649) and 43 2 = 200 (mod 1649)  Neither 32 nor 200 is a square  But 32  200 = 6400 = 80 2  Therefore, (41  43) 2 = 80 2 (mod 1649)

Factoring 9 Congruence of Squares  Can combine non-squares to obtain a square, for example 32 = 2 5  5 0 and 200 = 2 3  5 2  And 32  200 = 2 8  5 2 = (2 4  5 1 ) 2  We obtain a perfect square provided each exponent in product is even  Only concerned with exponents and only need consider even or odd, i.e., mod 2

Factoring 10 Congruence of Squares  Number has an exponent vector  For example, first element of vector is power of 2 and second power of 5  Then  And

Factoring 11 Congruence of Squares  Mod 2 exponent vector of product 200  32 is all zero, so perfect square  Also, this vector is sum (mod 2) of vectors for 200 and 32  Any set of exponent vectors that sum to all-zero, mod 2, gives us a square  We need to keep vectors small o Only allow numbers with “small” prime factors

Factoring 12 Congruence of Squares  Choose bound B and primes less than B o This is our factor base o For technical reasons, include “  1” in factor base  A number that factors completely over the factor base is B -smooth  Smooth relations factor over factor base  Restrict our attention to B -smooth relations o Good: Exponent vectors are small o Bad: Harder to find relations

Factoring 13 Example  Want to factor N = 1829  Choose bound B = 13  Choose factor base  1,2,3,5,7,11,13  Look at values in  N/2 to N/2  To be systematic, we choose  sqrt(kN)  and  sqrt(kN)  for k = 1,2,3,4  And test each for B -smoothness

Factoring 14 Example  Compute  All are B-smooth except 60 2 and 75 2

Factoring 15 Example  Obtain exponent vectors

Factoring 16 Example  Find collection of exponent vectors that sum, mod 2, to zero vector  Vectors corresponding to 42 2, 43 2, 61 2 and 85 2 work

Factoring 17 Example  Implies that (42  43  61  85) 2 = (2  3  5  7  13) 2 (mod 1829)  Simplifies to = (mod 1829)  Since 1459  901 = 558, we find factor of 1829 by gcd(558,1829) = 31  Easily verified 1829 = 59  31

Factoring 18 Example  A systematic way to find set of vectors that sum to zero vector…  In this example, want x 0,x 1,…,x 5  This is a basic linear algebra problem

Factoring 19 Linear Algebra  Suppose n elements in factor base o Factor base includes “  1” o Then matrix on previous slide has n rows o Seek linearly dependent set of columns  Theorem: If matrix has n rows and n + 1 or more columns then a linearly dependent set of columns exists  Therefore, if we find n + 1 or more smooth relations, we can solve the linear equations

Factoring 20 Dixon’s Algorithm 1.To factor N : select bound B and factor base with n  1 primes less than B and “  1” 2.Select r, compute y = r 2 (mod N) Number r can be selected at random 3.If y factors completely over factor base, save mod 2 exponent vector 4.Repeat steps 2 and 3 to obtain n+1 vectors 5.Solve linear system and compute gcd

Factoring 21 Dixon’s Algorithm  If factor base is large, easier to find B -smooth relations o But linear algebra problem is harder  Relation finding phase parallelizable o Linear algebra part is not  Next, quadratic sieve o An improved version of Dixon’s algorithm

Factoring 22 Quadratic Sieve  Quadratic sieve (QS) algorithm o Dixon’s algorithm “on steroids”  Finding B -smooth relations beefed up  As in Dixon’s algorithm o Choose bound B and factor base of primes less than B o Must find lots of B -smooth relations

Factoring 23 Quadratic Sieve  Define quadratic polynomial Q(x) = (  sqrt(N)  + x) 2  N  The is the “quadratic” in QS  Use Q(x) to find B -smooth values o For each x  [  M,M] compute y = Q(x) o Mod N, we have y = z 2, where z =  sqrt(N)  + x o Test y for B -smoothness o If y is smooth, save mod 2 exponent vector

Factoring 24 Quadratic Sieve  Advantage of QS over Dixon’s is that by using Q(x) we can sieve  What is sieving? Glad you asked…  First, consider sieve of Eratosthenes o Used to sieve for prime numbers  Then modify it for B -smooth numbers

Factoring 25 Sieve of Eratosthenes  To find prime numbers less than M  List all numbers 2,3,4,…, M  1  Cross out all numbers with factor of 2, other than 2  Cross out all numbers with factor of 3, other than 3, and so on  Number that “fall thru” sieve are prime

Factoring 26 Sieve of Eratosthenes  To find prime numbers less than 31… ———— ————— ————— ⁄⁄ ⁄⁄⁄ ⁄ ⁄⁄⁄ \ \ \ \\ | | | ||   Find that primes less than 31 are 2,3,5,7,11,13,17,19,23 and 29

Factoring 27 Sieve of Eratosthenes  This sieve gives us primes  But also provides info on non-primes  For example, 24 marked with “ ” and “ ” so it is divisible by 2 and 3  Note: we only find that 24 is divisible by 2, not by 4 or 8 — ⁄

Factoring 28 Sieving for Smooth Numbers  Instead of crossing out, we divide by the prime (including prime itself)  All 1s represent 7-smooth numbers  Some non-1s also 7-smooth o Divide out highest powers of primes

Factoring 29 Quadratic Sieve  QS uses similar sieving strategy as on previous slide o And some computational refinements  Suppose p in factor base divides Q(x) o Then p divides Q(x + kp) for all k  0 (homework) o That is, p divides Q of …,x  2p,x  p,x,x+p,x+2p,… o No need to test these for divisibility by p  This observation allows us to sieve

Factoring 30 Quadratic Sieve  One trick to speed up sieving  If Q(x) divisible by p, then Q(x) = 0 (mod p)  Defn of Q implies (  sqrt(N)  + x) 2 = N (mod p)  Square roots of N (mod p), say, s p and p  s p o Let x 0 = s p   sqrt(N)  and x 1 = p  s p   sqrt(N)  o Then Q(x 0 ) and Q(x 1 ) divisible by p o Implies Q(x 0 + kp) and Q(x 1 + kp) divisible by p  Efficient algorithm for these square roots

Factoring 31 Quadratic Sieve  How to sieve for B -smooth relations  Array: Q(x) for x =  M,  M+1,…, M  1,M  For first prime p in factor base o Generate all x  [  M,M] for which p divides Q(x) (as described on previous slide) o For each, divide by highest power of p o For each, store power, mod 2, in vector for x  Repeat for all primes in factor base  Numbers reduced to 1 are B -smooth

Factoring 32 Quadratic Sieve  Linear algebra phase same as Dixon’s  Sieving is the dominant work  Lots of tricks used to speed up sieving o For example, “logarithms” to avoid division  Multiple Polynomial QS (MPQS) o Multiple polynomials of form (ax+b) 2  N o Can then use smaller interval [  M,M] o Yields much faster parallel implementations

Factoring 33 Sieving Conclusions  QS/MPQS attack has two phases  Distributed relation finding phase o Could recruit volunteers on Internet  Linear equation solving phase o For big problems, requires a supercomputer  Number field sieve better than QS o Requires 2 phases, like QS o Number field sieve uses advanced math

Factoring 34 Factoring Algorithms  Work to factor N = 2 x  Last column measures “bits” of work  Symmetric cipher exhaustive key search: x bit key is x  1 bits of work

Factoring 35 Factoring Algorithms  Comparison of work factors  QS best to 390 bit N o 117 digits  390-bit N is as secure as 60-bit key

Factoring 36 Factoring Conclusions  Work for factoring is subexponential o Better than exponential time but worse than polynomial time o Exhaustive key search is exponential  Factoring is active area of research o Expect to see incremental improvement  Next, discrete log algorithms…