Two-Time Pad: How Nonce Reuse Breaks Stream Cipher Encryption (2D)
Interactive 2D byte-grid 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. Pan and zoom the byte rows, toggle nonce reuse, and run the attack yourself.
This 2D companion to the 3D two-time-pad simulator renders the exact same attack as a flat, zoomable grid of byte tiles instead of a rendered scene. Stream ciphers like RC4, AES-CTR and ChaCha20 encrypt by XOR-ing plaintext with a keystream derived from a key and a nonce — provably safe for a single message, but reuse that same keystream for two different messages 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, drag and zoom the byte grid, and run the attack to watch 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.
2D companion to the 3D two-time-pad simulator: the same nonce-reuse attack rendered as a scrollable, zoomable grid of byte tiles instead of a 3D scene — drag to pan and scroll to zoom the ciphertext rows, toggle nonce reuse, and run the attack to watch C1 XOR C2 collapse bit-for-bit onto the true plaintext difference.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install