integer factorization methods
play

Integer Factorization Methods Modular Arithmetic Trial division, - PowerPoint PPT Presentation

Integer Factorization Methods Integer 2014-04-11 Integer Factorization Methods Factorization Trial division, Pollards p 1 , Pollards , and Fermats method Methods Christopher Koch 1 C. Koch 1 Department of Computer Science and


  1. Integer Factorization Methods Integer 2014-04-11 Integer Factorization Methods Factorization Trial division, Pollard’s p − 1 , Pollard’s ρ , and Fermat’s method Methods Christopher Koch 1 C. Koch 1 Department of Computer Science and Engineering CSE489/589 Algorithms in CS & IT New Mexico Tech April 8, 2014 Overview Integer Factorization Methods Modular Arithmetic Trial division, Pollard’s p − 1 , Division Algorithm and Congruence Pollard’s ρ , and Fermat’s method Residue classes mod n Integers modulo n Arithmetic with integers mod n GCD and Totatives Christopher Koch 1 Inverses mod n Euler’s Theorem Cost of 1 Department of Computer Science and Engineering Multiplication and GCD CSE489/589 Algorithms in CS & IT Integer New Mexico Tech Factorization Trial Division April 8, 2014 Pollard’s p − 1 Cycles in Z / n Z Floyd’s cycle-finding Pollard’s ρ Birthday paradox Fermat’s method

  2. Integer Factorization Methods Overview Integer 2014-04-11 • Intro to modular arithmetic Factorization Overview • Euler’s theorem and Fermat’s little theorem Overview Methods • Trial division • Pollard’s p − 1 method • Cycles in Z / n Z C. Koch • Floyd’s cycle-finding algorithm • Pollard’s ρ method (Monte Carlo factorization) Overview • Birthday paradox • Fermat’s method Overview Convention a , b , c , d , m , n are integers, p , q are primes • Intro to modular arithmetic Modular Arithmetic • Euler’s theorem and Fermat’s little theorem Division Algorithm • Monte Carlo method: dependent on some kind of random and Congruence • Trial division Residue classes mod number/function/process n Integers modulo n • Pollard’s p − 1 method Arithmetic with integers mod n • Cycles in Z / n Z GCD and Totatives Inverses mod n Euler’s Theorem • Floyd’s cycle-finding algorithm Cost of Multiplication • Pollard’s ρ method (Monte Carlo factorization) and GCD • Birthday paradox Integer Factorization • Fermat’s method Trial Division Pollard’s p − 1 Cycles in Z / n Z Floyd’s cycle-finding Convention Pollard’s ρ Birthday paradox a , b , c , d , m , n are integers, p , q are primes Fermat’s method

  3. Integer Factorization Methods Modular Arithmetic Integer • a ∣ b ( a divides b ) if b is a multiple of a . 2014-04-11 Factorization Modular Arithmetic • quotient and remainder unique in integer division Modular Arithmetic • Congruence modulo n : Methods a ≡ b ( mod n ) iff n ∣( a − b ) . Division Algorithm and Congruence C. Koch Modular Arithmetic • a ∣ b ( a divides b ) if b is a multiple of a . Overview Modular • quotient and remainder unique in integer division Arithmetic Division Algorithm • Congruence modulo n : • Division Algorithm: Given a , b there exist unique q , r and Congruence Residue classes mod n a = bq + r where 0 ≤ r < b . Integers modulo n a ≡ b ( mod n ) iff n ∣( a − b ) . Arithmetic with integers mod n GCD and Totatives • For example, 13 ≡ 8 ≡ 3 ( mod 5 ) . Inverses mod n • Intuition: a and b have same remainder when divided by n Euler’s Theorem Cost of Multiplication and GCD Integer Factorization Trial Division Pollard’s p − 1 Cycles in Z / n Z Floyd’s cycle-finding Pollard’s ρ Birthday paradox Fermat’s method

  4. Integer Factorization Methods Residue classes Integer • Congruence modulo n is an equivalence relation on 2014-04-11 integers. Factorization Modular Arithmetic • Equivalence classes: one for each remainder Residue classes Methods [ a ] n = { x ∶ x ≡ a ( mod n )} . Residue classes mod n • Called residue classes mod n C. Koch Residue classes • Congruence modulo n is an equivalence relation on Overview integers. Modular Arithmetic • Equivalence classes: one for each remainder Division Algorithm • Equivalence classes of congruence: Integers with same and Congruence Residue classes mod [ a ] n = { x ∶ x ≡ a ( mod n )} . remainder are related to each other n Integers modulo n • Each remainder thus forms an equivalence class Arithmetic with integers mod n • Example: Residue classes mod 4 , residue classes mod 2 (even, GCD and Totatives • Called residue classes mod n odd) Inverses mod n Euler’s Theorem Cost of Multiplication and GCD Integer Factorization Trial Division Pollard’s p − 1 Cycles in Z / n Z Floyd’s cycle-finding Pollard’s ρ Birthday paradox Fermat’s method

  5. Integer Factorization Methods Integers modulo n Integer • Integers modulo n : set of residue classes mod n : 2014-04-11 Factorization Modular Arithmetic Z / n Z = {[ r ] n ∶ r ∈ Z } . Integers modulo n • How to do arithmetic in mod n ? What is [ 3 ] 4 + [ 1 ] 4 ? Methods Integers modulo n C. Koch Integers modulo n • Integers modulo n : set of residue classes mod n : Overview Modular Z / n Z = {[ r ] n ∶ r ∈ Z } . Arithmetic • For example, Z / 4 Z = {[ 0 ] 4 , [ 1 ] 4 , [ 2 ] 4 , [ 3 ] 4 } Division Algorithm and Congruence • How to do arithmetic in mod n ? What is [ 3 ] 4 + [ 1 ] 4 ? Residue classes mod • 24-hour clock n Integers modulo n • Intuition: notion of “finite discreteness” • Like b -bit (unsigned) integers – Z / 2 b Z – overflow “wraps” back Arithmetic with integers mod n GCD and Totatives around (most general-purpose architectures don’t do saturation Inverses mod n Euler’s Theorem arithmetic, so it wraps around like modular arithmetic) • But also, [ 5 ] 4 ∈ Z / 4 Z . Why? Cost of Multiplication • Because [ 5 ] 4 = [ 1 ] 4 , since 5 ≡ 1 ( mod 4 ) . and GCD Integer Factorization Trial Division Pollard’s p − 1 Cycles in Z / n Z Floyd’s cycle-finding Pollard’s ρ Birthday paradox Fermat’s method

  6. Integer Factorization Methods Arithmetic mod n Integer Definition 2014-04-11 Let n ∈ Z + and a , b ∈ Z . Then, Factorization Modular Arithmetic [ a ] n + [ b ] n = [ a + b ] n Arithmetic mod n Methods [ a ] n × [ b ] n = [ a × b ] n Arithmetic with integers mod n C. Koch • Similarly, [ a ] n − [ b ] n = [ a ] n + [− b ] n = [ a − b ] n . Arithmetic mod n Definition Overview Let n ∈ Z + and a , b ∈ Z . Then, Modular Arithmetic [ a ] n + [ b ] n = [ a + b ] n Division Algorithm • Example here: 24-hour clock, adding 12 and 25, and multiplying and Congruence Residue classes mod [ a ] n × [ b ] n = [ a × b ] n 13 by 2 n • Proof that well-defined: Pick x ∈ [ a ] n , y ∈ [ b ] n different Integers modulo n representatives, show x + y ∈ [ a + b ] n since x ≡ a ( mod n ) and Arithmetic with integers mod n y ≡ b ( mod n ) implies x + y ≡ a + b ( mod n ) . GCD and Totatives Inverses mod n Euler’s Theorem • Similarly, Cost of [ a ] n − [ b ] n = [ a ] n + [− b ] n = [ a − b ] n . Multiplication and GCD Integer Factorization Trial Division Pollard’s p − 1 Cycles in Z / n Z Floyd’s cycle-finding Pollard’s ρ Birthday paradox Fermat’s method

  7. Integer Factorization Methods GCD and Totatives Integer 2014-04-11 Factorization Modular Arithmetic • gcd ( a , b ) is the greatest common divisor of a and b GCD and Totatives • a , b are called coprime or relatively prime if gcd ( a , b ) = 1 . Methods a is called a totative of b and vice versa. GCD and Totatives • Bézout’s identity: If gcd ( n , m ) = d , then there exist k , l s.t. nk + ml = d . C. Koch • ϕ ( n ) counts the number totatives less than n : GCD and Totatives ϕ ( n ) = ∣{ c ∶ 1 ≤ c < n and gcd ( c , n ) = 1 }∣ . • We have ϕ ( mn ) = ϕ ( n ) ϕ ( m ) . Overview Modular • gcd ( a , b ) is the greatest common divisor of a and b Arithmetic • Example: gcd ( 40 , 6 ) = 2 . Division Algorithm • a , b are called coprime or relatively prime if gcd ( a , b ) = 1 . and Congruence • Example: ϕ ( p ) = p − 1 . Residue classes mod n • Multiplicative ϕ useful since ϕ ( pq ) = ϕ ( p ) ϕ ( q ) = ( p − 1 )( q − 1 ) . Integers modulo n a is called a totative of b and vice versa. Arithmetic with • Bézout’s identity: If gcd ( n , m ) = d , then there exist k , l integers mod n (easy to compute) GCD and Totatives s.t. nk + ml = d . • Totative of n is a number m that is coprime to n Inverses mod n Euler’s Theorem • ϕ ( n ) counts the number totatives less than n : Cost of Multiplication and GCD ϕ ( n ) = ∣{ c ∶ 1 ≤ c < n and gcd ( c , n ) = 1 }∣ . Integer Factorization • We have ϕ ( mn ) = ϕ ( n ) ϕ ( m ) . Trial Division Pollard’s p − 1 Cycles in Z / n Z Floyd’s cycle-finding Pollard’s ρ Birthday paradox Fermat’s method

  8. Integer Factorization Methods Inverses mod n Integer 2014-04-11 Factorization Modular Arithmetic Inverses mod n Methods • Notice: no division in mod n! Inverses mod n • Division is usually defined as multiplication by the multiplicative inverse. C. Koch • Multiplicative inverse of [ a ] n is [ b ] n such that [ a ] n [ b ] n = [ 1 ] n ; i.e. ab ≡ 1 ( mod n ) . Inverses mod n Overview Modular Arithmetic • Example here: 2 ∈ Z / 4 Z and its inverse? 4 ∈ Z / 7 Z and its Division Algorithm and Congruence Residue classes mod inverse? n • Notice: no division in mod n! Integers modulo n Arithmetic with integers mod n • Division is usually defined as multiplication by the GCD and Totatives multiplicative inverse. Inverses mod n Euler’s Theorem • Multiplicative inverse of [ a ] n is [ b ] n such that Cost of [ a ] n [ b ] n = [ 1 ] n ; i.e. ab ≡ 1 ( mod n ) . Multiplication and GCD Integer Factorization Trial Division Pollard’s p − 1 Cycles in Z / n Z Floyd’s cycle-finding Pollard’s ρ Birthday paradox Fermat’s method

Recommend


More recommend