Caesar's cipher

Kapitoly: Caesar's cipher, How to break the Caesar cipher by brute force, How to break the Caesar cipher using letter distances

The Caesar cipher is a simple cipher that was used by Julius Caesar in his military communications.

The principle of encryption

The cipher can work over any alphabet, though it is typically assumed to operate on the English alphabet, which consists of 26 letters from a to z. The classic Caesar cipher involves shifting each letter of the plaintext by three positions forward. Thus, instead of the letter "a", the letter "d" appears, and instead of "b", you see "e", and so on. If the shift reaches the end of the alphabet, it wraps around to the beginning—thus, "z" is encrypted as "c". The table below illustrates the complete shift:

The first row shows the letters from the plaintext and the second row shows those from the ciphertext. This means that we would encrypt the word "hello" into the text "dkrm".

A generalization of Caesar's cipher

While Caesar is said to have consistently used a shift of just three letters, we can generalize Caesar's cipher to a shift of any number of letters. The key to the cipher is then the letter that "a" is encrypted to. So, the original Caesar cipher represents a shift of three letters, corresponding to the letter "d", because "a" is encrypted as "d". In the sample tables, the key is highlighted in bold. Next, you can generate a table according to the corresponding key:

Key:

The encryption works the same way: find the letter in the top row and type the letter from the corresponding bottom row instead. The decryption is done in the opposite direction - find the letter in the bottom row and write the letter from the top row instead.

Example of decryption: we have the ciphertext "klwrw," and we will decrypt it using the key "w." We generate a table with the key "w" and find the letters "klwrw" in the bottom row. In the upper rows, we read the original text: 'opava'.

Online tool for encrypting and decrypting the Caesar cipher

Finally, you can encrypt and then decrypt any text using any key:

Text:
Key: