Ciphertext C1 (P1 ⊕ K1) Ciphertext C2 (P2 ⊕ K2) Attacker's C1 ⊕ C2 True P1 ⊕ P2 (reference) /match / mismatch
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

Two-Time Pad: How Nonce Reuse Breaks Stream Cipher Encryption

Stream ciphers like RC4, AES-CTR and ChaCha20 encrypt by XOR-ing plaintext with a keystream derived from a key and a nonce. That construction is provably safe for a single message — but reuse the same keystream for two different messages, as this simulator demonstrates in real 3D, and the keystream cancels out entirely when an eavesdropper XORs the two intercepted ciphertexts together, leaking the XOR of the two plaintexts without ever recovering the secret key. Toggle nonce reuse on and off, generate fresh sample messages, and run the attack to watch byte columns rendered as colored cubes — ciphertext rows that look like pure noise on their own collapse, bit for bit, into a perfect match against the true plaintext difference the moment the same keystream is reused twice.