Substitution cipher

Substitution cipher

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

Caesar cipher

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 3rd 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...

ROT13 encryption

In the specific case of a Caesar cipher where the encryption key is N (13th 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).

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Substitution cipher », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!