Reply To: Welcome
A Tale of 2 Secrets › Forums › T.E.M.P.E.S.T. › Welcome › Reply To: Welcome
@atharvdagoat 9a was encrypted with a Vigenère cipher using the keyword “TRAITOR”, and then reversed.
I broke it by first using a program I wrote that computes the periodic index of coincidence (pioc).
Supposing the period (keyword length) was 7, I would compute the IoC of a slice of the first character in every block of 7, and then the second, the third, and so on. This gives me 7 IoC values which I take the average of. Since each 7th letter is encrypted using the same (caesar) shift, this average IoC value (pioc) was 0.06440, which tells me that this is the right period.
Of course, I didn’t know the period ahead of time, so my program plots the pioc values for each period, and I took the first promising one. This works the same even when the text is reversed.
To be honest, I just tried to solve it as a normal Vigenère, noticed that didn’t work, then guessed it was reversed. A more analytical approach would be to solve the Vigenère as a bunch of independent Caesar ciphers (using single letter frequencies), then recognise the reversed words in the plaintext. The title of that challenge was “The Upside Down” (I approve 🙂 ) which was probably intended as a hint that the text was reversed.
9b was a Playfair cipher using atypical rules. Playfair uses a grid like this one (the key for 9B):
`
C O M P A
N Y B D E
F G H I K
L Q R S T
U V W X Z
`
It encrypts letters in pairs. The encryption rules used in this cipher were as follows:
- If the two letters you want to encrypt are the corners of a rectangle in the grid, take the other two corners. Each letter in the pair gets encrypted to the other corner in the same row.
- If the two letters are in the same row or column of the grid, encrypt each letter in the pair to the one on its right (wrapping around at the end).
So, if we look at the first few letters of 9b’s plaintext “CH AR LE SI” and ciphertext “MF MT TN RH”.
- “CH” forms the corners of a rectangle, so we take the other two corners: “MF”
- Likewise for “AR”
- Likewise for “LE”
- “SI” are in the same column, so we encrypt to the letter to the right of each one: “RH”
Decryption is performed by doing these same rules in reverse.
I solved this using an automated program which uses a similar approach to the algorithm Madness describes in their book. My program occasionally tries changing the rules for letters in the same column and row, so was able to solve this cipher.
You don’t need a program to break it though. As you probably noticed, the plaintext contains a bunch of X characters to break up repeated letters. The ciphertext contains no pairs of letters with repeats (out of the pairs starting at an even index in the ciphertext), it also only has 25 letters in its alphabet; these two facts tell you with pretty high confidence that it’s a Playfair cipher. You can then try to break it by looking at the most frequent pairs of letters (at even index); this will most likely be “TH”, “AT”, “HE”, and so on. Beyond that, you can look for cribs: “CHARLES”, “DICKENS”, and “LORD DERBY” are some good ones. Once you have one correct guess you get more and more letters, both in the plaintext and in the grid, and eventually you solve it.
You could also do a keyword search. As you can see, the alphabet is keyed with “COMPANY” (it appears that if you were following the content of the messages more closely there was a hint about this keyword in a copy of A Christmas Carol, I was not paying enough attention to notice this). There are three major strategies for filling a grid based on a keyword: “COMPANYBDEFG…” (go back to start of alphabet), “KEYWORDFG…” (continue from last letter of keyword), “CIPHERSTUVW…” (continue from max letter in keyword). You can try them all with a word list.
While it would have been tricky to guess the exact rule used in a keyword search, the majority of pairs (64% assuming uniform distribution) are encrypted using the rectangle rule, which is unchanged. So you would most likely have found the correct keyword, and then you could just go through the text by hand and figure out Harry’s trickery.