楕円曲線プレイグラウンド
ECDSA の鍵はすべて、1 つのスカラーと、繰り返される点の加算でできています。ここでは同じ演算を、描画できるほど小さな体の上で実行します。曲線を選んで点を加算し、k をスライドさせて kG が飛び回る様子を観察したら、その計算を逆にたどることがなぜ難しいのかを確かめてください。
100% ローカル:すべてブラウザー内で処理され、どのサーバーにも何も送信されません
点の分布が模様に見えなくなるほど大きく、全探索が数十ステップで終わるほど小さい曲線です。100 個の点は 1 つの巡回にはまとまらず、どの生成元を選んでも、ここで得られる列の長さは最長で 50 です。
F₉₇ 上の y² = x³ + 2x + 3:全点のプロット
任意の点をクリックすると、その点が生成元 G になります。破線は y = p/2 です。どの点にも、この線を挟んで対称な位置に相手の点があり、その相手が逆元 −P です。y = 0 の点(最下段に並ぶ点)には相手の点がなく、それぞれが自分自身の逆元です。
生成元とスカラー
1G = 1 × (0, 10)
(0, 10)
順方向の計算は軽い:2 倍算と加算
1G を、G を自分自身に 0 回足して計算する人はいません。k を 2 進数で表せば、1 ビットごとに 2 倍算を 1 回、値が 1 のビットごとに加算を 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.