Finite Fields

The Problem with Real Numbers

So far, we’ve drawn smooth curves with real numbers.

But computers can’t store infinite decimal precision. And cryptography needs exact arithmetic.

The solution: work with integers modulo a prime pp.


Modular Arithmetic

Instead of:

y2=x3+7y^2 = x^3 + 7

We compute:

y2modp=(x3+7)modpy^2 \mod p = (x^3 + 7) \mod p

Same equation as before, we just added modp\mod p to both sides.

Now xx and yy can only be integers from 00 to p1p-1.


A Small Example

Let’s use p=17p = 17 and the curve y2=x3+7y^2 = x^3 + 7.

Is (2,0)(2, 0) on the curve?

y2mod17=02mod17=0y^2 \mod 17 = 0^2 \mod 17 = 0

x3+7mod17=8+7mod17=15x^3 + 7 \mod 17 = 8 + 7 \mod 17 = 15

0150 \neq 15, so no.


Is (5,8)(5, 8) on the curve?

y2mod17=64mod17=13y^2 \mod 17 = 64 \mod 17 = 13

x3+7mod17=125+7mod17=132mod17=13x^3 + 7 \mod 17 = 125 + 7 \mod 17 = 132 \mod 17 = 13

13=1313 = 13, so yes!


What Changes?

The curve is no longer smooth. It becomes a scattered set of points.

But the key insight: point addition still works.

The same formulas apply, just with modular arithmetic. The scattered points still form a group, and we can still do kGkG efficiently.

This is how real cryptographic curves work. secp256k1 (used by Bitcoin) uses a 256-bit prime.