This toy nonce-reuse leak is not production exploit guidance.

highlighted = computed this step

The leak is about reuse

This toy leak appears because the same nonce gives the same keystream for two different plaintexts.

nonce reused=1\text{nonce reused}=1
Toy nonce-reuse boundaryThe ciphertext XOR and plaintext XOR are recomputed from pinned bytes.Ciphertext A48 bits / 6 bytes0x7f7f54017a6abyte 0byte 1byte 2byte 301111111011111110101010000000001byte 4byte 50111101001101010byte-00x7fbyte-10x7fbyte-20x54byte-30x01byte-40x7abyte-50x6aCiphertext B48 bits / 6 bytes0x7f7f5401726abyte 0byte 1byte 2byte 301111111011111110101010000000001byte 4byte 50111001001101010byte-00x7fbyte-10x7fbyte-20x54byte-30x01byte-40x72byte-50x6aCiphertext XOR48 bits / 6 bytes0x000000000800byte 0byte 1byte 2byte 300000000000000000000000000000000byte 4byte 50000100000000000byte-00x00byte-10x00byte-20x00byte-30x00byte-40x08byte-50x00Plaintext XOR48 bits / 6 bytes0x000000000800byte 0byte 1byte 2byte 300000000000000000000000000000000byte 4byte 50000100000000000byte-00x00byte-10x00byte-20x00byte-30x00byte-40x08byte-50x00

It is not key recovery

The lesson shows a plaintext relationship and known-plaintext recovery, not recovery of the secret key.

key recovered=0\text{key recovered}=0
Toy nonce-reuse boundaryThe ciphertext XOR and plaintext XOR are recomputed from pinned bytes.Ciphertext A48 bits / 6 bytes0x7f7f54017a6abyte 0byte 1byte 2byte 301111111011111110101010000000001byte 4byte 50111101001101010byte-00x7fbyte-10x7fbyte-20x54byte-30x01byte-40x7abyte-50x6aCiphertext B48 bits / 6 bytes0x7f7f5401726abyte 0byte 1byte 2byte 301111111011111110101010000000001byte 4byte 50111001001101010byte-00x7fbyte-10x7fbyte-20x54byte-30x01byte-40x72byte-50x6aCiphertext XOR48 bits / 6 bytes0x000000000800byte 0byte 1byte 2byte 300000000000000000000000000000000byte 4byte 50000100000000000byte-00x00byte-10x00byte-20x00byte-30x00byte-40x08byte-50x00Plaintext XOR48 bits / 6 bytes0x000000000800byte 0byte 1byte 2byte 300000000000000000000000000000000byte 4byte 50000100000000000byte-00x00byte-10x00byte-20x00byte-30x00byte-40x08byte-50x00

What this does not model

NOTE: toy reused nonce and reused keystream illustration only; not AES-GCM, not ChaCha20-Poly1305, not nonce generation, not real stream-cipher internals, not traffic analysis, not key recovery, and not production exploit guidance.

toy only=1\text{toy only}=1
Toy nonce-reuse boundaryThe ciphertext XOR and plaintext XOR are recomputed from pinned bytes.Ciphertext A48 bits / 6 bytes0x7f7f54017a6abyte 0byte 1byte 2byte 301111111011111110101010000000001byte 4byte 50111101001101010byte-00x7fbyte-10x7fbyte-20x54byte-30x01byte-40x7abyte-50x6aCiphertext B48 bits / 6 bytes0x7f7f5401726abyte 0byte 1byte 2byte 301111111011111110101010000000001byte 4byte 50111001001101010byte-00x7fbyte-10x7fbyte-20x54byte-30x01byte-40x72byte-50x6aCiphertext XOR48 bits / 6 bytes0x000000000800byte 0byte 1byte 2byte 300000000000000000000000000000000byte 4byte 50000100000000000byte-00x00byte-10x00byte-20x00byte-30x00byte-40x08byte-50x00Plaintext XOR48 bits / 6 bytes0x000000000800byte 0byte 1byte 2byte 300000000000000000000000000000000byte 4byte 50000100000000000byte-00x00byte-10x00byte-20x00byte-30x00byte-40x08byte-50x00

Summary

A reused nonce can turn two toy ciphertexts into the XOR of their plaintexts.

cipher XOR=0x000000000800\text{cipher XOR}=0x000000000800
Toy nonce-reuse boundaryThe ciphertext XOR and plaintext XOR are recomputed from pinned bytes.Ciphertext A48 bits / 6 bytes0x7f7f54017a6abyte 0byte 1byte 2byte 301111111011111110101010000000001byte 4byte 50111101001101010byte-00x7fbyte-10x7fbyte-20x54byte-30x01byte-40x7abyte-50x6aCiphertext B48 bits / 6 bytes0x7f7f5401726abyte 0byte 1byte 2byte 301111111011111110101010000000001byte 4byte 50111001001101010byte-00x7fbyte-10x7fbyte-20x54byte-30x01byte-40x72byte-50x6aCiphertext XOR48 bits / 6 bytes0x000000000800byte 0byte 1byte 2byte 300000000000000000000000000000000byte 4byte 50000100000000000byte-00x00byte-10x00byte-20x00byte-30x00byte-40x08byte-50x00Plaintext XOR48 bits / 6 bytes0x000000000800byte 0byte 1byte 2byte 300000000000000000000000000000000byte 4byte 50000100000000000byte-00x00byte-10x00byte-20x00byte-30x00byte-40x08byte-50x00