b2KIT

One-Time Pad Generator

Generate cryptographically random one-time pads and encrypt messages with provably unbreakable XOR encryption.

Tested tool guide Tested browser tools Checked August 16, 2026

What One-Time Pad Generator does and how it behaves

One-Time Pad Generator pairs a message with a cryptographically random pad and applies byte-for-byte XOR to produce ciphertext. XORing that ciphertext with the identical pad restores the original bytes. Perfect secrecy applies only when the pad is unpredictable, at least as long as the message, kept secret, and never reused. The common surprise is that the pad is as large as the protected message and must reach the recipient securely. Because messages and pads are sensitive, this browser-only tool processes them locally and uploads neither value.

How the result is produced

1

Reversible XOR

At each position, XOR combines one message bit with the corresponding pad bit. Applying the same operation again reverses it: (message XOR pad) XOR pad equals message. No separate decryption transformation is needed. Every encrypted message bit must have a matching pad bit, so a proper one-time pad cannot be shorter than the message it protects.

2

Perfect secrecy conditions

Perfect secrecy does not come from XOR alone. It requires pad material selected uniformly at random, independent of the message, used for exactly one encryption, and known only to authorized parties. The generated pad is not a password or reusable key. Anyone who obtains it can decrypt the associated ciphertext, while a lost pad cannot be recreated from the ciphertext.

Good uses

  • Preparing a one-off encrypted message when sender and recipient can exchange or store the equally long pad through a separate secure arrangement.
  • Demonstrating perfect secrecy in a cryptography lesson by observing that fresh pads can map the same plaintext to unrelated ciphertexts.
  • Generating pad material for a small byte-level XOR exercise, protocol experiment, or security lab where key length and single-use handling are being studied.

Limits and checks

  • Do not read "perfect secrecy" as an unconditional guarantee. The proof assumes uniform randomness, complete message-length coverage, pad secrecy, and one-time use; failures in handling the pad fall outside that proof.
  • Never reuse any pad bits. If two ciphertexts share a pad segment, XORing them cancels that segment and exposes the XOR of the plaintexts, often giving an attacker useful structure for recovering both messages.
  • XOR encryption provides confidentiality but not authentication or integrity. An attacker who changes a ciphertext bit causes the corresponding recovered plaintext bit to change, even without knowing the pad. Use a separate authentication mechanism when tampering must be detected.

Common questions

Can I reuse part of a pad for another message?

No. Reuse turns the construction into a vulnerable reused keystream. For ciphertexts C1 = P1 XOR K and C2 = P2 XOR K, XORing C1 with C2 produces P1 XOR P2. The pad disappears from that relationship, and recognizable language or known message fragments can expose the plaintexts. Generate wholly independent pad material for every message.

How should the recipient receive the pad and decrypt the message?

The ciphertext may travel over an exposed channel, but the pad must reach the recipient through a channel or prior exchange that protects it from disclosure and alteration. The recipient XORs the ciphertext with the exact same pad to recover the message. The tool does not solve pad distribution: interception destroys secrecy, and losing the pad prevents unique recovery.

References and verification

The behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools