Since the old times people felt the need to secure communications from enemies, competitors and maybe spouse.
Encryption is one of the techniques used to gain security in communications: the text is changed in a way that only the addressee knows.
Julius Caesar (100 BC – 44 BC) used to communicate with his generals via a simple cipher: each letter is substituted by the one n places forward in the alphabet. This can be achieved by using a cipher disk like the one you can see here.
Example: Let’s take a shift of 6 steps, the mapping becomes:
It’s not hard to break such a code: in the worst case we must check 26 positions.
Let’s improve it then: we can scramble the alphabet, mapping each letter to a different one. This is called a monoalphabetic cipher.
To be useful for us, the scramble won’t be totally random, then we can choose a keyword easy to remember (and to share with our correspondent).
The first alphabet letters are mapped to keyword letters, the others are mapped to the remaining letters of the alphabet.
Be careful: duplicate letters must be removed from the keyword or the encoded message becomes useless.
Example: Let’s take “Chandrasekhar” as keyword, removing duplicates we obtain “chandrsek” and the mapping is:
Both Caesar and monoalphabetic ciphers are good against lazy people: they see a non-sense and give up. A cryptanalyst can easily break it: each language has its own frequency of letters, changing a letter with another one don’t change the frequency and then it’s easy to decode the text (if it’s long enough).
Let’s do an example: taking a piece of this post and applying a monoalphabetic cipher (with keyword unknown to you) we obtain:
Frequency analysis says e is the most common letter in English, t is the most common letter in the scrambled text then we can map it back to e. Repeat the analysis for all the letters and at last you can tell me which is the keyword.
In the next days I will post about a technique resistant to frequency analysis.
Content is released under Creative Commons License.