11.07.2015 Views

Cryptography - Sage

Cryptography - Sage

Cryptography - Sage

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

We would like to compute the value of d, but the SAGE function crt complains that themoduli p − 1 and q − 1 have a common factor.sage: gcd(p-1,q-1);6sage: (p-1).factor()2 * 3^3 * 13 * 23767 * 19475307419 * 3609932889503sage: (q-1).factor()2 * 3 * 17 * 5297 * 22123 * 152417 * 165217231734649We can divide q − 1 by 6 to remove the common factor, and so compute the Chineseremainder lifting as follows. Note first that the system is consistent — d 1 and d 2 are thesame modulo 6 since they are both inverses to e mod 6.sage: d1 mod 65sage: d2 mod 65Since (q −1)/6 is not divisible by 2 or 3, we can proceed with the Chinese remainder liftingwith p − 1 and (q − 1)/6.sage: d = crt([d1,d2],[p-1,(q-1).div(6)])sage: d35306758152215111348997570443072341096420788599987705538575Alternatively we could have computed the inverse exponent d in one step bysage: d = inverse_mod(e,lcm(p-1,q-1))sage: d35306758152215111348997570443072341096420788599987705538575Exercise 8.6 Use your exponents e, d, verify the identities mod p:for various random values of a.(a e ) d ≡ a mod n, (a d ) e ≡ a mod n, and a ed ≡ a mod n,Note that after construction of d, the primes p and q are not needed, but that withoutknowing the original factorization of n, Fermat’s little theorem does not apply, and findingthe inverse exponent for e is considered a hard problem.125

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!