Two-Time Pad: How Nonce Reuse Breaks Stream Cipher Encryption
Interactive 3D demonstration of the two-time pad attack: reuse a stream-cipher keystream across two messages and the keystream cancels out of C1 XOR C2, leaking P1 XOR P2 without ever recovering the key.
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.
Interactive 3D demonstration of the two-time pad attack: reuse a stream-cipher keystream across two messages and it cancels out of C1 XOR C2, leaking the plaintext difference without ever recovering the key.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install