Elliptic Curves & Ed25519

The group law on a curve, why the discrete log there resists index calculus, and why the ecosystem moved from Weierstrass/NIST curves to Curve25519 — completeness, constant time, and no unexplained constants.

Elliptic-curve cryptography gets the same security as RSA or finite-field Diffie–Hellman from dramatically smaller keys — 256 bits versus 3072 — because the best known attack on the elliptic-curve discrete log is generic square-root (n\sqrt{n}, i.e. Pollard rho) rather than the sub-exponential index calculus that erodes RSA and finite-field DH. Smaller keys mean less bandwidth, less computation, and less battery, which is why every modern protocol defaults to curves.

The curve and its group law #

Over a prime field GF(p)GF(p) with p>3p > 3, a short Weierstrass curve is the set of points satisfying

y2≡x3+ax+b(modp),4a3+27b2≢0(modp)y^2 \equiv x^3 + ax + b \pmod p, \qquad 4a^3 + 27b^2 \not\equiv 0 \pmod p

plus a point at infinity O\mathcal{O} that acts as the identity. The non-vanishing discriminant condition rules out singular curves (cusps and self-intersections), where the group structure would collapse.

The points form an abelian group under a geometric "chord and tangent" addition, expressed algebraically as:

  • O\mathcal{O} is the identity; (x,y)+(x,−y)=O(x, y) + (x, -y) = \mathcal{O} (points are inverses when they share xx)
  • Addition, for x1≠x2x_1 \neq x_2, with λ=y2−y1x2−x1\lambda = \dfrac{y_2 - y_1}{x_2 - x_1}:

x3=λ2−x1−x2,y3=λ(x1−x3)−y1x_3 = \lambda^2 - x_1 - x_2, \qquad y_3 = \lambda(x_1 - x_3) - y_1

  • Doubling, for y1≠0y_1 \neq 0, with λ=3x12+a2y1\lambda = \dfrac{3x_1^2 + a}{2y_1}:

x3=λ2−2x1,y3=λ(x1−x3)−y1x_3 = \lambda^2 - 2x_1, \qquad y_3 = \lambda(x_1 - x_3) - y_1

All arithmetic is mod pp, and the divisions are modular inverses — so each addition costs an inversion, which is why implementations work in projective coordinates to defer them.

Hasse's theorem bounds the group order ∣E(Fp)∣\lvert E(\mathbb F_p)\rvert near pp:

p+1−2p≤∣E(Fp)∣≤p+1+2pp + 1 - 2\sqrt{p} \le \lvert E(\mathbb F_p)\rvert \le p + 1 + 2\sqrt{p}

Scalar multiplication nP=P+P+⋯+PnP = P + P + \dots + P is computed by double-and-add in O(log⁡n)O(\log n) steps. The one-way function is the ECDLP: given PP and nPnP, find nn. All known algorithms are exponential — O(n)O(\sqrt{n}) — which is the entire source of ECC's key-size advantage.

Why the ecosystem left Weierstrass curves behind #

The group law above has a defect visible in its own statement: it is a case analysis. Adding a point to itself, adding inverses, and handling O\mathcal{O} are separate branches. Branches on secret data are timing side channels, and forgetting a branch is a correctness bug.

Curve25519 (Bernstein, 2006) is a Montgomery curve y2=x3+486662x2+xy^2 = x^3 + 486662x^2 + x over p=2255−19p = 2^{255} - 19, with a birationally equivalent Edwards form (edwards25519) used for signatures. Its design targets the failure modes rather than the raw math:

Property NIST P-256 (Weierstrass) Curve25519 / Ed25519
Addition formulas incomplete — special cases complete — one formula, every input pair
Constant-time implementation achievable but delicate natural (Montgomery ladder)
Invalid-curve / point validation required, often forgotten input decoding is total, but protocols must reject an all-zero X25519 shared secret
Parameter provenance unexplained NSA-supplied seeds rigid derivation from stated criteria
Cofactor 1 8 — must be handled, and RFC 8032 specifies how
Key / signature size 32 / 64 bytes 32 / 64 bytes

Two primitives are what you actually use, and they are distinct:

  • X25519 — Diffie–Hellman key agreement (RFC 7748). The default in TLS 1.3, SSH, Signal, WireGuard.
  • Ed25519 — signatures (RFC 8032). Deterministic nonce derived from the key and message, removing the nonce footgun by construction.

Domain parameters are part of the algorithm #

A short Weierstrass deployment is not identified by “256-bit ECC.” It needs the field, coefficients, base point, base-point order, and cofactor:

T=(p,a,b,G,n,h).T=(p,a,b,G,n,h).

SEC 2 v1.0 records this sextuple for curves including secp256k1 and secp256r1 and correctly relates a roughly 256-bit prime-order curve to about 128 bits of classical security. Its smaller curves and SHA-1-era status tables are historical, not present recommendations. NIST SP 800-186 (2023) is the current NIST domain-parameter publication and includes approved Weierstrass and Edwards curves.

secp256k1 and secp256r1 are different groups despite equal field size. Bitcoin and Ethereum consensus rules use secp256k1; much of TLS and WebPKI uses P-256/secp256r1. Keys, compressed points, and signatures cannot be moved between them merely because both are “256-bit.”

Source claims audit #

Seeded from a university lab manual (elliptic-curve lab). Status of its load-bearing claims:

Claim from source Status Notes
Weierstrass form, discriminant condition 4a3+27b2≠04a^3+27b^2 \neq 0, point at infinity current Standard
Full group law: identity, inverses, addition and doubling with explicit λ\lambda current Verified by independent recomputation
Hasse's theorem bounds current Correct
Points form an abelian group; nPnP costs ≤2log⁡2n\le 2\log_2 n additions current Double-and-add
ECDH protocol on a curve, abP=baPab P = ba P current Correct
Worked example p=23p=23, y2=x3+10x+13y^2 = x^3+10x+13 current Recomputed: ∣E(Fp)∣=31\lvert E(\mathbb F_p)\rvert = 31, discriminant ≡7\equiv 7, arithmetic confirmed
Definition of supersingular (∣E(Fp)∣=p+1\lvert E(\mathbb F_p)\rvert = p+1) stated without consequence incomplete The source defines it and moves on. It is a disqualifying property — MOV attack; added
"All known algorithms for the inverse problem require exponential time" current True for well-chosen curves; the qualifier is doing heavy lifting, hence curve selection matters
Lab objective text says "master encoding and decoding with the DES cipher" error in source Copy-paste from the DES lab; the lab is about elliptic curves
Source omits Curve25519, Edwards form, constant-time concerns, cofactors — Added; this is what the last decade of deployment is about
Point compression (one coordinate + a sign bit, ~25% smaller public keys, ANSI X9.62 ECDSA) current From the companion lab report rather than the manual; added above with the secp256k1 02/03 encoding and X25519's x-only form

Sources

  1. docsRFC 7748 — Elliptic Curves for Security
  2. docsRFC 8032 — Edwards-Curve Digital Signature Algorithm (EdDSA)
  3. paperCurve25519: new Diffie-Hellman speed records (Bernstein, 2006)
  4. docsSafeCurves: choosing safe curves for elliptic-curve cryptography
  5. docsSEC 2 Version 1.0 — Recommended Elliptic Curve Domain Parameterspdfnotes
  6. docsNIST SP 800-186 — Elliptic Curve Domain Parameters

Searches titles, aliases, headings, summaries, and full text.↑↓ move ↵ open esc close