Elliptic-Curve Cryptography
A satellite with a low-power processor must sign telemetry data. It must do this before a single AA battery runs dry. A browser must complete a key exchange in milliseconds. A user must not notice any delay. Both problems share a constraint. They require strong security with minimal computation and minimal bandwidth. Classical public-key systems built on modular arithmetic solve the security problem. Examples include RSA and Diffie-Hellman over integers mod a prime. But they demand keys of 2048 or 3072 bits. This is needed to stay ahead of factoring and index-calculus attacks. Elliptic-curve cryptography (ECC) delivers the same security guarantees. It uses groups built from the points on an elliptic curve. This differs from using the integers modulo a prime. The Discrete Logarithm Problem still sits at the core. But the group in which it is posed has no known sub-exponential attack. This is unlike the index calculus used against classical systems. The consequence is dramatic. A 256-bit elliptic-curve key offers security comparable to a 3072-bit RSA key. Smaller keys mean smaller signatures and faster scalar multiplications. They also mean less power consumed per handshake. This is exactly what mobile devices, embedded systems, and blockchains need. This article builds the elliptic-curve group from its algebraic definition upward. It covers what a curve is. It explains how point addition forms a group. It shows how scalar multiplication implements exponentiation. It also explains why the resulting discrete-log problem (the ECDLP) is believed so much harder per bit. This is compared to its classical counterpart. It stays entirely within the group-theoretic core. This includes key generation and the elliptic-curve analog of Diffie-Hellman. It does not yet build the Digital Signatures schemes. Nor does it cover the The TLS Handshake protocols that consume this machinery. By the end, a reader should be able to hand-trace point addition and doubling. This should work over a small curve. A reader should state precisely why ECDLP resists known sub-exponential algorithms. A reader should also reason about the real security-per-bit tradeoff. This tradeoff makes ECC the default choice in modern protocols.
- An elliptic curve over a finite field defines a set of points that forms an abelian group under a geometric "chord-and-tangent" addition rule.
- Public-key operations become scalar multiplication `kP` (adding a point `P` to itself `k` times) — the elliptic-curve analog of modular exponentiation.
- The Elliptic Curve Discrete Logarithm Problem (ECDLP) — recovering `k` from `P` and `kP` — has no known sub-exponential attack, unlike factoring or classical discrete log.
- Because the best general attack (Pollard's rho) takes `O(√n)` group operations, an `n`-bit curve needs roughly `n/2`-bit security, letting keys shrink drastically versus RSA/DH.
- Fast, correct point arithmetic (double-and-add) computes `kP` in `O(log k)` group operations, each a handful of finite-field multiplications.
- ECC underlies ECDH key exchange, ECDSA/EdDSA signatures, and nearly all modern TLS, SSH, and cryptocurrency key material.
Elliptic-curve groups let you pose the discrete logarithm problem in a setting with no known sub-exponential attack, so the same security level as RSA needs far fewer bits.
The idea
An elliptic curve over a field `F` (in cryptography, a large finite field `F_p` or `F_{2^m}`) is the set of points `(x, y)` satisfying a cubic equation, together with a special point at infinity `O`. The most common form used in cryptography is the short Weierstrass equation: ``` y² = x³ + ax + b (mod p) ``` with the non-singularity condition `4a³ + 27b² ≠ 0 (mod p)`, which guarantees the curve has no cusps or self-intersections — a requirement for the group law below to be well defined. The remarkable fact is that the points on this curve, plus the point at infinity `O`, form an abelian group under a geometrically defined addition rule: draw the line through two points, find its third intersection with the curve, and reflect across the x-axis. This "chord-and-tangent" rule is associative — a nontrivial algebraic fact, provable via the theory of divisors on curves — with `O` as identity and each point `P = (x, y)` having inverse `−P = (x, −y)`. Cryptographic use replaces ordinary exponentiation `g^k mod p` with scalar multiplication `kP = P + P + ... + P` (`k` times), computed efficiently by double-and-add, the exact analog of fast modular exponentiation. The hard problem — the Elliptic Curve Discrete Logarithm Problem (ECDLP) — is: given `P` and `Q = kP`, find `k`. This is the same conceptual problem as The Discrete Logarithm Problem in `Z_p`, transported into a new group. What changes is the difficulty* of that problem relative to the group's size, which is the entire point of ECC.
How it works
Setting up the group. A curve for cryptography is specified by domain parameters: the field `F_p`, coefficients `a, b`, a base point `G` (the generator), the order `n` of `G` (smallest positive integer with `nG = O`), and a cofactor `h`. Standardized curves (P-256, Curve25519, secp256k1) fix these so implementers never choose them ad hoc — a poorly chosen curve can leak the private key.
Point addition (the group law). For two distinct points `P = (x1, y1)` and `Q = (x2, y2)` on `y² = x³ + ax + b`: ``` λ = (y2 − y1) / (x2 − x1) (slope of the line through P, Q) x3 = λ² − x1 − x2 y3 = λ(x1 − x3) − y1 ```
Point doubling (adding `P` to itself) uses the tangent line at `P` instead: ``` λ = (3x1² + a) / (2y1) x3 = λ² − 2x1 y3 = λ(x1 − x3) − y1 ``` All arithmetic is performed modulo `p`; division means multiplication by the modular inverse. If `x1 = x2` and `y1 = −y2`, the result is `O` (the lines are vertical, meeting the curve "at infinity").
Scalar multiplication computes `kP` using double-and-add, mirroring square-and-multiply exponentiation: ```pseudocode function SCALAR-MULT(P, k): // computes k P using the group law, k >= 0 if k == 0: return O // identity (point at infinity) R = O // accumulator Q = P // running doubling of P bits = BINARY-REPRESENTATION(k) // little-endian bit list for b in bits: if b == 1: R = POINT-ADD(R, Q) Q = POINT-DOUBLE(Q) return R ``` ```pseudocode function POINT-ADD(P1, P2): if P1 == O: return P2 if P2 == O: return P1 if P1.x == P2.x and P1.y != P2.y: return O // P2 == -P1 if P1 == P2: return POINT-DOUBLE(P1) lambda = (P2.y - P1.y) MOD-INVERSE(P2.x - P1.x, p) mod p x3 = (lambdalambda - P1.x - P2.x) mod p y3 = (lambda(P1.x - x3) - P1.y) mod p return (x3, y3) function POINT-DOUBLE(P): if P == O: return O if P.y == 0: return O // tangent is vertical lambda = (3P.xP.x + a) MOD-INVERSE(2P.y, p) mod p x3 = (lambdalambda - 2P.x) mod p y3 = (lambda*(P.x - x3) - P.y) mod p return (x3, y3) ```
Key exchange (ECDH). Alice picks a random private scalar `d_A ∈ [1, n-1]` and publishes `Q_A = d_A · G`. Bob does the same with `d_B, Q_B`. Both compute the shared secret: ``` S = d_A · Q_B = d_A · (d_B · G) = (d_A · d_B) · G = d_B · Q_A ``` An eavesdropper sees `G, Q_A, Q_B` but, to recover `S`, must either solve ECDLP to extract `d_A` or `d_B`, or solve the related Computational Diffie-Hellman problem directly in the curve group. This is the elliptic-curve analog of classical Diffie-Hellman, foreshadowing its full use inside The TLS Handshake.
Complexity & correctness
Group operation cost. Each `POINT-ADD` or `POINT-DOUBLE` requires a constant number of finite-field operations: one modular inversion (or, with projective coordinates, none — inversions are deferred and batched) plus a handful of multiplications and additions mod `p`. Over a field with `w`-bit elements, each multiplication costs `O(w²)` with schoolbook arithmetic or `O(w^{1.585})` with Karatsuba, so one group operation costs `O(M(w))` where `M(w)` is the field-multiplication cost.
Scalar multiplication cost. `SCALAR-MULT` performs one doubling per bit of `k` and one addition per set bit, so for a `w`-bit scalar it costs `O(w)` group operations, i.e. `O(w · M(w))` total field operations — the direct analog of fast modular exponentiation's `O(w)` squarings and multiplications. This is efficient: computing `kP` naively by repeated addition would cost `O(k) = O(2^w)` operations, exponentially worse.
Correctness of double-and-add. The invariant maintained by the loop is: after processing bit `i` (from least significant), `R` holds `(k mod 2^{i+1}) · P`. Initially `R = O = (k mod 1)·P` trivially. If the invariant holds before processing bit `i`, then: ``` new R = R + [bit_i]·(2^i · P) = (k mod 2^i)·P + bit_i·2^i·P = (k mod 2^{i+1})·P ``` because `Q` is maintained as `2^i · P` at step `i` via repeated doubling. After all `w` bits are processed, `R = (k mod 2^w)·P = k·P` since `k < 2^w`. This is exactly the same inductive argument used to prove square-and-multiply correct for exponentiation.
Why the discrete log is hard here. The best general-purpose attack against ECDLP is Pollard's rho algorithm, which finds `k` in expected `O(√n)` group operations, where `n` is the order of the base point — using a birthday-paradox argument over a pseudo-random walk on the group. Crucially, there is no known analog of index calculus for generic elliptic curves. Index calculus is what makes classical discrete log (and factoring, via a related structure) breakable in sub-exponential time `L_p[1/3, c]`, because `Z_p*` has a rich supply of "smooth" elements (products of small primes) that let an attacker build linear relations. Elliptic-curve groups have no known analogous notion of smoothness, so Pollard's rho's `O(√n)` remains the best known attack for well-chosen curves.
The security-per-bit consequence. If `n ≈ 2^m`, breaking ECDLP costs about `2^{m/2}` group operations. To match 128-bit security, `m ≈ 256` bits suffices. RSA and classical DH, vulnerable to sub-exponential index calculus, need moduli of roughly 3072 bits for the same 128-bit security level — because their effective work factor is `L_p[1/3, c] = exp((c + o(1))(ln p)^{1/3}(ln ln p)^{2/3})`, not `√p`. This asymptotic gap — square-root security versus sub-exponential security — is precisely why ECC keys, ciphertexts, and signatures are so much smaller for equivalent strength.
Honest tradeoffs. ECC is not free of risk: curve parameters must be chosen carefully (some historical curves, and certain constructions with hidden structure, invite suspicion or admit attacks), implementations must run in constant time to avoid side-channel leakage during scalar multiplication, and special curves (supersingular curves, or curves with small embedding degree) can transfer ECDLP to an easier problem in a related finite field via the MOV attack — standard curves avoid this by design. Pairing-based and quantum threats (Shor's algorithm breaks ECDLP in polynomial time on a quantum computer, exactly as it breaks factoring) apply equally to ECC and classical schemes, motivating post-quantum alternatives.
Worked example
Use the toy curve `E: y² = x³ + 2x + 2 (mod 17)`. Check non-singularity: `4(2)³ + 27(2)² = 32 + 108 = 140 ≡ 4 (mod 17) ≠ 0`, so the curve is valid. Take base point `G = (5, 1)`. Verify: `y² = 1`; `x³ + 2x + 2 = 125 + 10 + 2 = 137 ≡ 137 - 8·17 = 137 - 136 = 1 (mod 17)`. It checks out. Compute `2G` (point doubling at `(5,1)`): ``` λ = (3·5² + 2) · (2·1)^-1 mod 17 = (75 + 2) · 2^-1 mod 17 = 77 · 9 mod 17 (since 2·9=18≡1, so 2^-1 = 9) = 693 mod 17 = 693 - 40·17 = 693 - 680 = 13 x3 = λ² - 2x1 = 169 - 10 = 159 mod 17 = 159 - 9·17 = 159-153 = 6 y3 = λ(x1 - x3) - y1 = 13·(5 - 6) - 1 = 13·(-1) - 1 = -14 mod 17 = 3 ``` So `2G = (6, 3)`. Verify: `y² = 9`; `x³+2x+2 = 216+12+2 = 230 ≡ 230 - 13·17 = 230-221 = 9`. Correct. Now compute `3G = 2G + G = (6,3) + (5,1)`: ``` λ = (1 - 3) · (5 - 6)^-1 mod 17 = (-2) · (-1)^-1 mod 17 = (-2) · (-1) mod 17 (since (-1)^-1 = -1 mod 17) = 2 x3 = λ² - x1 - x2 = 4 - 6 - 5 = -7 mod 17 = 10 y3 = λ(x1 - x3) - y1 = 2·(6 - 10) - 3 = 2·(-4) - 3 = -11 mod 17 = 6 ``` So `3G = (10, 6)`. Verify: `y² = 36 ≡ 2`; `x³+2x+2 = 1000+20+2=1022 ≡ 1022 - 60·17 = 1022-1020 = 2`. Correct.
| Step | Bits of k processed (k=3 = `11`₂) | R (accumulator) | Q (running doubling) |
|---|---|---|---|
| init | — | O | G = (5,1) |
| bit0 = 1 | R += Q | R = (5,1) | Q = 2G = (6,3) |
| bit1 = 1 | R += Q | R = (5,1)+(6,3) = 3G = (10,6) | Q = 4G |
This traces `SCALAR-MULT(G, 3)` exactly: it reproduces `3G = (10,6)`, matching the direct chord computation above and confirming the double-and-add invariant. In a real ECDH exchange over this toy curve (never use it in practice — the field is far too small), if Alice's private key is `d_A = 3` her public key is `Q_A = 3G = (10, 6)`, published in the clear. Recovering `d_A = 3` from `G` and `Q_A` is the ECDLP; over a 17-element field brute force is instant, but over a 256-bit prime field it requires roughly `2^128` operations by Pollard's rho — computationally infeasible.
Common pitfalls & traps
| Pitfall | Why it happens | Fix |
|---|---|---|
| Reusing a nonce in ECDSA-style signing | Two signatures with the same nonce leak the private key via simple algebra | Always use a fresh, unpredictable (or deterministic-per-message) nonce |
| Non-constant-time scalar multiplication | Branching on bits of `k` leaks timing/power info about the private key | Use constant-time ladders (Montgomery ladder) regardless of bit values |
| Using a non-standard or unvalidated curve | Custom curves may have small subgroup or MOV-vulnerable structure | Use vetted curves (P-256, Curve25519, secp256k1) with published parameters |
| Not checking point-at-infinity / doubling edge cases | `POINT-ADD` on `P = Q` or `P = -Q` needs separate formulas | Explicitly branch on these cases as shown in pseudocode |
| Confusing curve order `n` with field size `p` | Security depends on the order of the base point, not the field | Always reduce scalars mod `n`, and pick `d` in `[1, n-1]` |
| Small-subgroup / invalid-curve attacks in key exchange | Sending a point not on the curve, or of small order, can leak key bits | Validate that received points lie on the curve and have full order |
Pioneers & history
The elliptic-curve approach to public-key cryptography was proposed independently by two researchers who saw that the group law on elliptic curves — long studied in number theory for its role in Fermat-style Diophantine problems — could host the discrete logarithm problem far more efficiently than integer groups.
Origins · 1 minNeal Koblitz and how this was discovered
Where this matters
ECC is the workhorse of modern public-key infrastructure. TLS 1.3 uses ECDHE (Elliptic Curve Diffie-Hellman Ephemeral) almost exclusively for key exchange, giving every HTTPS connection forward secrecy at a fraction of the computational cost of RSA-based key transport — a mechanism explored fully in The TLS Handshake. SSH, WireGuard, and Signal's protocol rely on Curve25519 for both key agreement and, via EdDSA, signatures — the natural next topic after this one, Digital Signatures, builds ECDSA and Schnorr-style schemes directly on the scalar-multiplication machinery introduced here. Bitcoin, Ethereum, and most blockchain systems derive every wallet address and transaction signature from secp256k1 point arithmetic — an entire financial ecosystem resting on the hardness of ECDLP. Embedded devices, smart cards, and IoT sensors favor ECC precisely because a 256-bit key fits in far less memory and computes far faster than an RSA-equivalent key, extending battery life and reducing silicon area. Government and NIST-approved cryptographic suites (Suite B / CNSA) mandate ECC curves for classified and sensitive communications, reflecting confidence built over decades of cryptanalytic scrutiny.
Ask the tutor: How does the Pohlig-Hellman algorithm actually recombine discrete logs across small prime-order subgroups using the Chinese Remainder Theorem?
Why can't index calculus attack elliptic curve groups the way it attacks RSA and classical Diffie-Hellman?
Index calculus relies on a notion of "smooth" elements — numbers expressible as products of small primes — which exist abundantly in `Z_p*` and let an attacker build a system of linear relations solvable in sub-exponential time. Elliptic curve groups have no known analogous factorization structure: there is no natural small "factor base" of curve points from which arbitrary points can be efficiently expressed as combinations. Decades of research (including attempts to adapt index calculus to curves) have failed to find a sub-exponential attack for well-chosen curves, leaving Pollard's rho's `O(√n)` as the best general method. This structural gap, not any difference in key size mechanics, is the real reason ECC keys can be so much smaller.
What happens if a curve has a small or "bad" order?
Security depends on the order `n` of the base point `G`, not just the size of the field `p`. If `n` factors into small primes, the Pohlig-Hellman algorithm can solve ECDLP separately in each small subgroup and recombine the results via the Chinese Remainder Theorem, drastically reducing the attacker's work below `O(√n)`. Standard curves are chosen so that `n` is prime (or has only one large prime factor with a small cofactor `h`), closing this avenue. Implementations must also validate that received public points actually lie on the curve and belong to the correct-order subgroup to avoid small-subgroup attacks during key exchange.
How does ECDH differ from classical Diffie-Hellman in practice?
The algebraic structure is identical: each party raises a public generator to a private secret and combines results to reach a shared value neither could compute alone by eavesdropping. Classical DH exponentiates `g^k mod p` in `Z_p*`; ECDH computes `kG` in an elliptic curve group. The practical difference is efficiency: ECDH needs roughly 256-bit keys for 128-bit security versus roughly 3072-bit keys for classical DH, shrinking both computation and the size of exchanged public values. Both are vulnerable to man-in-the-middle attacks unless combined with authentication, which is why ECDHE in TLS is always paired with a signature scheme.
Are all elliptic curves equally secure?
No. Security depends on careful parameter choice: the curve must avoid special structures like supersingularity or small embedding degree, which enable the MOV attack that transfers ECDLP into an easier discrete-log problem in a related finite field's multiplicative group. The base point's order should be (nearly) prime to block Pohlig-Hellman. Curves also differ in implementation friendliness — Curve25519 and Curve448 are designed in Montgomery form specifically to make constant-time, side-channel-resistant implementations easy, while some older NIST curves have drawn scrutiny over how their parameters were originally generated.
Does quantum computing threaten ECC more than RSA?
Both are broken by the same underlying quantum technique: Shor's algorithm solves both integer factorization and discrete logarithm problems (including ECDLP) in polynomial time on a sufficiently large quantum computer. Neither RSA nor ECC offers any inherent quantum resistance; the vulnerability is structural, tied to the abelian hidden-subgroup problem that Shor's algorithm solves generically. This shared exposure is exactly why NIST's post-quantum cryptography standardization targets entirely different mathematical problems, such as lattice-based and hash-based schemes, rather than trying to patch either RSA or ECC.
Why is scalar multiplication analogous to modular exponentiation?
Both problems ask you to repeatedly combine a group element with itself using an efficient binary method rather than a slow linear method. Modular exponentiation computes `g^k mod p` via square-and-multiply in `O(log k)` multiplications; scalar multiplication computes `kP` via double-and-add in `O(log k)` point operations. The group operations differ (multiplication mod p versus the chord-and-tangent addition rule) but the algorithmic template, its complexity, and its correctness proof by induction on bit position are structurally identical — this is why anyone comfortable with fast exponentiation can learn ECC's core operation quickly.
What is Pollard's rho algorithm in one paragraph?
Pollard's rho is a generic algorithm for solving the discrete logarithm problem in any group, using a pseudo-random walk over group elements and the birthday paradox to find a collision — two different linear combinations of `P` and `Q` that land on the same group element — from which the discrete log can be extracted by simple algebra. It requires only `O(√n)` steps and `O(1)` memory (in its parallelized, distinguished-point form), with no dependence on any special structure of the group. Because it applies equally to any cyclic group, it sets a universal square-root-security floor, which is exactly the bound that makes 256-bit ECC keys comparable in strength to 128-bit symmetric keys.