Cryptography Homework #1 Solutions 1) THE BRITISH ARE COMING THE BRITISH ARE COMING (Shift = 11) 2) THIS CIPHER TESTS WHETHER OR NOT SPACES MATTER (Shift=4) 3) FOR THOUSANDS OF YEARS KINGS QUEENS AND GENERALS HAVE RELIED ON EFFICIENT COMMUNICATION IN ORDER TO GOVERN THEIR COUNTRIES AND COMMAND THEIR ARMIES (a=15, b=9, for decryption, the encryption keys were a=7, b=15) 4) I HAVE PLACED A PRIZE IN THE BUILDING IN WHICH MY OFFICE IS AND GO NEAR ROOM TWO FOUR SIX THERE YOU WILL FIND A FIRE DEPARTMENT VALVE LOOK INSIDE OF IT AND YOU WILL SEE YOUR PRIZE I AM HIDING THE PRIZE TUESDAY AFTERNOON GOOD LUCK (a = 9, b = 17 are encryption keys.) 5) study this paragraph and all things in it what is vitally wrong with it actually nothing in it is wrong but you must admit that it is most unusual do not just zip through it quickly but study it scrupulously with luck you should spot what is so particular about it and all words found in it can you say what it is tax your brains and try again do not miss a word or a symbol it is not all that difficult (a=5, b=12, for decryption, the encryption keys were a=21, b=8) 6) Our encryption function is as follows: f(x) = (7x + 12) mod 26 To find its inverse, replace f(x) with x and x with f-1(x): x = (7f-1(x) + 12) mod 26 x – 12 = 7f-1(x) mod 26 Since the modular inverse of 7 mod 26 is 15, our next step is as follows: 15(x – 12) = 15(7)f-1(x) mod 26 15x – 180 = f-1(x) mod 26 f-1(x) = (15x + 2) mod 26 7) We need to determine how many integers in [1, 39] are relatively prime to 40. 40’s distinct prime factors are 2 and 5. Thus, this list is as follows: 1, 3, 7, 9, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 37 and 39. There are 16 such values. It follows that the total number of possible keys for an affine cipher is 16 x 40 = 640.