Fewest Toffoli gates for AES encryption with key expansion (sampled check)
Some correct AES circuits use identities that an exact symbolic replay cannot see (shared nonlinear terms across S-boxes, S-box outputs computed without a block, garbage reused across inputs). This board admits them on sampled evidence, kept apart from the exact board and labelled on every page.
SAMPLED VERIFICATION — 32,768 fresh random (key, plaintext, target) trials and the FIPS 197 known answers per check; not an equivalence proof.
Leaderboard: AES-128, wide workspace Hot
QArena's record 12,440 Toffoli gates by QArena's own run Ties it
| # | Participant | Score (Toffoli gates) | vs QArena baseline | Submission |
|---|---|---|---|---|
| 1 | qarena-baseline (QArena's run)(QArena) Baseline | 12,440 | #2 | |
| 2 | yicheng | 12,440 | #7 |
Baseline: QArena's own run: 12,440 Toffoli gates (nothing published fits this instance)
Instance: Key length and workspace limit
Overview
SAMPLED VERIFICATION — 32,768 fresh random (key, plaintext, target) trials and the FIPS 197 known answers per check; not an equivalence proof. Every result on this board says so. The exact board (aes-oracle) proves its circuits correct on every input; this board accepts circuits that only pass sampled inputs.
Task
The same as on the exact board. Build a reversible circuit of X, CNOT (CX) and Toffoli (CCX) gates that maps, for every key K, plaintext P and 128-bit target Y,
|K〉|P〉|Y〉|0A〉 → |K〉|P〉|Y ⊕ AESK(P)〉|0A〉,
with AESK(P) the FIPS 197 (2023 update) Cipher() with the full KeyExpansion() computed inside
the circuit. Wires: key K = 0 to k − 1 (k = 128, 192 or 256), plaintext P = k to k + 127, output Y = k + 128 to k + 255,
then A workspace wires; offset 8j + b is bit b (0 = least significant) of byte j in hexadecimal-string order, and AES state
byte 4c + r is row r, column c. Each key size has a wide instance (up to 16,384 qubits in total) and a narrow one (at most 512
workspace qubits).
Submission file
The exact board's format ("format": "aes-xor-v1", ancillas, blocks,
ops, with CALL and UNCALL records and the same caps: 64 MiB, 16,384 qubits, 1,000,000 outer records, 8,192 calls,
5,000,000 expanded gates, 32 blocks of at most 256 ancillas and 16,384 gates, 100,000 block gates in total), with two
differences:
["CCX", a, b, t]records are allowed among the outer records.- Blocks are plain subroutines. Their
kindandgarbagefields must still be valid, but they carry no meaning: no block is tested on its own, and a CALL or UNCALL simply runs the block's gates (forward or reversed) on the mapped wires. Local ancillas must still be mapped to workspace wires.
Every file the exact board accepts is accepted here too, with the same score.
Validation
- The file is parsed and checked against the caps as on the exact board.
- The server draws a fresh 32-byte seed from the operating system. SHAKE256 of the text
qarena aes-oracle sampled trials v1followed by the seed gives 32,768 uniform triples (K, P, Y), each K | P | Y as consecutive bytes. The FIPS 197 known answers for the key length are added as further trials (plaintext 00112233…eeff with the consecutive-byte key, target all zeros and target all ones; for AES-128 also Appendix B). - All trials run at once: every wire holds one integer whose bit t is its value in trial t, so an X gate is one XOR with all ones, a CNOT one XOR and a Toffoli gate one AND and one XOR, over all trials. Every expanded gate is executed.
- The file passes if, in every trial, the output wires hold Y ⊕ AESK(P), computed by a separate byte-oriented AES with its own key expansion, the key and plaintext wires are unchanged and every workspace wire is 0.
A circuit that is wrong on a fraction f of all 2k+256 inputs passes one check with probability
(1 − f)32768: below 6 × 10−15 for f ≥ 10−3, and below
e−128 for f ≥ 2−8, the smallest failure rate a missing or wrong byte-level step causes. There
is no useful bound for an arbitrary wrong circuit: a circuit that flips one ciphertext bit only when 40 chosen key bits are all 1
passes with probability about 0.99999997, at the price of the extra Toffoli gates its trigger needs. Such a circuit is refuted
by one explicit input, and so is any record: the result reports its seed, so the run can be replayed exactly
(QARENA_AES_SEED=<seed> python3 -I verifiers/run_one.py aessamp <instance> <file>), a rejection
names the first failing trial with its K, P and Y, current records are rerun with new seeds by an independently written checker
(site/tests/aes_indep.py), and a record refuted by any concrete input is removed.
Scoring
As on the exact board, lexicographic and all minimized: the number of Toffoli gates in the expanded circuit (outer CCX records included); the Toffoli depth (every wire starts at level 0; each expanded gate, an UNCALL's gates in reverse order, takes the largest level among its wires, plus 1 for a Toffoli gate, and gives it to all its wires); the number of qubits k + 256 + A. Ties go to the lower submission number. The total number of expanded gates is shown but not ranked.
Baseline and reference scores
The baselines are the exact board's house circuits, which pass here with the same scores: 12,512 / 14,048 / 17,376 Toffoli gates (depth 154 / 178 / 202) in the wide instances, from Boyar and Peralta's 32-AND S-box in garbage blocks with a full reverse pass (the last round goes straight into the target), and 26,496 / 31,648 / 39,376 in the narrow ones (the same S-box circuit in direct blocks). The exact board's statement describes the constructions, the other house circuits (algebraic normal form, 34-AND circuit, clean blocks) and the published figures; none of the published circuits uses this interface, so no instance shows a reference score.
Application
The exact board's symbolic check cannot see every algebraic identity of AES. Circuits that share nonlinear terms between S-boxes, compute S-box outputs without a block, or reuse garbage across inputs can be correct and still fail there. This board lets such designs compete on sampled evidence, kept apart from the proved results and labelled on every page.
Where verification runs
Verifications of this board run on the first lane of this list that is up and has room: the Mac mini, then CU Boulder's Alpine, then NCAR Derecho, then RunPod. A lane that is down, full or slow passes the file to the next one automatically, with the same verifier version; the limits of one verification are 300 s of CPU, 570 s of wall time and 2,048 MB of memory on the Mac mini, and 600 s of CPU, 1,020 s of wall time and 2,048 MB of memory on CU Boulder's Alpine, NCAR Derecho and RunPod (2 times the board's own CPU and wall time on the other lanes, because their processors are slower); the result goes to QArena only.
Current records
| Instance | Baseline | Record (Toffoli gates) | Reference score | Record holder | Status |
|---|---|---|---|---|---|
| AES-128, wide workspace Hot
128-bit key, 10 rounds, 200 S-box evaluations; workspace up to 16,000 qubits (16,384 in total); checked on 32,768 fresh random trials (sampled) |
12,440 QArena's run | 12,440 | – No published count for this map (quantum key, plaintext and target, full clean-up). Grassl et al. report 1,060,864 T gates (151,552 Toffoli at 7 T each) and 984 qubits for |K>|0> -> |K>|AES_K(m)> with a classical plaintext m (Table 2), Grassl, Langenberg, Roetteler, Steinwandt, PQCrypto 2016, Table 2 |
qarena-baseline (QArena's run)(QArena) | Baseline not beaten |
| AES-128, at most 512 workspace qubits
128-bit key, 10 rounds; workspace at most 512 qubits (896 in total); checked on 32,768 fresh random trials (sampled) |
26,496 QArena's run | 26,496 | – No published count for this map. Jaques et al. report 54,400 T gates with 13,600 measurement-based AND uncomputations (not allowed here) and width 1,785 for AES-128 with in-place MixColumns, more than this cell's 896 qubits. Designs aimed at few qubits start with Zou et al., ASIACRYPT 2020 (doi:10.1007/978-3-030-64834-3_24), Jaques, Naehrig, Roetteler, Virdia, EUROCRYPT 2020 (arXiv v1, Table 3) |
qarena-baseline (QArena's run)(QArena) | Baseline not beaten |
| AES-192, wide workspace
192-bit key, 12 rounds, 224 S-box evaluations; workspace up to 15,936 qubits (16,384 in total); checked on 32,768 fresh random trials (sampled) |
13,976 QArena's run | 13,976 | – No published count for this map (quantum key, plaintext and target, full clean-up). Grassl et al. report 1,204,224 T gates (172,032 Toffoli at 7 T each) and 1,112 qubits for |K>|0> -> |K>|AES_K(m)> with a classical plaintext m (Table 3), Grassl, Langenberg, Roetteler, Steinwandt, PQCrypto 2016, Table 3 |
qarena-baseline (QArena's run)(QArena) | Baseline not beaten |
| AES-192, at most 512 workspace qubits
192-bit key, 12 rounds; workspace at most 512 qubits (960 in total); checked on 32,768 fresh random trials (sampled) |
31,648 QArena's run | 31,648 | – No published count for this map. Jaques et al. report 60,928 T gates with 15,232 measurement-based AND uncomputations (not allowed here) and width 2,105 for AES-192 with in-place MixColumns, more than this cell's 960 qubits. Designs aimed at few qubits start with Zou et al., ASIACRYPT 2020 (doi:10.1007/978-3-030-64834-3_24), Jaques, Naehrig, Roetteler, Virdia, EUROCRYPT 2020 (arXiv v1, Table 3) |
qarena-baseline (QArena's run)(QArena) | Baseline not beaten |
| AES-256, wide workspace
256-bit key, 14 rounds, 276 S-box evaluations; workspace up to 15,872 qubits (16,384 in total); checked on 32,768 fresh random trials (sampled) |
17,304 QArena's run | 17,304 | – No published count for this map (quantum key, plaintext and target, full clean-up). Grassl et al. report 1,505,280 T gates (215,040 Toffoli at 7 T each) and 1,336 qubits for |K>|0> -> |K>|AES_K(m)> with a classical plaintext m (Table 4), Grassl, Langenberg, Roetteler, Steinwandt, PQCrypto 2016, Table 4 |
qarena-baseline (QArena's run)(QArena) | Baseline not beaten |
| AES-256, at most 512 workspace qubits
256-bit key, 14 rounds; workspace at most 512 qubits (1,024 in total); checked on 32,768 fresh random trials (sampled) |
39,376 QArena's run | 39,376 | – No published count for this map. Jaques et al. report 75,072 T gates with 18,768 measurement-based AND uncomputations (not allowed here) and width 2,425 for AES-256 with in-place MixColumns, more than this cell's 1,024 qubits. Designs aimed at few qubits start with Zou et al., ASIACRYPT 2020 (doi:10.1007/978-3-030-64834-3_24), Jaques, Naehrig, Roetteler, Virdia, EUROCRYPT 2020 (arXiv v1, Table 3) |
qarena-baseline (QArena's run)(QArena) | Baseline not beaten |
The baseline of an instance is its published result where there is one (the hot instance's famous result, a cited published reference, or a published result or method on its leaderboard), else QArena's own run. Reference scores come from cited papers or derived constructions.
Record changes
The first strict improvement on a ranked instance will appear here as a card, and a chart will follow the headline record over time.
Headline record now:
- AES encryption oracle, sampled, AES-128, wide workspace: 12,440 Toffoli gates (SAMPLED VERIFICATION — 32,768 fresh random (key, plaintext, target) trials and the FIPS 197 known answers per check; not an equivalence proof.) by QArena baseline