1001Ferramentas
🔑Security

Vernam Cipher (One-Time Pad)

XORs your text byte by byte against a key and prints the ciphertext in hex. A short key repeats, so it is a true one-time pad only if it matches the length.

Hex

Repeating-key XOR is not a one-time pad

The claim that a one-time pad is mathematically unbreakable is true, which is exactly why it misleads people. It holds only under three simultaneous conditions: the key must be genuinely random, as long as the message in bytes, and used exactly once. Break any one of them and you are left with an ordinary XOR cipher, the kind that falls to position-wise frequency analysis.

This tool encodes both text and key as UTF-8 bytes, XORs them byte by byte, and prints the result in hex. HELLO under the key XMCKL gives 10080f0703: five bytes of plaintext against five of key, a legitimate pad. If the key is shorter than the text it is repeated cyclically with no warning, and at that moment it stops being Vernam. Length is counted in bytes, not characters: coracao with a cedilla and a tilde takes eight UTF-8 bytes, not seven.

For an honest demonstration, generate random bytes matching the byte length of your text and never reuse that key on a second message. This page only encrypts: there is no hex-to-text direction here, though since XOR is symmetric any hex XOR tool with the same key recovers the original. Everything runs in the browser with no network request. Treat it as a learning aid: distributing and destroying pads is the problem that keeps the one-time pad impractical outside textbooks.

Frequently asked questions

How do I decrypt the hex back to text?
This page takes no hex input. Since XOR is its own inverse, apply the same key to the ciphertext bytes in any XOR utility and the plaintext comes back.
Why is the output hexadecimal?
XOR yields arbitrary bytes, many of them unprintable or invalid UTF-8. Hex shows every byte exactly as it is, without losing information.
Can the key be shorter than the message?
It will still produce output, because the tool silently repeats the key. That is no longer a one-time pad, though: a repeating key breaks with very little ciphertext.

Related Tools