Back
Close

PYTHON: Caesar and Vigenère Ciphers

The Caesar and Vigenère Ciphers

In this tutorial we will write two programs for implementing the Caesar and Vigenère Ciphers in Python. Let's begin.

Program 1: The Caesar Cipher

The Caesar Cipher is a simple and widely known encryption technique where each letter in the plaintext is shifted a certain number of places down or up the alphabet. For example, with a shift of 3, A would be replaced by D, B would become E, and so on.

Let's write the program:

The result of this code will be: "EBIIL".

Program 2: The Vigenère Cipher

The Vigenère cipher is a method of encrypting alphabetic text where each letter of the plaintext is encoded with a different Caesar cipher, whose increment is determined by the corresponding letter of another text, the key.

Let's write the program:

The result of this code will be: "ALCPS"

Conclusion

There we go. We have two programs for the Caesar and Vigenère Ciphers.

If you'd like to read up some information on the Ciphers, I have added some links below:

https://en.wikipedia.org/wiki/Caesar_cipher

https://en.wikipedia.org/wiki/Vigenère_cipher

Feel free to use this code.

Happy Coding, @Code-Parser

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io