
Solveur quantique pour le problème du logarithme discret sur courbe elliptique utilisant l'algorithme de Shor, mettant en œuvre plusieurs stratégies d'oracle pour récupérer les clés privées ECC sur du matériel quantique réel.
Quantum solver for the Elliptic Curve Discrete Logarithm Problem (ECDLP), built for the Q-Day Prize Challenge by Project Eleven. The goal: recover ECC private keys on real quantum hardware using Shor's algorithm.
All challenge curves use y^2 = x^3 + 7 over F_p (a = 0, b = 7), matching the secp256k1 family. The solver implements the two-register variant of Shor's algorithm for ECDLP:
The private key d is recovered by collecting multiple (j, k) samples that satisfy the same linear relation modulo the group order n. The solver supports six oracle strategies for the controlled point additions, selected automatically based on curve size or manually via --oracle.
Used for curves with group order up to ~6 bits. Implemented in projecteleven.py.
Each controlled point addition "add S" is represented as a 2^(n+1) x 2^(n+1) permutation matrix applied via qc.unitary(). The matrix encodes the full group action: the upper-left block is identity (control=0), the lower-right block permutes basis states according to the map P -> P+S (control=1).
Used for larger curves. Implemented in quantum_arithmetic.py.
Instead of building dense matrices, each "add S" permutation is cycle-decomposed into transpositions. Each transposition (swap of two basis states |a> <-> |b>) is implemented with:
The MCX uses V-chain decomposition with (n-2) dedicated ancilla qubits, giving O(n) Toffoli gates per MCX instead of O(n^2) without ancillas. Each controlled addition is built as an isolated sub-circuit and appended as a single opaque gate, avoiding quadratic DAG growth in Qiskit.
--oracle coordinate)Available for curves up to ~6-bit. Implemented in quantum_oracle.py.
Instead of encoding points as group indices, the quantum register holds actual (x, y) field-element coordinates in binary plus an identity flag. The point register layout is:
x_reg: f_bits qubits (f_bits = ceil(log2(p)))y_reg: f_bits qubitsid_flag: 1 qubit (1 = point at infinity)Each controlled "add S" is computed from the EC addition formula over all valid coordinate encodings, producing a permutation on the coordinate register. This permutation is cycle-decomposed into transpositions using the same CNOT-reduction + MCX infrastructure as Strategy 2.
--oracle arithmetic)Framework for polynomial-scaling point addition. Implemented in quantum_oracle.py and quantum_arithmetic.py.
Uses coordinate encoding (same as Strategy 3) with QFT-based modular arithmetic primitives as building blocks toward fully arithmetic point addition. The codebase includes tested implementations of:
The arithmetic primitives achieve O(n^3) scaling per point addition vs O(N*n) for the permutation approach. However, the QFT-based operations carry a ~150x larger constant factor, making the arithmetic approach more efficient only for curves above ~20-bit group order. For current challenge sizes (up to 12-bit), the permutation-based adder remains faster and is used by default.
--oracle google)Implemented in google_semiclassical.py. Inspired by the qubit-recycled phase estimation technique from Griffiths & Niu (1996), applied at scale in Babbush et al. (2026) for secp256k1 ECDLP resource estimates. The Babbush et al. paper was published on March 30, 2026.
Replaces the two multi-qubit counting registers (j, k) and bulk inverse QFT with two single recycled qubits and classically-conditioned phase corrections. Each counting register bit is processed sequentially: prepare in |+>, apply controlled point addition, correct phase based on all previously measured bits, then measure. The reset + if_test dynamic circuit primitives in Qiskit enable this on IBM Quantum hardware.
The oracle for controlled point additions is delegated to the existing infrastructure (dense unitary for <= 6-bit, efficient permutation for > 6-bit), so the qubit savings come entirely from eliminating the counting registers.
| Curve size | Standard qubits | Semiclassical qubits | Savings | Hardware verified |
|---|---|---|---|---|
| 4-bit (n=7) | 11 | 5 | 55% | Yes |
| 6-bit (n=31) | 17 | 7 | 59% | Yes |
| 7-bit (n=79) | 26 + anc | 14 | 46% | Yes |
| 8-bit (n=139) | 25 + anc | 10 + anc | 60% | No (QPU sync overhead) |
| 10-bit (n=547) | 31 + anc | 12 + anc | 61% | No (QPU sync overhead) |
--oracle ripple)Implemented in ripple_carry_shor.py. Uses CDKM ripple-carry adders (Cuccaro et al. 2004) for the controlled point additions, replacing both dense unitary matrices and cycle-decomposed transposition circuits.
In group-index encoding, point P = kG is represented by its index k in the cyclic group. Adding S = sG becomes modular addition of the classical constant s (mod n). The key insight: each controlled point addition reduces to a single controlled modular addition of a known constant, implemented via Qiskit's CDKMRippleCarryAdder and IntegerComparator.