Choose language

PL, EN, ES, DE, FR, RU

# Vernam cipher or One-time pad - encoder / decoder

Vernam cipher online encoder and decoder. Encrypt and decrypt any cipher created in a Vernam cipher.

Vernam Cipher, Perfect Cipher, One-time pad or OTP cipher is the only proven cryptographic method that enables unconditionally secure encryption, which has been mathematically proven. It involves entering a random key with the length of the encrypted text. With our encoder you can both encrypt and decrypt any text with the Vernam cipher. Enter a code key with the same number of letters as the text to encrypt will have.

## Vernam cipher - encoder / decoder

Key:

Random key length

Contents:

Have you counted? - like and share

## Vernam cipher - encoder / decoder

The Vernam cipher, perfect cipher, One-time pad cipher or OTP is a cipher belonging to the group of polyalphabetic ciphers. It is considered to be the only proven cryptographic method that enables unconditionally secure encryption, which has been mathematically proven. It was invented in 1882 and proposed in 1917 by Gilbert Vernam of AT&T.

It resembles a Caesar cipher, but does not move letters the same number of places, but each by a random number and direction.

The Vernam cipher is available in binary and character versions. In the binary version we encrypt / decrypt using the Xor algorithm. However, in the character version we encrypt / decrypt using the Vigenere cipher.

In order for a cipher to be a perfect cipher, the encoding key should meet three conditions:

• must be a random string;
• must be one-time;
• the length of the key must be at least as long as the length of the ciphertext.

For the example of using the Vernam cipher, suppose Eve wants to send a secret message CALCOOLATOR to Adam. Before that, both had received cards with identical keys. Eve chooses an appropriate piece of paper with a key. How to select this card is usually arranged in advance, for example " use the 5th card on March 3rd " or " use the next available card for the next message ".

Each letter in the key will be linked in a specific way to one letter of the message. Often, but not required, each letter is assigned a numerical value (in alphabetical order) e.g. 'A' is 0, 'B' is 1, 'C' is 2 etc.

The coding technique involves combining a key and a message using modular addition. The numerical values of the corresponding messages and letters are added together, modulo 26 (for the Latin alphabet).

Suppose the secret key is MWZYOWBXNIW then the encoding of the word CALCOOLATOR will be done as follows:

     C     A     L     C     O     O     L     A     T     O     R  message
2(C)  0(A) 11(L)  2(C) 14(O) 14(O) 11(L)  0(A) 19(T) 14(O) 17(R) number letter
+ 12(M) 22(W) 25(Z) 24(Y) 14(O) 22(W)  1(B) 23(X) 13(N)  8(I) 22(W) key
= 14    22    36    26    28    36    12    23    32    22    39    message+key
= 14(O) 22(W) 10(K)  0(A)  2(C) 10(K) 12(M) 23(X)  6(G) 22(W) 13(N)(message+key) mod 26
O     W     K    A      C     K     M     X     G     W     N  cipher


We numbered the letters from 0 to 25 (26 letters in the Latin alphabet from A to Z). If during the encryption, as a result of adding, we get a number greater than 25, then "we turn the counter" from zero, i.e. 26-> 0 that is A, 27-> 1 that is B, 28-> 2 that is C etc.

As a result of encoding the word CALCOOLATOR with the key MWZYOWBXNIW Eve would receive the code OWKACKMXGWN .

To decode the ciphertext, Adam has to do the same thing as Eve, except that instead of adding he has to subtract values.

     O     W     K    A      C     K     M     X     G     W     N  cryptogram
14(O) 22(W) 10(K)  0(A)  2(C) 10(K) 12(M) 23(X)  6(G) 22(W) 13(N) cipher
- 12(M) 22(W) 25(Z) 24(Y) 14(O) 22(W)  1(B) 23(X) 13(N)  8(I) 22(W) key
=  2     0   -15   -24   -12   -12    11     0    -7    14    -9    key-cipher
2(C)  0(A) 11(L)  2(C) 14(O) 14(O) 11(L)  0(A) 19(T) 14(O) 17(R) message
C     A     L     C     O     O     L     A     T     O     R  message


If the result of the subtraction is negative, then the result is subtracted from the number 26, e.g. the result is -7 so 26-7 = 19 that is the letter T.

More on: Wikipedia - One-time pad

## Users of this calculator also used

### Matrix 3x3 calculator

Thanks to the 3x3 matrix math calculator, you can easily calculate the determinant of the matrix 3x3, find the complement 3x3 matrix, transpose 3x3 matrix, inverse 3x3 matrix.

### Spelling words with the phonetic alphabet - converter, translator

Using this translator / converter you can quickly and easily check how to spell each word using the international (and not only) phonetic alphabet.

### Caesar cipher - encoder / decoder

Caesar cipher online encoder and decoder. Encrypt and decrypt any cipher created in a Caesar cipher. You can use any shift and additionally a key for more precise text encoding.

### Fibonacci sequence calculator

Using the calculator, you can easily and quickly calculate the sum of the Fibonacci sequence, find a value or find the nth term.

### Playfair cipher - encoder / decoder

Playfair cipher online encoder and decoder. Encrypt and decrypt any cipher created in a Playfair cipher.

### Vigenère cipher - encoder / decoder

Vigenère cipher online encoder and decoder. Encrypt and decrypt any cipher created in a Vigenère cipher. You can use any shift and additionally a key for more precise text encoding.

### CATENARY Calculator - Chain curve

With the CATENARY Trigonometric Function Calculator, you can calculate catenary chain curve values. In addition to the response results, the calculator will also plot the selected function. You can choose a ready-made function, e.g. cat(?#X) where for ? you will substitute e.g. 2 for catenary two which will be equal to 2*cosh(x/2) or enter your own function e.g. cat(2#x^2) for 2*cosh((x^2)/2), cat(2#x+3) for 2*cosh((x+3)/2) etc.