Caesar Cipher in Python
An introduction into the cryptography world and a simple way to learn a new language.
When we are trying to learn a new programming language, we usually try to solve a few problems and algorithms that help us in this process. The Caesar Cipher algorithm is a very simple kind of cryptography (please, don’t use it in a real application) and is a good start with a new language.
Definition
The Caesar Cipher is a famous and very old cryptography technique. In a simple way, it reorganize all the letter from a sentence based on a shifted alphabet.
For example, if we choose a right shift of 4, the letter A is replaced by E, B is replaced by F, and so on. When the end of alphabet is reached, it returns back to the beginning.
So, if we have the following message:
hello world
would produce something like this:
lipps Bsvph
The message becomes a little bit harder to read. This method was named after Julius Caesar (yes, him), who used in its private correspondence.
Algorithm
To implement this cipher technique, we need a few simple steps:
- Identify the character in the…