PYTHON: Caesar and Vigenère Ciphers

Code-Parser
181 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

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

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content