ecdsa.com

Lesson 1 of 7 · about 8 minutes

Points on a curve

An elliptic curve over a finite field is a short list of coordinate pairs. Learn to test whether a pair is on the list, and count the whole thing.

The picture most people carry around of an elliptic curve — a smooth loop and a sweeping arm, drawn on graph paper — is a real object, but it is not the one cryptography uses. Real numbers have rounding, and rounding has no place in a system where a single wrong bit must invalidate a signature. So the coordinates are pulled back to a finite set: the integers 0 through p − 1 for some prime p, with every addition and multiplication reduced modulo p. Nothing is approximate, nothing is continuous, and the curve stops being a line at all.

What survives is the equation. A curve in short Weierstrass form isy² = x³ + ax + b, and a pair of numbers is on the curve when the two sides come out equal modulo p. That is the whole definition, and it is a test you can run with nothing but multiplication.

the curve this course uses
p = 17          the field: coordinates are 0..16, arithmetic wraps at 17
a = 2, b = 2    the curve:  y^2 = x^3 + 2x + 2   (mod 17)

is (5, 1) on it?
  left  : 1^2                = 1
  right : 5^3 + 2*5 + 2 = 137 = 8*17 + 1 = 1
  equal -> yes

Because there are only 17 possible x values and 17 possible y values, there are 289 candidate pairs in total, and you could test every one of them by hand in an afternoon. Eighteen of them pass. Add one more element — the point at infinity, written O — and you have the complete curve: nineteen things.

Three facts that will keep coming back

  • The set is symmetric. If (x, y) satisfies the equation then so does (x, p − y), because both have the same square. Points come in mirrored pairs straddling the middle of the plot, and that mirror is exactly the negation operation you will meet in the next lesson.
  • Some x values carry nothing. For a given x, a point exists only if the right-hand side happens to be a perfect square modulo 17. Roughly half of the residues are, so roughly half the columns are empty. Eight of the seventeen are, on this curve.
  • O is not decoration. It is the identity element — the thing P + (−P) has to equal, the way 0 is what n − n equals. Without it, addition on the curve would have holes in it and there would be no group to do cryptography in.

Two sanity checks apply to any curve like this. First, the equation must be non-degenerate:4a³ + 27b² ≠ 0 modulo p, or the shape has a cusp and the addition rule falls apart. Here 4·8 + 27·4 = 140 = 4 mod 17, comfortably non-zero. Second, Hasse’s theorem says the number of points always lands within 2√p of p + 1 — here, between 10 and 26. Nineteen fits, as it must.

Your turn

Which of these six pairs are points of the curve?

The curve is y² = x³ + 2x + 2 over F₁₇. Tick every pair that satisfies it. For each one, square the y, evaluate the right-hand side at the x, and compare — both sides reduced modulo 17.

0 of 6 ticked
Show me one worked example

Take (13, 7). The left-hand side is 7² = 49, and 49 = 2·17 + 15, so y² = 15. The right-hand side is 13³ + 2·13 + 2 = 2197 + 28 = 2225, and 2225 = 130·17 + 15, so it is 15 as well. The two agree, so the pair is on the curve. You never need the big intermediate numbers: reduce as you go, and 13² = 169 = 16, 16·13 = 208 = 4, 4 + 26 + 2 = 32 = 15.

Your turn

How many points does this curve have in total?

Count every pair that satisfies the equation, and do not forget the point at infinity — the extra element that makes the set a group. The table below does the per-x arithmetic for you; the counting is yours.

The residue table appears once you have checked your answer above — it lists every point on the curve, which would give that first task away. You can also count without it: for each x from 0 to 16, work out x³ + 2x + 2 mod 17 and ask whether the result is a square.

What you now know

  • A curve over a finite field is a finite set of (x, y) pairs, not a drawn line.
  • Testing membership is one squaring, one cube and a comparison — nothing more.
  • Most x values carry two points, some carry none, and the point at infinity is always in the set.