Cryptography / Elliptic curve cryptography
Elliptic curve cryptography
A strange way to “add” points on a curve turns into one of the strongest one-way functions we know. Seven steps from a drawing to a shared key.
G — the public starting point
Alice — keeps secret a, publishes a·G
Bob — keeps secret b, publishes b·G
// THE SHORT VERSION
In 30 seconds
Elliptic curve cryptography builds a one-way function out of geometry: two points on a curve can be “added” to give a third point on the same curve.
Adding a point to itself k times is fast, even for an enormous k. Given only the start and end points, recovering k is believed to be infeasible.
That gap gives the security of RSA with far smaller keys: a 256-bit curve key is comparable to a 3072-bit RSA key.
Elliptic curve cryptography, step by step
STEPS01 / 07
Toy curve over F₉₇ with 100 points. Real curves like P-256 or Curve25519 work mod a ~256-bit prime.
STEP 01 / 07
A curve, not an ellipse
THE MATH
y² = x³ + ax + b
here: a = −3, b = 3
- Step 1: A curve, not an ellipse. An elliptic curve is every point (x, y) that satisfies y² = x³ + ax + b. Because y appears squared, the curve is a perfect mirror image across the x-axis.
- Step 2: Adding two points. Draw the line through P and Q. It always meets the curve at exactly one more point. Mirror that point across the x-axis and you have P + Q. Strange rule, but it behaves like real addition.
- Step 3: Doubling a point. To add P to itself there is no second point, so use the tangent line at P instead. It meets the curve once more; flip that point and you have 2P. Doubling is the workhorse of every ECC computation.
- Step 4: Move to whole numbers. Computers need exact answers, so real cryptography uses the same rule on whole numbers wrapped around a prime. The smooth curve becomes a cloud of dots, but the chord-and-tangent formulas still work.
- Step 5: Double G by formula. No drawing needed now — the tangent rule becomes arithmetic mod 97. “Dividing” by 20 means multiplying by its inverse, 34, because 20 × 34 = 680 = 7 × 97 + 1.
- Step 6: Hop to k·G — one way. Repeated adding makes G hop around the grid with no visible pattern. Going forward is fast (double-and-add needs about log₂ k steps). Going backward — which k gave this point? — has no known shortcut. That gap is the security.
- Step 7: ECDH: share a secret. Diffie–Hellman on a curve. Each side keeps a private number, publishes k·G, and multiplies the other’s point by its own secret. Both reach 77G — and since G has order 50, that is the same point as 27G.
VALUES SO FAR
curve····public
G····public
2G····derived
order····public
a····secret
b····secret
A · B····wire
S····secret
// PLAYGROUND
Try it yourself
// YOUR PROGRESS
// BEFORE
Learn this first
Spotted a mistake on this page?