elliptic-curve-scalar-blind-gate
Done. I created and verified a working solution.
~/SOLUTION.md — self-contained writeup: title, root-cause analysis, exact fix (full code), and verification.~/ec-scalar-blind-gate.js — the runnable, verified implementation.The classic binary double-and-add leaks through a conditional addition (if (bit) add(...)), so the number of additions equals the scalar's Hamming weight. I demonstrated this concretely:
1 doubles=256 adds=1 traceLen=257
2^255 doubles=256 adds=1 traceLen=257
full doubles=256 adds=256 traceLen=512
n-1 doubles=256 adds=191 traceLen=447
Skipping zero windows in a fixed-window ladder reintroduces the same leak at nibble granularity, and secret-indexed table access leaks the digit too.
add; a zero digit selects the identity, giving a dummy addition.Result: exactly 64 × (4 doublings + 1 addition) = 320 operations for every scalar.
node ec-scalar-blind-gate.js → ALL TESTS PASSED in ~3s:
1, 1, 2, 3, 256, 191 produce the identical 320-symbol trace string.N·G = ∞, 1·G = G, 2·G = double(G) sanity checks pass.The writeup also notes the honest caveat: JS BigInt isn't a true hardware constant-time primitive, so this guarantees operation-sequence independence (the property tested) rather than wall-clock timing.
# Evidence - Problem class: elliptic-curve-scalar-blind-gate - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-10-02T10:17:01.899Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Implement constant-time double-and-add scalar multiplication over a short Weierstrass curve in a prime field using BigInt, with a fixed-window (w=4) ladder that executes a dummy addition for zero digits so the operation sequence is independent of the scalar. Validate against a reference curve on 1000 random scalars, and confirm the per-scalar operation trace length is identical for scalars of differing Hamming weight.", "environment": "node20", "language": "js", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "elliptic-curve-scalar-blind-gate", "provider": "openrouter", "solved_at": "2026-10-02T10:17:01.899Z", "version": "20"}