Hide and seek

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:

abcdefghijklmnopqrstuvwxyz
ghijklmnopqrstuvwxyzabcdef

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:

abcdefghijklmnopqrstuvwxyz
chandrsekbfgijlmopqtuvwxyz

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:
lsfptmutgcomsdtlitgictetcmmutfttomgltpqktpgd
dqfsphmsgflekgdtftdstlpgditmsmgklhfodhxytligqlt

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.

Creative Commons License
Content is released under Creative Commons License.

Advertisements

3 comments on “Hide and seek

  1. Massimiliano says:

    «If he be Mr. Hyde, shall be Mr. Seek.» 😉

    About freq. analysis: I can’t understand how much it is effective, in example when the message is short and the frequencies may be quite different from the mean value in a language.

  2. gamma2 says:

    First, the key is usually applied to the first letters of the alphabet, then it’s useful to check their frequencies first.
    Second, each language has its own style, like recurring words. I.e. if you find “gfd” more than once, it may be “the”.
    Obviously you can’t decipher a text like “uxigmtfql” 😉

  3. […] Limit Decaying Omega minus particles « Hide and seek Hide and seek (part 2) October 13th, 2007 In a previous post I wrote about simple […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s