Caesar cipher
Adapted from Wikipedia · Adventurer experience
A Caesar cipher is one of the simplest and most well-known encryption methods in cryptography. It is a type of code called a substitution cipher. In this code, each letter in a message, called the plaintext, is changed to another letter by moving a fixed number of places along the alphabet. For example, if you move three places to the left, the letter D would become A, and E would become B.
This method is named after Julius Caesar, the famous Roman leader. He used it to keep his private messages secret. Even though it seems clever, the Caesar cipher is easy to solve because there are only a few ways to shift the letters.
Today, the idea behind the Caesar cipher is used in more complex coding systems, like the Vigenère cipher and the ROT13 system. But because it is so simple, the Caesar cipher does not provide real security for important information today. It is mostly used to show how basic codes work.
Example
A Caesar cipher is a simple way to hide messages by moving each letter in the alphabet by a certain number of places. For example, with a left shift of three places, the letter "T" becomes "Q", "H" becomes "E", and so on. To read the hidden message, you move the letters back in the opposite direction.
This type of cipher can also be explained using numbers. Each letter is turned into a number, with A equal to 0, B equal to 1, and so on up to Z equal to 25. The encryption formula adds the shift number to the letter's number, while decryption subtracts it. Both use a process called "modulo" to keep the result within the range of the alphabet.
Main article: modulo operation
The Caesar cipher is a kind of substitution cipher where the same shift is used for every letter in the message, making it a monoalphabetic substitution. This is different from a polyalphabetic substitution.
Main articles: monoalphabetic substitution, polyalphabetic substitution
History and usage
See also: History of cryptography
The Caesar cipher is named for Julius Caesar. He used it to keep messages safe. He moved each letter three places. For example, the letter A would become D. His nephew, Augustus, also used a similar way but with a different move.
Later, the Caesar cipher was seen in many places, from old Hebrew texts to newspapers in the 1800s. Today, it is still used in fun toys like secret decoder rings. A version called ROT13 moves letters by thirteen. It is used to hide jokes or spoilers online.
Breaking the cipher
The Caesar cipher is easy to solve because there are only 25 ways to move the letters in the alphabet. Someone can break the code by trying each move one by one until they find the one that makes sense in the original language. For example, the secret message "exxegoexsrgi" becomes "attackatonce" when moved four places, which clearly makes sense as English.
Another way to solve the cipher is by looking at how often each letter appears in the message. By comparing these patterns to what is normally expected in the language, the correct move can usually be found. Even just a few letters of the coded message are often enough to figure out the whole thing. Doing the encryption many times doesn’t make the cipher harder to break, as it simply adds up to one overall move.
| Decryption shift | Candidate plaintext |
|---|---|
| 0 | exxegoexsrgi |
| 1 | dwwdfndwrqfh |
| 2 | cvvcemcvqpeg |
| 3 | buubdlbupodf |
| 4 | attackatonce |
| 5 | zsszbjzsnmbd |
| 6 | yrryaiyrmlac |
| ... | |
| 23 | haahjrhavujl |
| 24 | gzzgiqgzutik |
| 25 | fyyfhpfytshj |
Images
This article is a child-friendly adaptation of the Wikipedia article on Caesar cipher, available under CC BY-SA 4.0.
Images from Wikimedia Commons. Tap any image to view credits and license.
Safekipedia