# Vernam Cipher Python Program

By | April 27, 2017

Let’s understand vernam cipher algorithm for encryption and decryption of plain text and implement the vernam cipher python program using functions, for and while loops.

#### What is Vernam Cipher Algorithm?

The vernam cipher algorithm was developed by Gilbert Vernam at AT&T in 1917. It is basically an encryption and decryption algorithm. It is one of the best and unbreakable cryptosystems.

Let us also look at what is cipher exactly. A cipher is a way of encryption a text-based format. To add to it, a stream cipher is a cipher which encrypts variable length text or message.

#### Vernam Cipher Definition

The Vernam Cipher Algorithm is a stream cipher, which is symmetrical and, the plaintext is combined with a random stream of data of the same length using the boolean XOR function.

The boolean XOR function is also known as boolean exclusive OR function. The vernam cipher algorithm is also known as One – Time Pad.

The vernam cipher algorithm in python enlisted here is really strong in terms of hacks or loopholes just because the algorithm itself is very strong.

Must Read: Caesar Cipher Encryption Algorithm C Program

Gilbert Vernam proposed a bit-wise exclusive OR of the stream with a  random zero-one stream which is shared by the recipient and the sender.

#### Vernam Cipher Example

Enter a Text: CodingAlpha.com

Vernam Cipher Encrypted Text: ”  8^Q\Y

Vernam Cipher Decrypted Text: CodingAlpha.com

1.  This algorithm does not offer any chance of leaking the key or the original plain text entered by the user.

2. It is really hard to break into the system. Only guesswork can help an attacker, which is very rare.

There’s one disadvantage of vernam cipher algorithm which is that the encryption key used is too large than usual public and private keys.

Note: This Python code for Vernam Cipher Algorithm is developed using IDLE Python 3.6 32-bit version on Microsoft Windows 10 operating system.

#### Output

Let’s discuss more on vernam cipher python program in the comment section below if you have any compilation errors and any doubts about the same. For more information on Simpson’s integration methods, check Wikipedia.

## 4 thoughts on “Vernam Cipher Python Program”

1. Akash Gawde

Thank you so much for explaining the vernam cipher algorithm so beautifully.

2. Shrrya Shrivastav

RSA Encryption, DES and so many other encryption algorithms are there. Which one is the best?

3. Rishabh Sinha

THank you so much! FInally I got a working code.