Name: Cryptography Math 1580 Silverman First Hour Exam Mon Oct 2, 2017 INSTRUCTIONS Read Carefully Time: 50 minutes There are 5 problems. Write your name legibly at the top of this page. No calculators or other electronic devices are allowed. (You won t need them.) When a box is provided, please put your answer in the box. Show all your work. Partial credit will be given for substantial progress towards the solution. No credit will be given for answers with no explanation. Problem Value Points 1 20 2 15 3 20 4 20 5 15 Total 90
Math 1580 Solutions for First Hour Exam Page 1 Problem 1. (20 points) (a) Let a, b, c, d, m be integers with m 1, and suppose that Prove that a b (mod m) and c d ac bd (b) Let a and b be integers with gcd(a, b) = 14, and suppose that you are told that 2 a 1 (mod m), and 2 b 1 What are all of the possible values for 2 14 (mod m)? Be sure to explain your answer. 2 14 Solution. (a) By definition of congruence we know that a = b + mi and c = d + mj for some integers i and j. Then ac = (b + mi)(d + mj) = bd + mid + mjb + m 2 ij = bd + m(id + jb + mij). Thus ac bd is a multiple of m, so by definition of congruence, ac bd (b) We know that we can find integers u and v so that au + bv = gcd(a, b) = 14. Then we can compute 2 14 2 au+bv (2 a ) u (2 b ) v ( 1) u ( 1) v ( 1) u+v So we get 2 14 1 (mod m) if u + v is even, and we get 2 14 1 (mod m) if u + v is odd, so 2 14 ±1 However, since 14 = gcd(a, b), we know that 14 a, say a = 14k. Hence if 2 14 1 (mod m), then 1 2 a = (2 14 ) k 1 k 1 This shows that we cannot have 2 14 1 (mod m), and thus the only possible value is 2 14 1 (mod m). Problem 2. (15 points) (a) State the Discrete Logarithm Problem for F p. (b) State the Diffie-Hellman Problem for F p. (c) What is the definition of a One-Way Trapdoor Function.
Math 1580 Solutions for First Hour Exam Page 2 Solution. (a) Given the values of g and h, the Discrete Logarithm Problem asks for the value of x that solves the equation g x = h in F p. Equivalently, given the values of g and g a, find the value of a. (b) Given the values of g, g a, and g b in F p, the Diffie-Hellman Problem asks for the value g ab mod p. (c) A One-Way Trapdoor Function is a one-to-one function f with three properties: (1) f is easy to compute. (2) f 1 is hard to compute. (3) If one knows an extra piece of information, then f 1 is easy to compute. Problem 3. (20 points) (a) The following table gives names to various powers of a modulo m. What is the value of a 646 modulo m? Write your answer in terms of A, B, C,..., J. a A (mod m) a 25 F (mod m) a 2 B (mod m) a 26 G (mod m) a 22 C (mod m) a 27 H (mod m) a 23 D (mod m) a 28 I (mod m) a 24 E (mod m) a 29 J (mod m) a 646 (b) Here are some values of powers of b modulo 101. b 2 6 (mod 101), b 16 87 (mod 101), b 58 17 (mod 101). Using these values, compute the value of b 10000004 modulo 101. You may use the fact that 101 is prime. Explain how you arrived at your answer. b 10000004 (mod 101). (Hint. You should be able to do part (b) of this problem very quickly.) Solution. (a) The binary expansion of 646 is Hence 646 = 512 + 128 + 4 + 2 a 646 = a 512 a 128 a 4 a 2 = a a9 a 27 a 22 a 21 = J H C B
Math 1580 Solutions for First Hour Exam Page 3 (b) Since p = 101 is prime, Fermat s Little Theorem says that b 100 1 (mod 101). (This is true unless 101 divides b, but we can t have 101 b, since then b 2 would be 0 modulo 101, and we re told that it s 6.) So raising both sides of the congruence to the 100000 th power gives b 100 1 (mod 101) b 10000000 1 (mod 101). Finally, multiplying this last congruence by b 4 and using the given value of b 2, we find that b 10000004 b 10000000 b 4 1 b 4 (b 2 ) 2 6 2 36 (mod 101). Problem 4. (20 points) Bob and Alice agree to use the prime p and the number g modulo p. (a) Bob and Alice decide to exchange a key using Diffie-Hellman Key Exchange. Bob chooses the secret value b. He receives the value A from Alice. What value should Bob send to Alice? Bob sends Alice the number What should Bob compute to get the secret shared value that he and Alice both know? Bob computes the value (b) Bob and Alice decide to communicate using ElGamal Public Key Encryption. Alice s public key is the number A. Bob wants to send Alice the plaintext m. What is the ciphertext that Bob sends to Alice? Bob sends Alice the ciphertext Alice receives a ciphertext from Bob. Her secret exponent is a. What does Alice compute to recover Bob s plaintext? Alice computes
Math 1580 Solutions for First Hour Exam Page 4 Solution. (a) Bob sends Alice the value g b (mod p). Bob and Alice s shared secret value is A b (mod p). (b) Bob sends Alice the pair of values c 1 g k (mod p) and c 2 ma k (mod p), where k is a number that Bob chooses randomly. Alice computes (c 1 1 ) a c 2 (mod p) to recover Bob s plaintext m. Problem 5. (15 points) Use Shank s Babystep-Giantstep Algorithm to solve the Discrete Logarithm Problem g x h (mod p) with p = 3571, g = 79, and h = 2421. Here is some information that you can use. g N 1 (mod p) with N = 714, so we set The number g satisfies n = N + 1 = 27 and compute b g n 1642 (mod p). And here is a table with values of g k mod p and h b k mod p. k g k h b k k g k h b k 1 79 759 9 2772 2209 2 2670 3570 10 1157 2613 3 241 1929 11 2128 1775 4 1184 3512 12 275 614 5 690 3110 13 299 1166 6 945 90 14 2195 516 7 3235 1369 15 1997 945 8 2024 1739 16 639 1876 Using this information, find a value of x that solves (Be sure to show your work.) 79 x 2421 (mod 3571). x =. Solution. Looking at the table, we find that 945 appears in both the g k column and the h b k column. More precisely, we have g 6 945 (mod p) and h b 15 945 (mod p), and thus g 6 h b 15 (mod p). Since b g n g 27 (mod p),
Math 1580 Solutions for First Hour Exam Page 5 this gives g 6 h g 27 15 h g 405 (mod p). Multiplying both sides by g 405 gives g 411 h (mod p), so x = 411.