Caesar Cipher (also known as shift cipher, Caesar cipher or Caesar shift) - one of the simplest encryption techniques. It is a type of substitution cipher in which each letter of plaintext (unencrypted) is replaced with a different letter (monoalphabetic cipher) separated from it by a fixed number of alphabetical positions, and the direction of replacement must be respected. It does not distinguish between uppercase and lowercase letters. The cipher name comes from Julius Caesar, who probably used this technique to communicate with his friends.
The encryption algorithm used in Caesar's code can be part of more complex encryption systems, such as the Vigenère cipher. Nowadays, the Caesar cipher is used with the displacement of 13 (ROT13), which is a simple and quick way to hide content. Currently, the Caesar cipher, like any technique that substitutes individual letters of the alphabet for other letters, does not offer any communication security.
The encryption method can be represented by a diagram of two strings with corresponding letters of the alphabet. The same letters of the second string are shifted relative to the first string by a certain number of positions, called the shift parameter (here 3) and serving as the cipher key:
Alphabet: ABCDEFGHIJKLMNOPRSTUWYZ
Shift: CDEFGHIJKLMNOPRSTUWYZAB
Note that the last letters of the alphabet in the upper string correspond to the initial letters in the lower string (the alphabet has been "wrapped"). To encrypt a message, each letter should be replaced with an equivalent from the cipher (the message in the example is written in capital letters, although the cipher is case insensitive):
Plaintext: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
Ciphertext: GUR DHVPX OEBJA SBK WHZCF BIRE GUR YNML QBT
Decryption is about reversing this operation.
In the keyed version, the standard alphabet cannot be used, the key word must be entered first. The key is appended to the alphabet without repeating characters. In the example below, I used the 'calcoolator.pl' key. The duplicate letters and period have been removed from the key.
Alphabet: ABCDEFGHIJKLMNOPRSTUWYZ
Key: IJKMNQSUVWXYZCALTRPBEGH
Then a 3 letter shift was applied.
Alphabet: ABCDEFGHIJKLMNOPRSTUWYZ
Shift: OTRPBDEFGHIJKMNQUVWXZAL
We carry out further actions as in the cipher without a keyword.
The use of a unique key allows for more secure encryption of the message.
More on: Wikipedia - Caesar cipher