Tuesday, February 2, 2016

WW2 Ciphers Part 3: Using A Daily Key



In the example above I used a daily key of {0,2,5,2}. At least one virtual wheel will turn each time a letter is ciphered, and that will produce a completely different wheel cipher byte. The table below shows what this looks like. The wheel cipher changes every letter.

Wheel Setting {0,2,5,2}
Plain text (Ascii)
Wheel Cipher
Cipher Text
69
135
194
108
172
192
32
185
153
77
215
154
97
237
140
99
151
244
104
57
81
111
171
196


Input
Output
A
B
A φ B
0
1
1
1
0
1
1
1
0
0
0
0

The principle of reciprocity is important, you can change the order of A and B and get the same results, the process of encrypting and decrypting is mathematically the same for this cipher. To encrypt we take plain text φ key = cipher text. Because of reciprocity we decipher by the formula key φ cipher text = plain text. You could even compute the key from the cipher text and plain text (plain text φ cipher text = key). The Tunny machine was completely cracked years before they even saw the machine or the wheels. A library of cipher texts and plain texts eventually allowed the code breakers to recreate the key sight unseen.

It's important to use a different wheel setting for each message. I know from my readings that messages which overlapped on the wheel settings were a key source when breaking the encryption. I figured I would have the most fun illustrating that concept by trying to break my own codes, so that will be the next post. I am working on a basic program for cracking using letter frequencies and I think it shows promise. Understanding this weakness will lead us to talk about the shortcoming of the daily key and why each message had an additional random message key.

Things to Try:

2. Try this online XOR (exclusive-or) calculator.