Despite being one of the simplest cryptographic methods, the Caesar cipher allowed Julius Caesar to protect his important messages from unauthorized eyes. It consists of replacing each letter of the message with another that is a fixed number of positions further along the alphabet, and although today it could be deciphered even by a child, 2000 years ago—in a world where few people could read and write—this mechanism was considered secure enough to entrust the safety of a state.

It is undeniable that the modern world has many more secrets to guard from prying eyes than it did 2000 years ago. This situation, where a company often possesses processes or the "recipe" to prepare compounds worth billions of dollars, has led to the development of automated mechanisms that allow anyone—including governments, companies, and individuals—to keep their important documents safe, even when the potential enemy also possesses formidable tools to try to breach the protections put in place. Gaius Julius Caesar, the military leader and politician who governed the Roman Republic shortly before the Christian Era, had nothing more advanced than a pen and papyrus at his disposal, yet he was able to devise an encryption system that, for the technological development of the time, was completely successful: the Caesar cipher.

The Caesar cipher

What does this system consist of? Simply, it involves creating a difficult-to-read text—the 'cipher text'—by making a series of simple changes to the original text. The Caesar cipher is often also called "shift cipher" or "Caesar shift", because the changes made consist solely of replacing each letter of the original text with another that is a fixed number of positions further along the alphabet. Although it can be applied with shifts of any value, Julius Caesar typically used a shift of three positions in almost all his messages.

The Caesar Cipher
ROT13 is the Caesar cipher with a shift of 13 places.

In this way, each A in the original text was replaced by a D—because it is three places to the right of A, each B was replaced by an E, and so on. When the letter to be replaced was close enough to the end of the alphabet that its replacement would "fall" outside it (for example, Y or Z), one started again from the beginning, as if the alphabet were "circular", continuing with A, B, C, etc., after X, Y, Z. Thus the encrypted alphabet would be constituted after applying the Caesar cipher with a value of 3:

The Caesar Cipher
Julius Caesar typically used a shift of three positions in almost all his messages.

To encode a message, one only needed to look up each letter of the original message in the table above and write the corresponding letter of the encrypted alphabet. When decoding the text, the same table was used but looking up each letter of the encrypted text in the original alphabet. Simple, but—for the time it was used—secure enough for the state to trust it to keep its secrets safe.

The Caesar Cipher
Today, a cipher like this would be quickly discovered.

Obviously, its effectiveness was based on the inability of most of Caesar's contemporaries to read or write. Today, a cipher like this would be quickly discovered. In fact, the Caesar cipher can be attacked by the brute force method, simply by taking a piece of the text and trying, one by one, all possible shifts allowed by the alphabet used (about 25 or 30, in general). When a text that makes sense is obtained, that shift is applied to the rest of the document and the problem is solved.

The Caesar Cipher
Interior of a German "Enigma" machine, used to encode texts.

Vigenère cipher

Today, no similar system is used, except in games or to teach children. But despite its simplicity, the Caesar cipher often forms part of more complex systems (such as the Vigenère cipher) or is used on Internet forums to hide from casual eyes the punchline of a joke, the solution to a riddle, or some offensive text.

In this context, the most used algorithm is the so-called ROT13, which is nothing more than the Caesar cipher with a shift of 13 places. It has been said that ROT13 is "the modern equivalent of the systems used in magazines that printed puzzle answers upside down." The method devised by Caesar can be improved in several ways. One of the most common, popularized around 1500, consists of shifting a different number of positions for each letter, giving rise to the so-called Vigenère cipher. The value of each shift is defined by using a repeating keyword. If the keyword were chosen at random and as long as the message, the resulting system would be, in theory, indecipherable.

The Caesar Cipher
This is the correct cipher. It found the error: "Navy".

The Caesar cipher on Wikipedia

The Caesar Cipher
The Caesar cipher