The Lumenary · Early undergraduate
Cryptography
Name: ______________________
Date: ______________________
You will learn to
- Implement RSA key generation, encryption and decryption, and prove that decryption works for every message using Fermat's little theorem and the Chinese remainder theorem
- Compute modular powers by repeated squaring and prove that it uses multiplications
- Carry out a Diffie–Hellman key exchange and explain its reliance on the difficulty of discrete logarithms
- Prove that the one-time pad has perfect secrecy, and explain why practical systems rely instead on unproved hardness assumptions
- Explain why textbook RSA is unsafe in practice and why encryption alone does not guarantee authenticity
- 1.
A toy RSA public key is , where . Encrypt the message : compute .
- 2.
For the toy key , , and , find the private exponent with and .
- 3.
With the key , , , a ciphertext arrives. Decrypt it: find . (Hint: you can check your answer by encrypting it.)
- 4.
Ama and Bolat use Diffie–Hellman with and . Ama's secret is , Bolat's is . Ama sends and Bolat sends . What shared key do they compute?
- 5.
An attacker knows the public key of an RSA user. Which additional pieces of information would let the attacker compute the private exponent efficiently, with known methods? (Choose all that apply.)
- A.the factors and of
- B.the number
- C.one message together with its ciphertext
- D.nothing more: can be computed from and by repeated squaring
- 6.
Textbook RSA with and a 2048-bit modulus is used to send a 100-bit number , as . What can an eavesdropper do?
- A.Recover as the ordinary integer cube root of
- B.Nothing, because recovering requires factoring
- C.Compute from by Euclid's algorithm
- D.Use Fermat's little theorem modulo to undo the cube
- 7.
Which Lean statement is a true formalisation of RSA correctness, as proved in the lesson?
- A.
theorem t {p q e d : ℕ} (hp : p.Prime) (hq : q.Prime) (hpq : p ≠ q) (hed : e * d ≡ 1 [MOD (p - 1) * (q - 1)]) (m : ℕ) : (m ^ e) ^ d ≡ m [MOD p * q] - B.
theorem t {p q e d : ℕ} (hp : p.Prime) (hq : q.Prime) (hed : e * d ≡ 1 [MOD (p - 1) * (q - 1)]) (m : ℕ) : (m ^ e) ^ d ≡ m [MOD p * q] - C.
theorem t {p q e d : ℕ} (hp : p.Prime) (hq : q.Prime) (hpq : p ≠ q) (m : ℕ) : (m ^ e) ^ d ≡ m [MOD p * q] - D.
theorem t (n e : ℕ) : ¬ ∃ d, ∀ m, (m ^ e) ^ d ≡ m [MOD n]
- A.
- 8.
Implement
pow_mod(b, e, n)by repeated squaring without using Python's three-argumentpow: return . It must handle exponents with hundreds of digits instantly.Computational — Practice