## Exercises4.6Exercises Set 8

###### 1.

Finish all investigations from in-class activities.

###### 2.

How many initial settings would there be for an Enigma where the rotors have 17 letters, there are 6 different rotors and the machine uses 4 of them, and 5 cables are used to make swaps in the plugboard?

###### 3.

Starting in February of 1942, German naval Enigma machines used four rotors. To get the fourth rotor into the same machines, a thinner reflector and a new rotor were designed to fit into the space of the previous reflector. There were two such reflectors and two such rotors that could be used. For the other three rotors there was a choice of eight rotors. A total of 10 cables were used to swap letters in the plugboard. How many initial settings are there without the plugboard? How many initial settings with the plugboard?

###### 4.

Use the ciphertext/plaintext pairing that you found in Exercise 4.3.5 determine the permutation $P_1$ that describes how the first letter is encrypted for the paper enigma with setting I,II,III AAA. For example, plaintext A goes to ciphertext B, so $P_1(A)=B\text{.}$ Fill in the table for $P_1$ below.

 PT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z CT B

###### 5.

Use the ciphertext/plaintext pairing that you found in Exercise 4.3.5 determine the permutation $P_2$ that describes how the letter in the second spot is encrypted for the paper enigma with setting I,II,III AAA. For example, plaintext I goes to ciphertext O, so $P_2(I)=O\text{.}$ Fill in the table for $P_2$ below.

 PT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z CT

###### 6.

Use the ciphertext/plaintext pairing that you found in Exercise 4.3.5 determine the permutation $P_3$ that describes how the letter in the third spot is encrypted for the paper enigma with setting I,II,III AAA. Fill in the table for $P_3$ below.

 PT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z CT

###### 7.

Convert the following from a base 26 representation to a decimal representation.

2. GOOD

3. SUPER

4. AWESOME

###### 8.

Convert the following from a decimal representation to a base 26 representation.

1. 31

2. 901

3. 3333

4. 28457

###### 9.

What base 26 “number” is XYZ+BB?

###### 10.

Let's use base 26 to do our first block cipher. Let the key be $k=$BARK.

1. Encipher THIS ISAB LOCK CIPH ERXX by adding the key to each group of 4 letters in base 26.

2. Decipher UIAC UHSD BNUW PRWH by subtracting the key from each block of 4 letters in base 26.

###### 11.

Decrypt GCS QCT VST VSG MBZ GCS QCT which was encrypted as a base 26 block cipher with the key $k=$ DOG. (Substract DOG from each group of 3 letters base 26.)

###### 12.

How many decimal digits in the largest 6 letter base 26 number?

###### 13.

Explain how to construct the permutation $P_1$ in Exercise 4.6.4 from the letter chains in Exercise 4.3.8. Explicitly use the letter chains and what you already know about $P_1$ to construct the permutation.

###### 14.

Explain how to construct the permutation $P_2$ in Exercise 4.6.5 from the letter chains in Exercise 4.3.8. Explicitly use the letter chains and what you already know about $P_2$ to construct the permutation.

###### 15.

Explain how to construct the permutation $P_3$ in Exercise 4.6.6 from the letter chains in Exercise 4.3.8. Explicitly use the letter chains and what you already know about $P_3$ to construct the permutation.

###### 16.

A set of repeated encryptions of three letter message keys for a fixed setting of the paper Enigma are: ARXVKB, BKEMPY, CWCXGV, DTJLHM, EQVBQA, FEUWWN, GCHOBT, HVTASH, IYSUCD, JLLDNI, KPIZRP, LFYJLE, MBBEMG, NOKYZL, OAMGVJ, PDWCDW, QXOKJX, RUDIYZ, SZQTTQ, TMRSOO, USNREU, VIFHXS, WHAFUR, XJGPIC, YGPNFF, ZNZQAK.

1. Construct the letter chains from first and fourth letters.
2. Construct the letter chains from second and fifth letters.
3. Construct the letter chains from third and sixth letters.
4. Given that the plaintext in all of these message keys is the same letter repeated six times, find the letter that corresponds to each ciphertext. Hint: use the letter chains.
5. Bonus: Find the initial setting of the rotors.
###### 17.

A plaintext/ciphertext pairing is given below. Find a complete menu for this crib.

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 T H E W E A T H E R I S W A R M A N D S U N N Y O P C E R W H V W X B A D T G Z D S I T T V Z K

###### 18.

Explain what each line of the following Sage code does.

###### 19.

Practice with exponents and modular arithmetic.

1. Explain what each line of the following Sage code does.

2. Compute $2^n \pmod{n}$ (reduce it to the smallest positive number mod n) for $n=5,6,7,8,9,10\text{.}$ How do you adjust the given code to do this? Is it true that $2^n \equiv 2^0 \pmod{n} \text{?}$

3. Compute $2^x \pmod{5}$ for $x=0,1,2,3,4,5,6.$ How do you adjust the given code to do this? What do you notice?

4. Compute $2^x \pmod{6}$ for $x=0,1,2,3,4,5,6.$ What do you notice?

5. True or False: If $x \equiv y \pmod{n}$ then $2^x \equiv 2^y \pmod{n}\text{.}$ If true, prove it. If false, provide a counterexample.

###### 20.

More practice with exponents and modular arithmetic.

1. Compute $4^2 \pmod{5}\text{.}$

2. Compute $5^2 \pmod6\text{.}$

3. Compute $6^2 \pmod7\text{.}$

4. Compute $7^2 \pmod8\text{.}$

5. Make a conjecture and prove it!

###### 21.

Watch Imitation Game and describe at least 3 references to cryptography or mathematics from the movie Imitation game. If possible, analyze whether or not they are historically accurate.

###### 23.

Write your own Sage code to convert a decimal number to a base 26 number. Use comments in your code to explain what each line is doing.