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

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.

Fraction calculator - subtracting fractions step by step with explanation

With the Fractions Calculator, you can subtract any two mixed numbers or proper and improper fractions.
Fractions Calculator will show you the result of operations on fractions step by step and will give you explanations of the operations performed to subtracting fractions. You will learn how to simplify fractions, how to find a common denominator, how to find the least common multiple and the greatest common divisor.

Playfair cipher - encoder / decoder

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

Profitability of investments: NPV (Net Present Value), PI (Profitability Index), IRR (Internal Rate of Return), DPP (Discounted Payback Period)

This calculator helps us check whether the planned investment will be profitable and whether the project should be accepted or rejected.
Thanks to the calculator, we can calculate:
NPV (Net Present Value) - sum of discounted net cash flows
PI (Profitability Index) - investment profitability
IRR (Internal Rate of Return) - internal rate of return
DPP (Discounted Payback Period) - discounted payback period
Value of discounted net cash flow for each period.



Online calculator