Math
Overview
What the package computes. Short Weierstrass curves over a prime you pick and secp256k1 on its own
Two kinds of curve
Every curve here has the short Weierstrass form, y² = x³ + ax + b, over the integers mod a prime p. That covers the toy curves of a CTF and secp256k1 alike. The difference is in what you hand over.
| Curves you define | secp256k1 | |
|---|---|---|
| Import | @agntn/curves | @agntn/curves/secp256k1 |
| Curve | defineCurve({ a, b, p }) | fixed, from SEC 2 |
| Points | { x, y } as bigints, null for infinity | SEC1 hex, infinity refused |
| Scalars | any bigint | 1 to n - 1, hex or bigint |
| Extra | counting, listing, orders, logs | scalars mod n, lifting x |
| Agent tool | curves_compute | curves_secp256k1_compute |
Why two? A toy curve is about the group. Count the points, find an order, take a log. secp256k1 is about keys. Nobody counts its points, and a log on it is not happening.
Pages
- Curves and points: define a curve, add and multiply points, check one.
- Orders and logs: count, list, orders, discrete logs, and how far each goes.
- secp256k1: SEC1 points, scalars mod n, lifting x.