This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 170 Algorithms Fall 2009 Christos Papadimitriou HW 2 Solutions 1. (10 pts.) RSA Problem 1.42 Solution We know that p is a prime and gcd ( e , p 1 ) = 1. Using the extended Euclidean algorithm find integers x , y such that xe + y ( p 1 ) = 1. We then have that m xe + y ( p 1 ) = m 1 ( mod p ) and using Fermat’s little theorem we get m xe = m ( mod p ) , i.e. ( m e ) x = m ( mod p ) . So the algorithm is as follows: Input: p , e , m e mod p Compute x , y such that xe + y ( p 1 ) = 1 using extended euclidean algorithm (in Θ ( log ( p 1 )) steps). Compute and output ( m e ) x mod p (in Θ ( log 3 p ) steps). The correctness of the algorithm follows from the previous discussion and its running time is Θ ( log 3 p ) , clearly polynomial. 2. (15 pts.) RSA Problem 1.43 Solution We first note that we must have 3 d = 1 ( mod ( p 1 )( q 1 )) or equivalently 3 d 1 = k ( p 1 )( q 1 ) for some k ∈ Z ; we will try to find this k . First note that d < ( p 1 )( q 1 ) (since it is the inverse of 3 modulo ( p 1 )( q 1 ) ); hence kd < k ( p 1 )( q 1 ) = 3 d 1 < 3 d ⇒ k < 3. Moreover we have that k > 0 because 3 d 1 > 0. So the only possible values for k are 1 and 2. Notice now that p 6 = ( mod 3 ) (since p is prime) and p 6 = 1 ( mod 3 ) since 3 has an inverse modulo ( p 1 )( q 1 ) and therefore it has to be relatively prime to p 1. So the only option left is p = 2 ( mod 3 ) . Likewise q = 2 ( mod 3 ) , so we have ( p 1 )( q 1 ) = 1 ( mod 3 ) . Suppose now that k = 1; then ( p 1 )( q 1 ) = 3 d 1 = 2 ( mod 3 ) , a contradiction. Hence k = 2. So now we have two equations involving the two unknowns p , q , namely: 3 d 1 = 2 ( p 1 )( q 1 ) and pq = N . We can now solve the first one to get p + q = N + 1 3 d 1 2 , S and end up with two formulas of the form p + q = S and pq = N . We can now find p , q as the roots to the equation x 2 Sx + N = 0....
View Full
Document
 Spring '09
 Naver
 Algorithms

Click to edit the document details