MATH220_Tutorial1_sols
MATH220_Tutorial1_sols
Tutorial 1
1. (a) Eve finds the ciphertext bob which was encrypted using a Caesar cipher. Explain
why the plaintext was not eve.
(b) Eve finds the ciphertext ale which was encrypted using an affine cipher. Explain
why the plaintext was not bob.
(c) Eve finds the ciphertext mvwzxmswder which was encrypted using a Vigenère cipher
with key key. Decrypt the message.
Solution:
42 = 7 × 5 + 7
7=1×5+2
5=2×2+1
4. Voting with numbers. Suppose a 15-person committee has to vote to approve the
Prime Minister’s executive order. Members prefer to keep their votes anonymous. The
following is a method for voting in which everyone votes Yes, No, or Abstain, but simul-
taneously ensures each vote is kept secret.
The commitee Chair takes a blank piece of paper, writes a large number, say 5963,
on it, and passes it on to the next member. In turn, that member adds 16 for Yes, 1 for
No, and 0 for Abstain to this number, and writes the new number on a blank piece of
paper and passes it on to the next member to repeat. This process continues until the
Chair receives a number from the last member on the committee, at which time they
add 16 for Yes, 1 for No, or 0 for Abstain.
(a) Suppose the final sum is 6096. How many Yes votes, No votes, and Abstain votes
were cast?
(b) Why count a yes vote as 16? Would 15 work too?
(c) Determine all possible positive integers for which a yes vote with that value does
not work (that is, if a yes vote has that value, then the Chair cannot uniquely
determine the number of votes for yes/no/abstained).
Solution:
(a) First calculate 6096-5963=133, which is the total number added by committee
members. We see that
133 = 8 · 16 + 5,
so there were 8 votes Yes, 5 votes No, and the remaining 2 votes abstained.
(b) This doesn’t work because we cannot see the difference between 1 yes vote and 14
abstained (which totals 15) or 15 no’s.
(c) Suppose that a Yes vote is given by the integer a. If there are x yes votes and
y no votes (and 15 − x − y abstainances), the total number added is ax + y.
We need to make sure that we can retrieve x and y from ax + y. Suppose that
ax + y = ax0 + y 0 , then
a(x − x0 ) = y 0 − y.
We need to find the values of a such that this equation only has the solution
x = x0 , y = y 0 . Now y − y 0 lies in between −15 and 15, and a(x − x0 ) = y 0 − y
says that y − y 0 is a multiple of a. So if we choose a > 15, then there certainly
cannot be a solution different from (x, y) = (x0 , y 0 ).
Is there any choice smaller than 16 that still works? No! It is clear that we can
never distinguish between 1 yes vote with value a and zero no votes and zero yes
votes and a no votes.
5. (a) Write down the 5 × 5-array for the Playfair cipher using the key mathematics
(b) Use this Playfair cipher to encrypt the plaintext saturday.
MATH220-25S1 Tutorial 1 3
(c) What happens if you encrypt the ciphertext obtained in (b)? Will this phenomenon
always occur? Explain.
Solution:
(a)
m a t h e
i/j c s b d
f g k l n
o p q r u
v w x y z
(b) We split as sa tu rd ay. sa defines the rectangle with corners c and t. Similarly,
we find that tu becomes eq, rd becomes ub and ay becomes hw. So we find the
ciphertext ctequbhw.
(c) When we encrypt the ciphertext ctequbhw we find the plaintext saturday back.
This makes sense because if we take two letters from different rows and columns,
it defines an involution, that is, if we encrypt these two letters and then encrypt
again, we find the original letters back. However, this does not hold true when we
encrypt two letters from the same row: for example, the word math is encrypted
as athe, and if we encrypt athe we find them.
6. Find gcd(299, 247) and all integer solutions of the equation 299m + 247n = 13.
Solution:
Using Euclid’s Algorithm,
299 = 1 × 247 + 52
247 = 4 × 52 + 39
52 = 1 × 39 + 13
39 = 3 × 13 + 0
13 = 52 − 39
= 52 − (247 − 4 × 52) = 5 × 52 − 247
= 5 × (299 − 247) − 247
= 5 × 299 − 6 × 247
m = 5, n = −6.
The equation is the same as 23m + 19n = 1 (dividing by the gcd). So the general
solution is
m = 5 + 19t, n = −6 − 23t,
where t is an integer.
MATH220-25S1 Tutorial 1 4
n ≡ 0 1 2 3 4
n2 ≡ 0 1 4 4 1
2
n +n ≡ 0 2 1 2 0
3(n2 + n) ≡ 0 1 3 1 0
3(n2 + n) + 1 ≡ 1 2 4 2 1
are all composite. (This shows that there are arbitrarily large gaps between primes.)
Solution:
If j is an integer between 1 and n + 1, then, since
(n + 1)! = (n + 1) · n · (n − 1) · · · j · · · 1,
10. (A good question for when you have time to spare!) You are a well-known
cryptanalyst and you have just received the following memo.
Memo:
To: Hut 6d, Bletchley Park
From: Col. W.T. Tutte1 , Military Attache
This message was received by an intercept station in Scotland. The frequency and
format indicate that it is a most urgent message from one of our agents who landed a
1
A pioneer of modern-day graph theory, find out about W.T. Tutte and his cipher breaking during the
second world war.
MATH220-25S1 Tutorial 1 5
week ago in Norway. His controllers have been unable to read it. Although it clearly uses
his backup cipher, the Playfair, the keys assigned to him do not work. We cannot reach
him before his normal scheduled transmission in three weeks, so we urgently request that
you attempt to decrypt this and let us know the contents. In case it helps, he is carrying
materials to assist a previously dropped team in their work regarding the Norsk Hydro
facility at Rjukan. His recognition code might appear in the message: It is “beware ice
weasels”. If he is operating under duress, he will not use it and instead will include the
phrase “red penguin frenzy”. He will use “stop” between sentences and “end” at the
end.
Received message: FVLYP IPGLU LYPQH FFSDE MDHEV OKNCB GEPSM FNCKY GSSBU
PURKI UFOHH QZRYS FUHEL CXSAP BUOVA EIFYL UPWED SWGFK ZBFGE GUIHL UPQEU
FPUBD KBOVK YFTZP QUMRB OLUHN NHNRW MAQPA BCFIP SMHKB UHEDO VHEMO SGIFB
CFKVU GBBGK CXXXX
Hints
The Playfair cipher has two characteristic properties which are of great use in deciphering.
(a) Check which (if any) of these four possibilities can occur.
(b) Consider the possible segmentations of the phrase “red penguin frenzy” and, as
before, find any allowable ones. Use the information you now have, to construct
as much of the Playfair square as you can.
(c) Find the original key phrase and decipher the whole message.
MATH220-25S1 Tutorial 1 6
Solution:
The key phrase is
a r c h i m e d e s and the message reads