Cryptography
Assignment
Much of this assignment requires the use of a computer algebra system (Maple, MatLab, Mathematica, or SageMath) or other software of your choice. If you have experience with one or more of them, this should be no problem for you.
SageMath is open source; https://www.sagemath.org. It’s a bit of a “learning curve” at first, but it’s well worth it.
1. Use a computer algebra system to do the following problems:
(a) Find integers x and y with 65537x + 3511y = 1.
(b) Find the last five digits of 31234567.
(c) Solve 314x ≡ 271 (mod 11111).
(d) Find all solutions to 216x ≡ 66 (mod 606).
Note to (b): Do not attempt to compute this power! Think of an appropriate modulus, and use the “modular exponentiation” feature in the system of your choice (in Maple it’s &^). You may also wish to first use Euler’s Theorem.
2. (a) Suppose that Alice encrypts a message m with Bob’s public RSA key (899, 11). The ciphertext is 468. Break the cipher, that is, determine the plaintext.
(b) Do the same with the key (11413, 7467) and the ciphertext 5859.
Note: These are, of course, “baby examples”; for real–life requirements on the key size, see the course notes or lectures.
3. You are trying to factor n = 642401. Suppose you discover that 5161072 ≡ 7 (mod n) and that 1877222 ≡ 22 · 7 (mod n). Use this information to factor n.
Hint: Look at the “Basic Principle” in Appendix A, and equate the right– hand sides of the two given congruences.
4. Let n = 537069139875071. Suppose you know that 859753244431662 ≡ 4624361062612 (mod n). Factor n.
Hint: Again, look at Appendix A.
5. The following ciphertext c ws encrypted with RSA modulus n using the exponent e:
n = 152415787501905985701881832150835089037858868621211004433e = 9007
c = 141077461765569500241199505617854673388398574333341423525
The prime factors are consecutive primes. Break the cipher, that is, find the decryption exponent d and obtain the plaintext (which is an integer).
Note: In spite of the reasonably large RSA modulus n, it is absolutely insecure, for the following reasons:
(2) The two prime factors are too close together, which makes them vulnerable to the Fermat factorization method; see again below. How– ever, randomly chosen primes are very unlikely to be too close together.
(3) If you look at the two primes after successful factoring, you will see that they are certainly not random. For a secure use of RSA, the two primes must be chosen randomly.
Hint: Read the paragraph on the Fermat factorization method in Appendix B, p. 182. It works best when the two factors are close together, as is the case here. In Maple, first use the command Digits:=50 to obtain 50–digit accuracy, then use the command round(sqrt(n*1.)) to change n to a decimal number, take its square root, and round to the nearest integer.)