The Caesar Cipher (or Caesar Code) is a specific example of substitution encryption. It gets its name from Julius Caesar, who used it to encrypt military documents, usually with a shift of 3 letters. This encryption involves replacing each letter in the message one by one with a letter located further in the alphabet, following a specific shift. For example, to encrypt the following message:
Each letter in the secret message is substituted with the letter of the alphabet located 3 positions further. Thus, J is encrypted as M, U is encrypted as X, and so on. If we need to encrypt the letter Z, we wrap around to the beginning of the alphabet, so it is encrypted with the letter C. This gives us the following encrypted message:
Special characters, accents, etc., are removed from the encrypted message. It is also possible to remove spaces to prevent the person reading the encrypted message from knowing the word lengths.
Julius Caesar is said to have used the Greek alphabet for his Caesar code, making the code more challenging to break because the Greek alphabet was not known to the Gauls at that time. Shift ciphers existed long before the Caesar code, likely more complex than a simple shift of 3. It is also suggested that Caesar may have used other shift ciphers (source: Shift ciphers).
Rot 13 is a variant of the Caesar Code where the shift is conventionally set to 13. However, it remains as easy to break as the regular Caesar cipher.
The Caesar cipher is easily deciphered, much like most monoalphabetic ciphers, for example,
the Polybius Square. It simply requires brute-forcing the 26 positions of
the alphabet (trying each possibility). Given the limited number of possibilities, there are no technical challenges.
Another method to break monoalphabetic substitution ciphers, in general, is to use
frequency analysis. This cryptanalysis technique
involves analyzing a ciphered text to identify the frequencies of letter appearances. Once these frequencies are determined,
they are compared to the average frequency of letter appearances (which varies by language) to try to guess which letters
replace the letters in the original message.
The difficulty of this method lies in the attacker needing a sufficiently large sample to analyze for the frequencies to be representative. It is worth noting that one can add the frequencies of the most common bigrams and trigrams in the target language.