A β What is a Nonce?
A1 β The one rule
A nonce (number used once) in AEAD schemes is a per-encryption value that must be unique for every encryption under the same key. It does not need to be secret. AES-GCM uses a 96-bit nonce (12 bytes). The security proof assumes the nonce is never reused β and the rest of this page is what happens when that one rule is broken.
NIST SP 800-38D calls it an Initialization Vector (IV); RFC 5116 calls it a nonce β same concept.
96-BIT NONCE (12 BYTES)
No theory yet β go break it first. Head to Section B, flip the nonce toggle, and watch AES-GCM leak. Then Section C explains the algebra behind what you just saw.
B β See It Break (Live Attack Demo)
Encrypt two messages under AES-GCM and AES-GCM-SIV with the same key. Leave the nonce toggle on to reuse the nonce, then run the attack. Level 1 uses your messages and reveals only their XOR, not either plaintext. Level 2 also runs on your messages: it factors the key equation their two (ciphertext, tag) pairs produce, recovers the GHASH key H, and forges a tag real AES-GCM accepts. Curiosity first: see the break here, then jump to Section C for why it happened.
π AES-GCM Vulnerable
Click "Encrypt Both" to begin
π AES-GCM-SIV Resistant
Click "Encrypt Both" to begin
C β Why It Breaks
You just watched AES-GCM leak. Here is the algebra behind it. Two levels: the first cracks confidentiality (recovering the plaintexts), the second cracks integrity (forging tags). Each turns on one idea β a shared secret term that cancels when you XOR two things together. The animations below show that cancellation happen.
C1 β Level 1: keystream reuse (confidentiality)
AES-GCM encrypts by XORing plaintext with a keystream β a pseudorandom pad derived from (key, nonce, counter). The keystream depends only on the key and nonce, not on the message. So if you reuse a (key, nonce) pair, both messages get XORed with the same pad:
The same keystream (highlighted) sits in both ciphertexts.
Because x β x = 0, the identical keystream blocks annihilate each other. What's left is Cβ β Cβ = Pβ β Pβ β the XOR of the two plaintexts, with no key involved at all. In practice that often recovers both messages (via crib-dragging / known structure). This is exactly the Recovered Pβ β Pβ you saw in Section B.
C2 β Level 2: authentication-key recovery (integrity)
GHASH β a keyed checksum built from multiply-add in a special number system. GF(2ΒΉΒ²βΈ) β arithmetic on 128-bit blocks where "add" is just XOR. The mask β a per-nonce pad AES adds on top of the checksum so the tag looks random.
AES-GCM's tag is that GHASH checksum, keyed by H = E_K(0ΒΉΒ²βΈ) (fixed by the key alone), with the mask XORed on top. For a 96-bit nonce:
The mask E_K(nonce β 0Β³ΒΉ1) depends only on (key, nonce) β so, just like the keystream in Level 1, two tags under the same nonce carry the identical mask. XOR the two tags and it cancels:
The same mask (highlighted) sits in both tags.
With the mask gone, what remains is one equation in the single unknown H over GF(2ΒΉΒ²βΈ). The picture above shows the simplest shape of it β two equal-length single blocks, where it collapses to tagβ β tagβ = (Cβ β Cβ)Β·HΒ² and H = β((tagβ β tagβ)Β·(Cβ β Cβ)β»ΒΉ) falls out directly. In general your messages span several blocks and the equation is the full polynomial:
β one term per 16-byte ciphertext block, plus the length block. That is a real polynomial, and recovering H means factoring it over GF(2ΒΉΒ²βΈ). Section B does exactly that on your two messages: gcd with x2ΒΉΒ²βΈ β x isolates the roots that live in the field, then characteristic-2 CantorβZassenhaus trace splitting separates them. Usually one root comes back; sometimes a handful, and one forged tag per candidate settles which is the real key. Recover H and you also recover the mask, and then you can forge a valid tag for any ciphertext under that nonce β this is Joux's "forbidden attack." Not theoretical: a 2016 survey (BΓΆck, Zauner, Devlin et al.) found production HTTPS servers reusing AES-GCM nonces, exposed to exactly this.
Two honest details about the demo. First, building a forged ciphertext β rather than just a valid tag over random bytes β assumes the attacker knows Message 1, the same known-plaintext assumption Level 1 already leans on, because the keystream is recovered as Cβ β Pβ. Second, the root search runs in your browser tab and its cost grows with the square of the polynomial degree, so this lab caps it at 512 bytes per message; past that Level 2 declines to run and says so instead of pretending. That cap is a budget of this page, not a limit of the attack. Type the same text into both boxes to meet the other, genuine limit: identical ciphertexts make the equation 0 = 0 and nothing at all is learned about H.
D β SIV: Misuse Resistance and Its Limits
AES-GCM-SIV changes the construction: derive the IV from the plaintext and associated data, and AES-encrypt the checksum. Below, compare its computed values and see why the direct GCM attacks no longer apply. Then separate those observations from the broader security claim and its limits.
D0 β The synthetic-IV construction (RFC 8452)
AES-GCM-SIV uses a synthetic IV approach:
- Derive a per-nonce authentication key and encryption key from the master key and nonce
- Hash the plaintext (and AAD) with POLYVAL (a keyed checksum, GHASH's twin in a little-endian-friendly field) β then XOR in the nonce and AES-encrypt the result to produce the tag
- Use that tag (top bit set) as the synthetic IV for AES-CTR encryption
The synthetic IV depends on the plaintext and associated data, as well as the key and nonce. Changing the plaintext changes this input to tag generation; it does not guarantee distinct finite-length tags for every possible pair. The simple GCM cancellation attack does not transfer to this construction. Under RFC 8452's assumptions and usage bounds, AES-GCM-SIV tolerates nonce repetition with additional equality leakage. Identical full inputs reproduce the tag, IV, keystream, and ciphertext. This lab uses empty associated data; ciphertext length remains visible.
D1 β Key Derivation
AES-GCM-SIV derives per-nonce keys from the master key. For each counter it AES-encrypts the block counter β nonce (counter is a 32-bit little-endian value; nonce is 96 bits) and keeps the low 8 bytes of the output, concatenating them:
For a 128-bit master key the encryption key uses only counters 2β3 (two blocks).
D2 β POLYVAL Authentication (why the cancel trick dies)
POLYVAL β a keyed checksum, GHASH's twin, defined in RFC 8452 in a little-endian-friendly version of the same GF(2ΒΉΒ²βΈ) field (add = XOR).
Its key H is derived per-nonce from (key, nonce). But the decisive difference from AES-GCM is the final step: the POLYVAL result is AES-encrypted before it is output as the tag.
tag = AESKenc(S)
Recall the Level 2 break in Section C: subtracting two tags cancelled the mask and left a clean polynomial in H. Here the attacker only ever sees AESKenc(S) β never POLYVAL's raw output S. XORing two tags now XORs two AES outputs; the common-mask cancellation used by the GCM attack no longer exposes that polynomial equation. This explains why that attack does not transfer. It is not a proof that every possible attack fails: confidentiality and integrity depend on the construction's assumptions and usage bounds.
D3 β Tag-as-IV, Live: plaintext β tag β IV β ciphertext
A visible part of the construction is that the IV depends on the plaintext and associated data. That dependency alone is not a complete security argument. The 128-bit tag (the AES-encrypted POLYVAL result) is the initial AES-CTR counter block β copied verbatim, with the most significant bit of its last byte set to 1 (RFC 8452 Β§4). That bit is cleared on the AES input used to generate the tag, but set on every CTR counter input. This separates the two kinds of AES input; it does not say that the resulting tag itself cannot equal a counter block. Compare the computed values as you type. A small set of changed tags or ciphertexts illustrates the dependency; it does not rule out collisions for all inputs.
Type a message to inspect the AES-GCM-SIV tag, derived AES-CTR IV, and first ciphertext blockCompare against a second message B:
E β When to Use Which
E1 β Comparison Table
| Property | AES-GCM | AES-GCM-SIV |
|---|---|---|
| Standard | NIST SP 800-38D | RFC 8452 |
| Nonce size | 96 bits | 96 bits |
| Nonce reuse consequence | Plaintext XOR; GHASH-subkey recovery and forgery under the stated attack conditions | Misuse resistance under stated bounds; equality and length remain visible |
| Performance | ~1 pass | ~2 passes (extra POLYVAL) |
| FIPS approved | Yes | No β an IRTF CFRG spec (RFC 8452), not a NIST mode |
| Hardware acceleration | AES-NI + PCLMULQDQ | AES-NI + PCLMULQDQ |
| Online encryption | Yes | No β must buffer full plaintext |
| Deployed in | TLS 1.3, QUIC, IPsec | Google internal, QUIC experiments |
| Recommendation | β Nonce uniqueness guaranteed | β Nonce uniqueness uncertain |
E2 β Decision Guidance
Scenario 1 β Single server, sequential encryption
AES-GCM with a counter nonce is safe. Nonce uniqueness is easy to guarantee. No need for SIV overhead.
Scenario 2 β Distributed system, multiple encryptors
Coordinating nonces across servers is error-prone. AES-GCM-SIV degrades gracefully on accidental reuse. Use SIV or use random 96-bit nonces with AES-GCM (collision risk is low at < 2Β³Β² messages per key).
Scenario 3 β Key wrapping and key storage
AES-GCM-SIV is designed for this β short messages, repeated access to the same key, nonce coordination difficult. Google's Tink library uses it for key wrapping.
E3 β Honest Limitations of AES-GCM-SIV
- Bounded misuse resistance β repeating identical key, nonce, AAD, and plaintext repeats the encrypted result; length remains visible. This demo does not measure a security bound or attempt a SIV forgery. RFC 8452 recommends random nonces rather than intentional reuse.
- Not FIPS-approved β cannot use in FIPS 140-2/3 contexts
- No online encryption β must have full plaintext before starting (not suitable for streaming)
- Two passes over the data β the tag must be computed before encryption can begin, so throughput can approach half that of single-pass AES-GCM on long messages, though hardware-optimized (AES-NI + PCLMULQDQ) implementations narrow the gap
- Not yet widely deployed β operational experience is thin compared to AES-GCM
E4 β Nonce Reuse and Replay Are Different
Nonce reuse at encryption means using the same key-and-nonce pair for more than one encryption. With distinct messages, AES-GCM can expose the plaintext XOR and enable the forgery attacks demonstrated above. Replay means sending an unchanged, previously valid packet again: its authentication tag can still verify.
Neither AES-GCM nor AES-GCM-SIV remembers which packets a receiver has already accepted. A protocol must separately check freshness, for example by authenticating session identifiers and sequence numbers and maintaining receiver replay state. Authentication must succeed before that state is advanced. Explore this distinction in IPsec / IKE's replay-window lesson.
Reading comparison: Cryptography: Algorithms, Protocols, and Standards for Computer Security, second edition, Β§9.2.8.1, discusses nonces and replay. Keep the two responsibilities separate: RFC 5116 Β§1.2 places protocol anti-replay services outside the AEAD interface. Nonce misuse resistance does not provide replay protection.
Under consideration: wider-block GCM
NISTβs second pre-draft consultation (1 June 2026) proposes wGCM using a 256-bit-block cipher. Comments closed 31 July; this is a proposal, not a finalized replacement for GCM.
AES-128 and AES-256 both have 128-bit blocks. Changing the AES key length does not implement wGCM. This demo runs its existing AES modes, not Rijndael-256/wGCM. The nonce-reuse experiments and current tag guidance remain applicable to the constructions actually executed here. Reviewed 12 October 2026.