Vernam cipher is a symmetrical stream cipher in which the plaintext is combined with a random or pseudorandom stream of data of the same length, to generate the ciphertext, using XOR function.
To put it simply, vernam cipher is based on the principle that each plaintext letter from a message is combined with one character from a key stream.
- Read: Stream cipher.
The random key stream used needs to be completely random so that the resulting ciphertext bears no relation to the original plaintext.
- Read: What is ciphertext.
For this reason, vernam cipher works in a similar way to the unbreakable One-time pad (OTP).
A brief history of Vernam cipher:
It was invented by the American scientist, Gilbert Vernam in 1917 while working at AT&T.
It was used with teleprinters and 5-level punched tape, the system was also known as one-time tape (OTT).
Vernam proposed a bit-wise exclusive-or of the message stream with a truly random zero-one stream which was shared by the sender and recipient.
Note, the key should never be used more than once, since this introduces a weakness than an attacker can exploit.
If the key is generated truly randomly, this cipher is unbreakable without the explicit knowledge of the key.
Vernam Cipher Example
This is the same as Vigenere encryption method but uses a key at least as long as the plaintext.
Here is an example:
To encrypt KIFANGA, I need a key of at least 5 letters KEYWORD or PASSWORD.
If the key is not long enough, it can be repeated, same as in the vigenere cipher, but this is not recommended as it presents security loopholes.
Here is a random key generator tool to use.
Here is a tool to decrypt/encrypt with vernam.
How to decrypt Vernam cipher
The decryption process is also identical to the Vigenere decryption method.
How to recognize Vernam ciphertext
A message encoded with Vernam has an index of coincidence close to a random text.
How to decipher Vernam without key
If the key length is as long as the text length, then no cryptanalysis method can crack Vernam.