One-time pad(Vernam cipher) in cryptography Skip to main content

Featured

Tech Army Commander update available

  Hello guys, so today the official update of TAC is available. Continue playing. Tech Army Commander by NextZone PLC

One-time pad(Vernam cipher) in cryptography

Introduction




Vernam cipher is a method of encrypting alphabetical text. In this method of cryptography, a number is assigned to each character of the plain text for example: (a = 0, b= 1, etc). 

Key generation

We take a key to encrypt the plain text whose length should be equal to the length of the plain text.

Encryption algorithm

1. Assign a number to each character of the plain text and the key paying attention to the alphabetical order. Please note that we start from 0 and not 1 so (A will be equal to 0).

2. Bitwise XOR or both the number it

3. Subtract the number from 26 if and only if the resulting number is equal to or greater than 26, if not leave it like that.

Example

Plain text : O A K
Key: S O N

Solution

"O" ==> 14 == 01110
"S" ==> 18 == 10010
Bitwise XOR result = 11100 == 28

Since the resulting number is greater than 26, substract 26 from it (28- 26 = 2)
Then convert the cipher text character number to character, it will be C

Do the same for the remaining characters.

Advantages of vernam cipher

1. Secrecy is perfected
2. No pattern recognition
3. Simple algorithm
4. Unbreakable with a truly random key

Disadvantages

1. Key length equal to the message -- this might be quite inefficient especially if you are having a longer message



Comments

Popular Posts