Monoalphabetic Cipher

142 Views Asked by At

I am not sure how to get the key for the following Monoalphabetic Cipher question. This is a textbook question and I know the answer, but I juts dont know how they got the key.

Question:

Decrypt the following Cipher texts, and give the key.  (Note that the correct key is the En-
cryption key, so if F changes to H and F is the plaintext, then the key is “C”):

(a) YRRYAIYRMLAC (b) DOBXQPZELLI

Answer: a) Text:ATTACKATONCE Key = X b) Text: GREATSCHOOL Key = A

Can somone please explain to me how to determine the key?

1

There are 1 best solutions below

3
On

Option (a): brute force. Write a program that prints all 26 variants, find one which is human-readable. For texts this short it's probably the best approach.

Option (b): automatic frequency analysis. Write a program that counts frequency of each letter, then takes typical frequencies for the language and finds a shift where difference between these two 26-component vectors is minimal. Works wonders for longer cyphers.

Option (c): bigrams (two-letter combinations). Take big enough text, write a program (yes, again) which counts all 2-letter combinations, and among each shift group (for example, "ab, bc, cd, de, ef, ..., za" is such group) finds the most frequent pair. Then take two or three shift groups where there's a major leader. Then, for the text, try finding a bigram of such group and try a key corresponding to the leader.