This explanation visualizes how elliptic-curve cryptography works by building from geometry to cryptography. It introduces elliptic curves in the form y^2 = x^3 + Ax + B and explains point addition geometrically (line through two points or tangent, find third intersection, negate y), emphasizing commutativity and associativity. It then develops modular arithmetic in a finite field Fp (using p = 23 as an example): addition and multiplication modulo p, negation as p − n, multiplicative inverses for division, and square roots in the field. Those building blocks are combined using a toy curve over F61, showing how to compute curve points for each x, choose a base point P = (5,7) with order 73, and visualize point addition in the finite field.
The technical specifics include algebraic formulas for adding two points (λ = (y2 − y1)/(x2 − x1), x3 = λ^2 − x1 − x2, y3 = λ(x1 − x3) − y1) and for point doubling (λ = (3x1^2 + A)/(2y1)). Efficient scalar multiplication uses double-and-add (compute 2P, 4P, 8P, … and combine). Those operations enable a Diffie-Hellman style key exchange: Alice and Bob exchange k_aP and k_bP and both compute k_ak_bP as a shared secret. The explanation then maps the toy example to real use: Curve25519 (y^2 = x^3 + 486662x^2 + x) over F_(2^255−19) with a base-point order ~2^252 and 256-bit private scalars, and provides code on GitHub.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.