The Caesar cipher

In cryptography, the Caesar cipher is one of the oldest cryptographic algorithms of which there is a historical trace.

It is a mono-alphabetic substitution cipher, in which each letter of the plain text is replaced, in the ciphertext, by the letter found a certain number of positions later in the alphabet.

These types of ciphers are also called substitution ciphers or sliding ciphers because of their way of operating: substitution occurs letter by letter, scrolling the text from start to finish.


The story of the Caesar cipher

The Caesar cipher is named after Julius Caesar, who used it with the intent of protecting his encrypted messages.

There is very little information on Roman cryptography: the only notions concern the fact that Julius Caesar and Augustus used this particular encryption system in their correspondence with family members.

Only Suetonius, in the Life of the Twelve Caesars, a work of the 2nd century AD, provides us with information.

Thanks to this important historian, we know that Caesar generally used a key of 3 for the cipher, as in the case of the military correspondence sent to the troops commanded by Quintus Tullius Cicero.

Suetonius recounts that Julius Caesar used a very simple mono-alphabetical number for his confidential correspondences, in which the clear letter is replaced by the letter that follows it three places in the alphabet: the letter A is replaced by D, the B by E and so away until the last letters which are encrypted with the first ones as in the following table (which refers to today’s international alphabet).

At the time it was safe because opponents often weren’t even able to read a plaintext, let alone an encrypted one; moreover, there were no cryptanalysis methods capable of breaking this code, however trivial.

We also know others who used this cipher at the time of Caesar: Augustus, his nephew, used it with key 1, but without starting from the left in case of the end of the alphabet. So, he wrote B for A, C for B but used AA for Z.


Developments in use

Since the discovery of frequency analysis by the Arab mathematician Al-Kindi around the 11th century, all ciphers of this type have become very easy to break.

In fact, none of these are suitable for secure communications in today’s technological state, nor have they been for the past 1000 years.

However, a form of this cipher, called ROT13, is still used today to obfuscate parts of a message so that they are not immediately understandable.

Over time, this encryption technique has been used by numerous personalities, including Mary Stuart, Queen of Scotland of the sixth century, and Bernardo Provenzano, a famous Mafia boss.


Description of the cipher

Caesar used a shift of 3 positions (the key, that is what indicates how far to move was therefore 3), according to the following scheme in the classical Latin alphabet, which had 23 characters:

Plain text: a b c d e f g h i k l m n o p q r s t v x y z

Ciphertext: D E F G H I K L M N O P Q R S T V X Y Z A B C

The same can be done with the extended Latin alphabet, which has 26 characters:

Plain text: a b c d e f g h i j k l m n o p q r s t u v w x y z

Ciphertext: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

To encrypt a message, simply take each letter from the plain text and replace it with the corresponding letter from the ciphertext line. To decipher, vice versa.

Encrypting (and decrypting) the text several times does not improve security, as a rotation of A places followed by B places equals one of A+B.


The mathematical functioning of the Caesar cipher

Mathematically speaking, the encryption with the various keys forms a group.

For an alphabet of N characters, N Caesar ciphers with displacement s<N are possible; or better it would be to say N−1 ciphers, seen for s=0 we have an identical cipher which returns the clear text; mathematically the Caesar cipher is reduced to a module addition N; called x the clear letter, the encrypted letter y is: y=x+s (mod N).

It follows that from the point of view of cryptanalysis, the Caesar cipher is very weak since there are only 25 different non-trivial ciphers if the contemporary Latin alphabet with 26 letters is used, 19 if the classical Latin alphabet with 20 letters is used.



As mentioned above, this cipher is described by Suetonius, from whom it is understood that Caesar used it for his private communications.

There is no other historical information on its possible use in the course of Roman history, apart from the variant used by Augustus, always described by Suetonius.

Basically, there is no news of a systematic use of figures by the ancient Romans.

In the Middle Ages there are examples of encryption with even weaker methods, in particular the encrypting only vowels one, according to schemes such as A=X, E=XX, I=XXX, O=XXXX, V=XXXXX, and later A=1, E=2, I=3, O=4, V=5.