Edu

Cryptography, part 1: from secret art to Caesar's cipher

Before it was mathematics, cryptography was an art for initiates. Start with Caesar and ROT13, with three puzzles to solve with pen and paper.

Biblioteca romana di notte con un biglietto nascosto in un libro

Rome, an evening in November. In the reading room of a library that closed an hour ago, someone has left a note between the pages of Suetonius. All it says is this:

JR WR WKH VWDWXH RI DXJXVWXV

It is not a dead language and it is not a misprint. It is a message that someone wanted to hide from the people it was not meant for. Before solving it, we need to understand what we are dealing with.

An art before it was a science

The word comes from Greek: kryptós means «hidden» and gráphein «to write». Cryptography therefore means hidden writing. For millennia it was a matter for initiates, halfway between alchemy and diplomacy: whoever knew how to hide a message held power, and kept it close.

One of the oldest examples comes from Mesopotamia, around 1500 years before Christ, and it has nothing to do with wars or kings: it is about pottery. It is a clay tablet about the size of the palm of a hand, roughly 7.5 by 5 centimetres, carrying the oldest known formula for preparing glazes, the glassy coating that makes a vase shiny and waterproof. A successful glaze was worth a lot, and whoever knew it did not want competitors to learn it.

A clay tablet with cuneiform signs next to a glazed jar and a kiln

The glaze tablet: a workshop recipe written not to be read (CoinBack illustration, AI-generated).

Whoever wrote it used a puzzle-maker's trick. Cuneiform uses signs that stand for syllables, and a sign can have several readings: a common one and some rare ones. The recipe was written with the rarest readings, the ones almost nobody remembered. It is like spelling «ghoti» for «fish», George Bernard Shaw's joke: gh sounds like f as in enough, o sounds like i as in women, ti sounds like sh as in nation. Whoever does not know the rules reads a meaningless word; whoever does reads «fish».

For a layman it was enough. The cryptologist Gerhard Strasser, who has studied the history of cryptography for decades, describes it as a simple substitution, one sign in place of another, but good enough to stop a curious reader from deciphering the recipe. In time the secret leaked out and later recipes were written in plain text.

Today cryptography is a science: mathematics, algorithms, proofs. The principle, however, has not changed. A few words are all you need:

  • Plaintext: the original text.
  • Encryption: the transformation that makes it unreadable.
  • Cryptogram: the result, the encrypted message.
  • Decryption: the way back, for whoever knows the method and the key.
  • Cryptanalysis: reading a cryptogram without having the key. It is the trade of those who want to break codes.

Caesar and the shifted letter

Suetonius tells us that Julius Caesar wrote to Cicero and to his friends in such a way that no word could be read: he replaced each letter with the one three places further on in the alphabet, D in place of A. The same Suetonius says that Augustus used the same trick in a more cautious version, shifting by one: B in place of A.

Here is Caesar's alphabet, plain above, encrypted below:

Plain: 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
Encrypted: 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

Two concentric rings with the alphabet: the inner ring is shifted by three letters, A sits above D

Caesar's wheel: each letter of the outer ring becomes the one on the inner ring, shifted by three places (CoinBack diagram).

With this table «VENI VIDI VICI» becomes «YHQL YLGL YLFL». The method is called a monoalphabetic substitution cipher and the amount of shift is the key: 3 for Caesar, 1 for Augustus.

How secure is it? Against an enemy who has never heard of the method, reasonably. Against anyone else it is a game: there are only 25 possible keys, and you can try them all in a few minutes. There is also a more elegant way, dating from the 9th century. The Arab philosopher al-Kindi, in Baghdad, noticed in his treatise on deciphering encrypted messages that in every language some letters appear more often than others: in English E, T, A, O. If the most frequent letter in the cryptogram is H, it probably hides an E. This is frequency analysis, the first serious weapon of cryptanalysis.

ROT13: Caesar in the age of forums

Caesar's cipher is not a museum piece. With a shift of 13 it is called ROT13. The alphabet has 26 letters, so 13 is exactly half: applying ROT13 twice gives back the original text, and the same operation encrypts and decrypts.

Plain: A B C D E F G H I J K L M
Encrypted: N O P Q R S T U V W X Y Z (and vice versa)

It protects nothing, and that is not its purpose. It was born in the early 1980s on the Usenet newsgroup net.jokes, to hide jokes that some people might find offensive. It later spread to the solution of a riddle or the ending of a film: whoever wants to read it decrypts it, whoever does not moves on. Example: «EBFROHQ VF GUR FYRQ». Fans of classic cinema already know what we are talking about.

Your turn: three puzzles

The note from the library is the first of three. You need pen, paper and the table above.

Puzzle 1. The note in Suetonius' book. Caesar is your first clue.

JR WR WKH VWDWXH RI DXJXVWXV

Puzzle 2. Under the statue you find a slip of paper. Whoever wrote it did not change the method, only the key.

GUR SVANY ZRFFNTR VF SEBZ NHTHFGHF

Puzzle 3. The final message. Puzzle 2 tells you who wrote it. The text above tells you how he wrote.

UIF LFZ XBT BMXBZT JO UIF CPPL

Need a hint? Try a shift of 3 on puzzle 1: you read backwards, from D to A.

Solutions

Do not look before you have tried.

  1. Key 3 (Caesar): GO TO THE STATUE OF AUGUSTUS.
  2. Key 13 (ROT13): THE FINAL MESSAGE IS FROM AUGUSTUS.
  3. Key 1 (Augustus): THE KEY WAS ALWAYS IN THE BOOK.

Caesar's cipher has a weakness: once the method is understood, it falls at once. And there is another, subtler question: what if the message were not even visible? An encrypted note draws the eye of whoever finds it. In the next instalment we talk about steganography, the art of hiding not the meaning of a message, but its very existence.

Sources

CoinBack is a rewards platform, not a financial adviser. CBK is a reward, not an investment: crypto-assets are volatile and can lose all their value. We earn commissions from the merchants listed on this site.