One-time pad encoder/decoder and key generator

 
 
The one-time pad (OTP) encryption technique is the only proven unbreakable encryption system.
Even infinite computational power and time cannot break this system.

Implementation of the one-time pad system

This tool allows you to enter a message in any language, e.g.: English, Chinese, Russian etc.
All texts are considered UTF-8 encoded.
UTF-8 is a multibyte encoding that can represent any Unicode character in 1 to 4 bytes.
  • ASCII characters (U+0000 to U+007F) take 1 byte
  • Code points U+0080 to U+07FF take 2 bytes
  • Code points U+0800 to U+FFFF take 3 bytes
  • Code points U+10000 to U+10FFFF take 4 bytes
The message Operation start at 10:00 consists of 24 ASCII characters, thus total 24 bytes.
Each character in the message will be converted into a hexadecimal value, for example:
4f7065726174696f6e2073746172742061742031303a3030

To encrypt the message you need a randomly generated number called a one-time pad, for example:
a33a986b3f8b111dfbfb1d2e6f0934748fba6efc07a9fab9

XOR the message and one-time pad to create the cipher :
message:      4f7065726174696f6e2073746172742061742031303a3030
one-time pad: a33a986b3f8b111dfbfb1d2e6f0934748fba6efc07a9fab9
              ------------------------------------------------ xor
cipher:       ec4afd195eff787295db6e5a0e7b4054eece4ecd3793ca89
To decrypt the cipher, XOR the cipher and the same one-time pad:
cipher:       ec4afd195eff787295db6e5a0e7b4054eece4ecd3793ca89
one-time pad: a33a986b3f8b111dfbfb1d2e6f0934748fba6efc07a9fab9
              ------------------------------------------------ xor
message:      4f7065726174696f6e2073746172742061742031303a3030
Convert the message hexadecimal value to UTF-8 and you get:
Operation start at 10:00

How to use the one-time pad system
  1. Bob and Alice wants to exchange multiple messages secretly using the one-time pad system.
  2. Bob generates a list of one-time pads, each one-time pad contains a prefix reference number.
  3. Bob stores the list on two USB flash drives.
  4. Bob and Alice meet each other in a restaurant and Bob hand over one of the USB flash drives.
  5. At home Bob creates a message and encrypts it with a one-time pad from the list.
    The encrypted message (cipher), also contains a prefix referring to the one-time pad used.
  6. After encryption Bob deletes the used one-time pad from his list.
  7. Bob sends the cipher to Alice using his email.
  8. Alice receives the cipher. She looks at the cipher prefixed number and knows which one-time pad she must use to decrypt the cipher.
  9. Alice decypts the cipher using the one-time pad from her list.
  10. After Alice has decrypted the message, she deletes the used one-time pad from her list.
The one-time pad system can not be cracked if the folowing rules are applied correctly:
  • The one-time pad should be a randomly generated key.
  • The one-time pad should only be used once.
  • Only the sender and receiver should have copies of the on-time pad. If more parties have a copy, the chance will increase an attacker get hold of a copy.
  • The one-time pads must be exchanged via a secure channel, preferably meeting face to face and the data stored on a USB flash drive.
  • The one-time pad is at least as long as the message that must be encrypted.
Generate one-time pad

This tool also allows you to generate multiple pseudorandom one-time pads. It is called pseudorandom because the generated numbers are not true random numbers but are generated using a mathematical formula. This PRNG (PseudoRandom Number Generator) produces a sequence of bits that "appears" to be random, i.e., the output is statistically indistinguishable from random values.

This tool uses two methods to generate cryptographic pseudorandom numbers depending if your browser supports it.

One-time pad encoder/decoder and key generator input:


Conversion method *: Help
 
Message / cipher *: Help
    Number of bytes:   
 
One-time pad *: Help
    Number of bytes:     
 
* = required            

One-time pad size *: Help    Max 140 bytes
 
Number of one-time pads *: Help    Max 5000
 
* = required        
 


One-time pad encoder/decoder and key generator output:


Message / cipher

   



Generated one-time pads