Elliptic Curve Playground — песочница эллиптических кривых
Каждый ключ ECDSA — это один скаляр и одно сложение точек, повторённое много раз. Здесь та же арифметика работает над полем, достаточно маленьким, чтобы его нарисовать: выберите кривую, складывайте точки, двигайте ползунок k и смотрите, как прыгает kG, — а затем узнайте, почему обратное вычисление и есть самая трудная часть.
100 % локально — всё работает в браузере, ни на один сервер ничего не отправляется
Достаточно велика, чтобы облако точек перестало выглядеть как узор, и достаточно мала, чтобы полный перебор занимал несколько десятков шагов. Её 100 точек не образуют единого цикла — самый длинный цикл, который даёт здесь генератор, состоит из 50 точек.
y² = x³ + 2x + 3 над F₉₇ — все точки на графике
Щёлкните по любой точке, чтобы сделать её генератором G. Пунктирная линия — это y = p/2: у каждой точки есть пара, зеркальная относительно этой линии, и эта пара — противоположная точка −P. У точек с y = 0, расположенных в нижнем ряду, пары нет: каждая из них противоположна самой себе.
Генератор и скаляр
1G = 1 × (0, 10)
(0, 10)
Прямой путь дёшев: удвоение и сложение
Никто не вычисляет 1G, прибавляя G к самой себе 0 раз. Запишите k в двоичном виде, и понадобится лишь одно удвоение на каждый бит плюс одно сложение на каждый бит, равный 1, — эта идея лежит в основе любой реализации ECDSA, которая затем добавляет к ней оконный метод и вычисления с постоянным временем выполнения.
Обратный путь — самая трудная часть
Обратная задача — по G и 1G найти k — это задача дискретного логарифмирования на эллиптической кривой. На такой маленькой кривой она вовсе не трудна: достаточно пройти по последовательности.
Всё дело именно в этом последнем числе. Даже если запустить параллельно 10⁹ машин, каждая из которых выполняет 10⁹ операций на кривой в секунду, понадобится около 10¹³ лет — в несколько сотен раз больше нынешнего возраста Вселенной. Публично не известно ни одного более быстрого универсального алгоритма для правильно выбранной кривой; именно на этом допущении, а не на секретности формул, держится ключ ECDSA.
From the playground to a real key
Nothing changes between this page and a production key except the size of the numbers. secp256k1 — the curve behind Bitcoin and Ethereum — is y² = x³ + 7, the same equation as the mini-curve above, over a prime just under 2²⁵⁶ instead of 127. P-256, the curve in most TLS certificates and passkeys, is y² = x³ − 3x + b over a different 256-bit prime. Both have a published generator point G and a group order n of about 2²⁵⁶.
A key pair is exactly the two things the Scalar multiplication tab shows. The private key is the scalar k: a random integer in 1 … n − 1. The public key is the point kG: the generator added to itself k times, computed by the same double-and-add ladder, about 256 doublings and a couple of hundred additions. Publishing kG reveals nothing usable about k for the same reason the slider does not — the only known way back is to search, and the search space is the size of the group.
Signing adds one more scalar: a per-signature nonce, multiplied by G to produce r, with s tying the message hash and the private key together. That is why nonce handling is the sharp edge of ECDSA — the arithmetic on this page is unforgiving of a repeated random value. Generate real key pairs and signatures with the Test Vector Generator, or read how this compares with the factoring problem in ECDSA vs RSA.
How it works
The playground enumerates every solution of y² = x³ + ax + b modulo a small prime p by squaring each field element once and matching the results against the right-hand side — a few thousand operations, which is why the plot appears instantly and why the same approach is hopeless for a 256-bit prime. Point addition uses the standard chord-and-tangent formulas with a modular inverse computed by the extended Euclidean algorithm, and kG uses double-and-add, the same ladder a real signing routine walks.
Two sanity checks run on the arithmetic itself: the number of points found always lands inside the interval Hasse's theorem allows around p + 1, and the order of every point divides the group order, as Lagrange requires. The real-number tab draws the identical formulas with ordinary floating-point math, which is only ever a teaching aid — cryptography needs the exactness of integers modulo a prime. Everything is computed locally in your browser; the page makes no network requests and has no inputs worth keeping.