Islander Math Circles Saturday, April 27, 2013 Cryptography 1. The Die Hard Jug Problem: Fill a jug with exactly 4 gallons of water using only a 3 gallon and a 5 gallon jug. Why? Solving the problem will defuse a bomb! Discussion of the mathematics leading to general question: Given positive integers a and b, for which integers c can you find integers x and y with c = ax + by 2. Modular Arithmetic: With a fixed number n, take the set {0, 1, 2, … , n-1}, the remainders (mod n) Given any integer, we can subtract a multiple of n to get one of the numbers in the set. Stated another way, given any integer, we can subtract one of those to get a multiple of n. We can do addition and multiplication in meaningful ways with the those remainders. A couple of problems: Are there any perfect squares in the sequence 3, 8, 13, 18, …? Are there any integers x, y satisfying x2 – 7y2 – 24 = 0? 3. Cyptography: The shift-cypher The letters A to Z are labled 0 to 25, the remainders (mod 26). We could have more characters, including spaces. Note that simply writing letters as numbers is encoding but not encryption. We will do encryption using a shift-cypher. Calculations done on the encoded remainders, c, are of the form E(c) = a*c + b (mod 26). E(c) is called the encryption of c. Can E(c) be unencrypted? Can you find d, e with U(c) = E(c) *d + e with U(E(c))) = c? See the worksheet on the next page. Write a statement of at least 10 characters Encode it using the table at the top of the page Encrypt each encoding using the given formulas based on a, b. Create encrypted text using the coding to go back from numbers to letters. Can you unencrypt your numbers? Can you find d, e as above? For discussion, what are the essential criteria for a good encryption? A 0 B 1 C 2 D 3 E 4 F 5 G 6 H 7 I 8 J 9 K 10 L 11 Parameters for encryption: a = _______ and b = _________ Clear text Coded Numbers Encrypted numbers Encrypted Text Decrypted Numbers M 12 N 13 O 14 P 15 Q 16 R 17 S 18 T 19 U 20 V 21 W 22 X 23 Y 24 Z 25 Parameters for decryption: d= __________, e = ____________ 4. Finding multiplicative inverses (mod n). The remainder b is the multiplicative inverse of a means a*b = 1 (mod n) As an equation of integers, this means a*b = 1 + a multiple of n, or Given a, n, can you solve the equation a*b + n*y = 1 for b, y Possible problems that can be solved: o The jug problem, but which ones? o Can you use a 4 gallon and a 6 gallon jug to get exactly 5 gallons? o I have nickels and quarters adding to 65 cents. How many of each can I have? o If you have one solution, can you find others? 5. Cancellation of remainders (mod n) For which numbers n (and a,b,c) can you guarantee that ac = bc (mod n) implies a = b (mod n) 6. Fermat’s Little Theorem What is it? Prove that 22225555+55552222 is a multiple of 7 7. RSA Coding Suppose p and q are prime numbers and e is relatively prime to (p-1)(q-1). The numbers pq (the product, not factors) and e are publicly known. Then E(x) = xe (mod pq) is an encryption of the integers relatively prime to pq.