March 2017

Substitution cipher involves replacing one or more entities (generally letters) in a message with one or more other entities.

There are several types of substitution cryptosystems:

**Monoalphabetic substitution**involves replacing each letter in the message with another letter of the alphabet**Polyalphabetic substitution**involves using a series of monoalphabetic ciphers that are periodicially reused**Homophonic substitution**makes it possible to have each letter of the plaintext message correspond to a possible group of other characters**Polygraphic substitution**involves replacing a group of characters in the message with another group of characters

This encryption code is one of the oldest, in that Jules Caesar used it. The encoding principle is based on the addition of a constant value to all of the message's characters, or more precisely to their ASCII code (for a "computer" version of this encoding).

It is simply a question of shifting all the values of the message's characters by a certain number of positions, that is, of substituting each letter with another if you like. For example, by shifting the message "*COMMENT CA MARCHE*"
by 3 positions, we obtain "*FRPPHQW FD PDUFKH*". When adding value gives a letter after Z, we can simply continue by starting from A, which means we carry out a *modulus 26*.

As an example, in the film *2001: A Space Odyssey*, the computer was named *HAL*. This nickname is in fact *IBM* shifted 1 position down...

The character corresponding to the value added to the message for encryption is called the key. In our case the key is C, since it is the 3^{rd} letter of the alphabet.

This encryption system is indeed easy to implement but its disadvantage is that it is totally symmetric, which means that a simple substraction can be performed to find out the initial message. A basic method may involve a simple substraction of the numbers 1 to 26 to see whether one of these numbers gives an intelligible message.

A more advanced method involves calculating how often letters appear in the encoded message (this becomes easier the longer the message is). Depending on the language, some letters are used more frequently than others (in French, for example, the letter E is used the most), so the letter appearing the most often in a text encrypted using the Caesar cipher will most likely correspond to the letter E, and a simple substraction gives the encryption key...

In the specific case of a Caesar cipher where the encryption key is N (13^{th} letter of the alphabet), this is referred to as ROT13 (the number 13, one-half of 26, was chosen to be able to easily encrypt and decrypt textual messages).

Cifrado de sustitución

Chiffrement par substitution

Cifrario a sostituzione

Codificação por substituição