UNIVERSITY OF EAST ANGLIA School of Mathematics May/June UG Examination 2010 2011 CRYPTOGRAPHY Time allowed: 2 hours Attempt THREE questions. Candidates must show on each answer book the type of calculator used. Only calculators permitted under UEA Regulations may be used. Notes are not permitted in this examination. Do not turn over until you are told to do so by the Invigilator. Copyright of the University of East Anglia
- 2 - Note: General theorems from lectures can be used if they are stated clearly. A theorem can be used without proof unless you are required to give a proof. 1. Let n > 1 be an integer. For a, b {0,...,n 1} we set f a,b : Z/nZ Z/nZ x ax + b. (i) What is an affine permutation of Z/nZ? Show that f a,b is an affine permutation if and only if gcd(a, n) = 1. (ii) Let f a,b be an affine permutation which is not a shift transformation (i.e. a 1 mod n). (a) Prove that if n is prime then f a,b has at least one fixed point. (b) Prove that if b = 0 and n is even then f a,b has at least two fixed points. [Hint: Show first that (a 1) must be even.] (iii) We represent the 26 letters of the alphabet by the numbers 0, 1,..., 25 so that a plaintext can be seen as a sequence of residues modulo 26. (a) Define an affine substitution cipher. Describe a general method to break such a cipher. (b) Decrypt the following message which has been encrypted using an affine substitution cipher. NJINA ZD GWN ENDG (c) Alice has been told that using an affine substitution cipher is unsafe and she has therefore decided to encrypt her message twice using two different affine substitution ciphers. Does that make her message harder to decrypt? Justify your answer. [2 marks]
- 3-2. (i) (a) Define Euler s Phi function ϕ and state Euler s Theorem. (b) Let N = pq be a product of two distinct primes p and q. Explain how the RSA cryptosystem with modulus N can be broken if ϕ(n) is known. Illustrate the previous idea by factorising 9167, given that it is a product of two primes and ϕ(9167) = 8976. [5 marks] (ii) Explain briefly how the RSA system works. Give an example by encrypting the message [3,20] using the public key (65, 5) and by decrypting it. [8 marks] (iii) Let n = pq be a product of two distinct primes. Let y, d {0,...,n 1} and assume that gcd(y, n) = 1. Let d p d mod p 1 and d q d mod q 1. Let M p q 1 mod p and M q p 1 mod q. Finally we set x p y dp mod p, x q y dq mod q, x M p qx p + M q px q mod n. Using the Chinese Remainder Theorem, show that x y d mod n. Explain briefly why this can be used to speed up the computation of y d mod n. PLEASE TURN OVER
- 4-3. (i) Let n > 1 be an integer and let p be a prime number. (a) Let a be an integer coprime to n. Define what is meant by the order of a modulo n. What is a primitive root modulo p? How many primitive roots modulo p are there? (You do not need to justify your answer.) (b) Show that 3 is a primitive root modulo 19, and draw up a table giving the values of log 3,19 (a) for all nonzero residues a modulo 19. (c) Let b be a primitive root modulo p. Show that the set {b 0,...,b p 2 } is a reduced system of residues modulo p. (ii) State the Diffie-Hellman problem and explain how this problem can be used to exchange keys over an insecure channel. [8 marks]
- 5-4. The Secret Society of SilverSmiths encrypts messages as follows. They use a 29-letter alphabet in which A Z have numerical equivalents 0 25, space=26,?=27 and!=28. Thus each message is identified with a sequence of residues mod 29. Adding a space at the end if necessary we can assume that each plaintext has the form a 1 a 2... a 2k 1 a 2k. The encryption key is an invertible two by two matrix ( ) a b A = M c d 2 (Z/29Z). The message sender computes ( t2i 1 t 2i ) = ( ) ( a b a2i 1 c d a 2i for each i from 1 to k and then obtains the ciphertext as the alphabetical equivalent ) of b 1 b 2...b 2k 1 b 2k where b i t i mod 29. ( ) 0 5 (i) Assume that the encryption key is 11 1 (a) What is the ciphertext for FRIDAY?. (b) Decrypt the message MBPBEY (in plain english). [6 marks] (ii) Why is it important that the matrix A is invertible? Explain why is it important to have many different encryption keys. (iii) Let p be a prime number. Find the number of invertible matrices modulo Z/pZ in the following two ways and check that your answers agree: Count the number of matrices B M 2 (Z/pZ) such that det(b) 0 mod p and subtract this number from the number of elements in M 2 (Z/pZ). Use linear algebra over the finite field Z/pZ. How many different keys are there in the SilverSmiths cryptosystem? [7 marks] END OF PAPER