Docsity

Final Exam Problems - Cryptography | MATH 116, Exams of Mathematics

Toggle sidebar
bg1
Math 116
PROFESSOR KENNETH A. RIBET
Final Examination
May 13, 2010
8 AM–11 AM, 3109 Etcheverry Hall
Please put away all books, calculators, and other portable electronic devices—anything with
an ON/OFF switch. You may refer to a single 2-sided sheet of notes. For numerical ques-
tions, show your work but do not worry about simplifying answers. For proofs, write your
arguments in complete sentences that explain what you are doing. Remember that your
paper becomes your only representative after the exam is over.
Problem Your score Possible points
1 9 points
2 8 points
3 5 points
4 4 points
5 8 points
6 8 points
7 8 points
Total: 50 points
1. Bob publishes as his private key the RSA modulus n= 4087 = 61 ·67 and the exponent e= 17. Bob’s
friend Alice wishes to send him a non-zero integer mmod nin a secure manner.
a. Alice checks that the gcd(m, n) is 1. Had this gcd been >1, what urgent unencrypted message would
Alice have sent to Bob?
YOU IDIOT: YOUR RSA MODULUS IS NOT SECURE. CHANGE IT IMMEDIATELY!!
b. What arithmetic operation does Alice perform to produce the encrypted message cthat she will send
to Bob?
She computes c=me.
c. Bob recovers mby raising cto a certain power. What power?
The inverse of emod (61 −1)(67 −1) = 3960. This inverse is calculated by the Euclidean algorithm and
turns out to be 233: 3960 = 17 ·232 + 16 = 17 ·233 −1 and thus 17 ·233 = 1 + 3960.
2. a. In the following transcript, what output does sage produce when (a^2 + 2*a + 2)^2 is input?
1
pf3
pf4

Partial preview of the text

Download Final Exam Problems - Cryptography | MATH 116 and more Exams Mathematics in PDF only on Docsity!

Math 116

PROFESSOR KENNETH A. RIBET

Final Examination

May 13, 2010

8 AM–11 AM, 3109 Etcheverry Hall

Please put away all books, calculators, and other portable electronic devices—anything with an ON/OFF switch. You may refer to a single 2-sided sheet of notes. For numerical ques- tions, show your work but do not worry about simplifying answers. For proofs, write your arguments in complete sentences that explain what you are doing. Remember that your paper becomes your only representative after the exam is over.

Problem Your score Possible points 1 9 points

2 8 points 3 5 points 4 4 points

5 8 points 6 8 points 7 8 points

Total: 50 points

  1. Bob publishes as his private key the RSA modulus n = 4087 = 61 · 67 and the exponent e = 17. Bob’s friend Alice wishes to send him a non-zero integer m mod n in a secure manner.

a. Alice checks that the gcd(m, n) is 1. Had this gcd been > 1, what urgent unencrypted message would Alice have sent to Bob?

YOU IDIOT: YOUR RSA MODULUS IS NOT SECURE. CHANGE IT IMMEDIATELY!!

b. What arithmetic operation does Alice perform to produce the encrypted message c that she will send to Bob?

She computes c = me.

c. Bob recovers m by raising c to a certain power. What power?

The inverse of e mod (61 − 1)(67 − 1) = 3960. This inverse is calculated by the Euclidean algorithm and turns out to be 233: 3960 = 17 · 232 + 16 = 17 · 233 − 1 and thus 17 · 233 = 1 + 3960.

  1. a. In the following transcript, what output does sage produce when (a^2 + 2*a + 2)^2 is input?

sage: 1+1 #the input occurs on the lines beginning "sage:" 2 sage: K. = GF(27); K Finite Field in a of size 3^ sage: a.minimal_polynomial() x^3 + 2x + 1 sage: (a^2 + 2a + 2)^

We have a^3 + 2a + 1 = 0, i.e., a^3 = a − 1. Then

(a^2 + 2a + 2)^2 = a^4 + 4a^3 + 8a^2 + 8a + 4 = a^4 + a^3 − a^2 − a + 1 = (a^2 − a) + (a − 1) − a^2 − a + 1 = −a = 2a.

b. The session continues as follows:

sage: EllipticCurve(’11a’).change_ring(GF(3)).order() 5 sage: EllipticCurve(’11a’).change_ring(K).order()

What number does sage output in response to the second command?

In other words, if an elliptic curve has 5 points over the field with 3 elements, how many points does it have over the field with 27 elements? The same type of problem was on the exam last year. As explained in the textbook, one writes #E(Fp) = (1 − α)(1 − β), where αβ = p and α + β = 1 + p − #E(Fp); here p = 3 and E is the curve in question. Hence α + β = 4 − 5 = −1. We are looking for #E(Fp 3 ), which is then (1 − α^3 )(1 − β^3 ) = 1 + p^3 − (α^3 + β^3 ) = 28 − (α^3 + β^3 ). Now −1 = (−1)^3 = (α + β)^3 = α^3 + β^3 + 3αβ(α + β) = α^3 + β^3 − 9, so that α^3 + β^3 = 8. Hence the answer is 28 − 8 = 20.

  1. We continue some calculations begun in problem 4 of the second midterm:

sage: p=251; R=Integers(p); g = R(6); h= R(242) sage: log(R(2),g); log(R(3),g); log(R(5),g) # cf. solutions to MT 235 16 130 sage: for i in range(15): # 15 is around the square root of p ... print(i, h*g^(-i)) (0, 242) (1, 124) (2, 188) (3, 115) (4, 61) (5, 52) (6, 176) (7, 113) (8, 228) (9, 38) (10, 90) (11, 15) (12, 128) (13, 105) (14, 143)

Square the number to get a(p+1)/^2 = a(p−1)/^2 · a. Because a is a square, the first factor is 1 by Fermat’s Little Theorem.

c. Suppose now that p ≡ 5 mod 8. Show that a(p−1)/^4 is either +1 or −1. In the former case, show that a(p+3)/^8 is a square root of a mod p.

If you square a(p−1)/^4 , you get a(p−1)/^2 , which is 1 (as we just said). Hence a(p−1)/^4 must be a square root of 1, i.e., either +1 or −1. Assume that it’s +1 and square a(p+3)/^8. The result is a(p+3)/^4 = a · a(p−1)/^4 = a.

d. In the latter case, show that 2a · (4a)(p−5)/^8 is a square root of a mod p.

If you square the number, you get 4a^2 · 4 (p−5)/^4 · a(p−5)/^4 = 2(p−1)/^2 · a · a(p−1)/^4 = − 2 (p−1)/^2 a. However, 2 (p−1)/^2 = −1 by quadratic reciprocity, so the product simplifies to a. If you have studied the Tonelli–Shanks algorithm, you know that you start the algorithm by finding a non-square mod p. In general, you pick a random number mod p, check to see whether it’s a non-square and then move on to another random number if it’s in fact a square. In this situation, 2 is a non-square, so we don’t have to make random picks, and the equation p − 1 = 4 · (p − 1)/4 expresses p − 1 as the product of a power of 2 and an odd number.

  1. Roughly 0.8 percent of all 175-bit positive integers are prime. Imagine a test for primality that returns “prime” for 7 percent of composite numbers and 90 percent of prime numbers; it returns “composite” otherwise. (Thus the test issues false positives and false negatives.) If a 175-bit positive integer is declared to be prime by this test, what is the probability that the integer is indeed a prime number?

[This problem is a paraphrase of a question about medical testing that was discussed in an April 15 New York Times blog post “Chances Are” by the Cornell mathematician Steven Strogatz. The blog explains that most doctors got the question wrong; one doctor became “visibly nervous” when seeing it. You can do better—Go Bears!]

Our probability space Ω is the set of 175-bit positive integers with the uniform distribution. Let’s consider the following two events: T is the set of integers in Ω that the test says are prime; A is the set of integers in Ω that are actually prime. Let C (for “composite” or “complement”) be the complement of A in Ω. Our

aim is to calculate the conditional probability Prob(A|T ) = Prob(A ∩ T ) Prob(T )

We have Prob(T ∩ A) = Prob(T |A) Prob(A),

where both factors are known to us. Similarly,

Prob(T ∩ C) = Prob(T |C) Prob(C),

and again both factors in the product are given to us in the problem. Also,

Prob(T ) = Prob(T ∩ A) + Prob(T ∩ C)

because T is the disjoint union of the two subsets in question. Hence we know both the numerator and denominator of the fraction Prob(T ∩ A) = Prob(T |A) Prob(A) and can thus get the answer by subsituting in numbers.

If I’m not mistaken, Prob(T ∩ A) = 0. 9 · 0 .008 and Prob(T ∩ C) = 0. 07 · 0 .992, so that

Prob(T ) = 0. 9 · 0 .008 + 0. 07 · 0 .992 = 0. 07664.

Thus our answer is (0. 9 · 0 .008)/ 0. 07664 ≈ 0 .0939, which is a little over 9.3 percent. Of course, you don’t have to simplify your answer, so writing the probability as a fraction involving a product and a sum of products is fine.