When the curve
shatters
The elliptic curve you saw drawn as a smooth loop doesn't live on paper when it does real work. It lives over a finite field — a world with only finitely many numbers, where the curve becomes a scatter of dots. Suitable large finite-field groups can support hard discrete-log problems; the tiny groups here do not.
A field with no infinity
A finite field 𝔽ₚ is arithmetic modulo a prime p: the only numbers are 0, 1, …, p−1, and everything wraps around. Add, subtract, multiply, and — crucially — divide, all staying inside that finite set. Every nonzero element has an inverse, which is what makes it a field rather than just a ring.
The same elliptic-curve equation, y² = x³ + ax + b, now asks which pairs (x, y) satisfy it modulo the prime. The group also includes an identity called the point at infinity; that identity is not an extra field element.
The curve, over 𝔽ₚ
Below is y² = x³ + 2x + 2 over 𝔽ₚ. Change p and watch the point set redraw. Notice the vertical symmetry — for every point (x, y) there's a mirror (x, p−y) — the finite-field ghost of the real curve's reflection.
Adding points in the dark
The chord-and-tangent rule still works — but algebraically, not geometrically. Pick a starting point G and repeatedly add it to itself. Over the reals you could watch it slide along the curve. Here it jumps. Press step and follow G, 2G, 3G… as they scatter with no visible pattern.
Four different promises about the same addition
The arithmetic above is correct and it is also a teaching model. Production elliptic-curve code carries claims this exhibit does not, and the claims are not interchangeable. Four of them are worth separating.
| Claim | What it means | What it does not cover |
|---|---|---|
| Exceptional cases handled | The affine chord-and-tangent rule has no slope when the two points share an x-coordinate, so an implementation must branch: identity, inverse pair, doubling, general case. | Branching is where bugs and timing differences live. Handling a case is not handling it in constant time. |
| Complete addition formulas | One branch-free expression that is correct for every pair of points, including the identity and a point with itself. Renes, Costello and Batina give such formulas for short Weierstrass curves. | The completeness guarantee holds for a stated curve class — prime-order short Weierstrass curves over fields of characteristic other than 2 and 3. Outside that class the guarantee does not transfer. Costs depend on the formula, coordinates, field arithmetic and workload; completeness does not specify one universal multiplication cost. |
| Functional-correctness proof | A machine-checked argument that a particular implementation computes the specified mathematical function, including the bounds that keep intermediate values in range. Fiat-Cryptography produces field arithmetic this way. | A proof has a boundary. The compiler, the pretty-printer and anything below them are trusted, not proved, and the proof says nothing about timing. |
| Constant-time assurance | Changing secrets must not change the observable behavior in the stated execution and observation model. Public-dependent work and timing noise do not require identical wall-clock durations. | The boundary includes the compiler's emitted code, JIT or translation, instruction behavior and hardware. A compiler can introduce a secret-dependent branch; a data-memory-dependent prefetcher can create an observable access even without an explicit secret-indexed program load. Name the target and observations: branch-free code or a timing test alone does not prove universal non-leakage. |
Where that leaves the code on this page. The museum’s ec-math.js is affine, branching, and uses a linear search to invert a field element because the fields here are tiny teaching examples. It is not production-ready, not constant-time, and not formally verified, and it is not trying to be. What it is is checked: the museum’s test suite compares its result against an independent implementation of the complete projective formulas on all 361 ordered pairs of points on the prime-order curve y² = x³ + 2x + 2 over 𝔽₁₇, identity, inverses and doublings included. Agreement on a tiny curve is evidence about these formulas on this curve; it is not an assurance claim about anything else.
Property testing, proof and timing assurance answer different questions, and passing one says nothing about the others. For side-channel behaviour as a measured phenomenon rather than a source-code property, see what a power-analysis result actually shows and Crypto Lab’s Power Trace, which computes those statistics over simulated leakage.
Joost Renes, Craig Costello and Lejla Batina, “Complete Addition Formulas for Prime Order Elliptic Curves,” EUROCRYPT 2016: the curve class the completeness guarantee is stated for, and its cost. Andres Erbsen, Jade Philipoom, Jason Gross, Robert Sloan and Adam Chlipala, “Simple High-Level Code for Cryptographic Arithmetic — With Proofs, Without Compromises,” IEEE S&P 2019: the proof pipeline, its bounds reasoning, and the trusted compiler and pretty-printer at its edge.
A formula-cost example: “Faster complete formulas and their application to curves with efficient endomorphisms” (2026 preprint), §2/Table 1, PDF pp. 2–3, rewrites the final cross-product block with five instead of six field multiplications, trading one multiplication for five field additions. These are different operation types, not one fewer total operation. Completeness retains the original curve/subgroup conditions. The paper's fixed-base improvement and variable-base slowdown are different author-measured library workloads (§7/Table 8), not browser benchmarks. Our selectable toy curves are not all prime-order; the F17 oracle's guarantee is not transferred to every selection.
Thomas Pornin, “Constant-Time Code: The Pessimist Case”, note dated 6 March 2025, §§1–2,6: reported Clang 18.1.3 -O3 compiler example and bounded useful practices, not a universal impossibility theorem. Sprengers et al., “SecDMP”, extended arXiv v1, 27 October 2026, §§V–VII and Appendix C: baseline-relative hardware non-leakage under a fixed secret partition. Read the prefetcher evidence and its assumptions.
This is the ground floor of ECC
Real elliptic-curve cryptography uses carefully selected large fields, curves and prime-order subgroups. For common 256-bit prime-order groups, generic discrete-log attacks take roughly the square root of the group order, not a search through every field element. These tiny plots are readily enumerable and demonstrate arithmetic, not security.
AES uses a finite field too, but a different kind of one, and the distinction is worth drawing. This exhibit builds GF(p) — arithmetic modulo a prime. The AES S-box lives in GF(2⁸), an extension field of 256 elements whose members are polynomials, added bitwise and multiplied modulo a fixed irreducible polynomial. Same guarantee — every nonzero element has an inverse — reached by different construction, and the S-box maps zero to zero for the inversion step, takes the multiplicative inverse for every nonzero input, and then applies an affine map. The polynomial machinery is next door in Polynomial Rings.
Companion: The Ground Beneath the Curve shows the smooth real-number version and the deep theory of why these curves are so well-behaved.
Sources and scope: NIST SP 800-186 (2023) specifies recommended elliptic-curve domain parameters; the small groups here are teaching examples.