Tool to decode/encode with Vernam (One Time Pad). The Vernam Cipher is the name given to any cipher whose key is as long as the text, which reduces cryptanalysis attempts.
Vernam Cipher (One Time Pad) - dCode
Tag(s) : Poly-Alphabetic Cipher
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
Vernam is a generic name to describe any one time pad encryption, several implementations are possible, dCode offers Vigenère or XOR (see FAQ):
Use a Vigenere cipher with a key as long as the ciphertext and completely random.
Use an XOR cipher with a key as long as the binary data and completely random.
The Vernam cipher is a symmetric encryption method that combines a plaintext message with a secret key. In its most rigorous form, called a one-time pad, it guarantees perfect security in the information theory sense: the ciphertext reveals no information about the plaintext.
This security is ensured only if three conditions are met:
— the key is perfectly random
— the key has the same length as the message
— the key is used only once
The system was formalized by Gilbert S. Vernam in 1917 for encrypting telegraphic communications (Baudot cipher) using an XOR operation (bit-by-bit modulo-2 addition). However, the method is applicable to various key ciphers, such as the Vigenère cipher.
The Vernam cipher can use the Vigenère cipher method, but with a completely random encryption key that must have the same number of letters (or even more) than the number of characters in the plaintext message.
Example: To encrypt DCODE, a key of at least 5 letters is needed (KEYWORD, PASSWORD, etc).
If the key is not long enough, it will be repeated, as in the Vigenere cipher, but this introduces a cryptographic weakness in the message.
The Vernam cipher can use the XOR encryption method, but with a randomn encryption key that must have a bit size identical to (or greater than) the bit size of the plain message.
Example: To encrypt 010101, a key of at least 6 bits is required.
Decryption depends on the encryption method used, Vernam makes no changes to the usual decryption.
In the case of a true one-time pad (a random key, as long as the message and used only once), keyless decryption is impossible, even with infinite computing power.
This result was demonstrated by Claude Shannon: the system possesses perfect security.
However, if the three conditions are not met, the system becomes vulnerable to various forms of cryptanalysis.
The one-time pad is perfectly secure because, for a given ciphertext, every possible plaintext has exactly the same probability of being correct if the key is random.
In other words, the ciphertext can correspond to an infinite number of different, equally plausible messages.
This means that an attacker cannot obtain any information about the plaintext without knowing the key.
First example were found at the end of the 19th century and Vernam described it in 1917.
dCode retains ownership of the "Vernam Cipher (One Time Pad)" source code. Any algorithm for the "Vernam Cipher (One Time Pad)" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Vernam Cipher (One Time Pad)" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Vernam Cipher (One Time Pad)" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Vernam Cipher (One Time Pad)" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Vernam Cipher (One Time Pad) on dCode.fr [online website], retrieved on 2026-03-30,