Playground
Try it without installing anything
The playground imports @agntn/curves into the page and runs the tool executors right there. Pick an operation, fill the fields, read the answer. Nothing leaves the tab.
Every state is a link. Change a field and the address changes with it, so a curve and its question can go into a chat or an issue as is. Opening the link runs the same call again.
What does it show? The call twice, once as a curves command and once as the JSON a model sends. Then the answer, with the full tool response one click away.
Polkadot keys too
The sr25519 tool is there with the other two. One chip loads the Substrate dev seed with //Alice hanging off it, and verify says yes to her signature over hello. Now hit one bit off. One flipped bit and it's a plain false.
Sign twice and you get two different signatures. Bug? No, that's schnorrkel mixing fresh randomness into the nonce. Both verify.
Keypair and derive start from exactly one key, so the from row picks which. Derive can start from a seed too, and its hard child shows a seed of its own. Ask for a hard child from a public key and the tool says no. Fair enough, hard needs the seed or the secret.
ECDSA signatures
secp256k1 / sign opens with secret 1 over the block 170 sighash. Not Satoshi's signature. Just one anybody can make, because everybody knows secret 1.
Reload and sign again. Same bytes, RFC 6979 sees to that. Paste the signature into secp256k1 / recover with the recovery ID it shows, and G comes back.
The secret 1 and secret n - 1 chips show up on sign and nonce only. n - 1 is the largest secret there is, and its public key is minus G.
BIP340 signatures
Three leads: bip340 / keypair, bip340 / sign and bip340 / verify. The pi message chip loads the BIP vector that signs pi's hex digits with a key made of e. empty message signs no bytes at all. Both fill every field, secret and aux_rand included, so sign gives the BIP's own bytes.
Now hit fresh random. The random field goes empty, and each run mixes 32 new bytes into the nonce. Different signature every time. Do they all verify? They do.
one bit off waits on verify, where there's a signature to break.
P-256 points and signatures
The leads run from p256 / add to p256 / recover. Try G and 2G and x of G for familiar points. x = 1 fills lift and check with an x no P-256 point has. Lift says "No point of P-256 has this x". Check says false. That x doesn't get to invent a point.
RFC 6979 key loads the key, the SHA-256 digest of the plain English word "sample", and the signature from RFC 6979 appendix A.2.5. Verify says true. one bit off flips a signature bit on verify, which then says false. One bit gets the last word.
Try p256 / sign with the RFC 6979 appendix A.2.5 sample. The r matches, but the RFC's high s comes back low. Want the same inputs again? Pick RFC 6979 key.
In p256 / nonce, k starts a6e3c57d. Keep k secret. With the signature, it gives away the key. In p256 / recover, id 0 finds the RFC key. Id 1 finds another that verifies. Try secret 1 on sign or nonce. Its public key is G.
P-384 points and signatures
The leads run from p384 / add to p384 / recover. Want a point to start with? Try G and 2G or x of G. The x = 1 chip fills lift and check with an x no P-384 point has. Lift says "No point of P-384 has this x". Check says false.
Try RFC 6979 key for the key, SHA-384 digest of "sample", and signature from appendix A.2.6. Verify says true. On verify, one bit off flips a signature bit and turns that answer false. One bit is enough to spoil the signature.
Open p384 / sign on the appendix A.2.6 sample. The r matches, but low s changes the signature bytes. Try RFC 6979 key or secret 1. The latter's public key is G.
p384 / nonce shows k starting 94ed910d. k and the signature give away the key, so keep k secret. Which recovery id finds the RFC key? In p384 / recover, it's 1. Id 0 finds another verifying key. P-256 puts its RFC key behind 0.
P-521 points and signatures
The leads run from p521 / add to p521 / recover. Need a starting point? Try G and 2G or x of G. The x = 3 chip fills lift and check with an x no P-521 point has. Lift says "No point of P-521 has this x". Check says false.
Try RFC 6979 key for the key, SHA-512 digest of "sample", and signature from appendix A.2.7. Verify says true. On verify, one bit off flips a signature bit and turns that answer false. One bit does the damage.
Try p521 / sign with the appendix A.2.7 sample. All 132 signature bytes match the RFC. Its s was already low. Curious about another key? Pick secret 1. Its public key is G.
p521 / nonce gives k starting 01dae2ea. Keep k secret. Anyone with it and the signature can compute the key. In p521 / recover, id 0 finds the RFC key. Id 1 finds another that verifies. RFC 6979 key loads the RFC sample again.
brainpoolP256r1 points and signatures
The leads run from brainpoolp256r1 / add to brainpoolp256r1 / recover. Start with G and 2G or x of G. The x = 0 chip fills lift and check. Lift says "No point of brainpoolP256r1 has this x". Check says false.
P-256's G fills check and the point field with P-256's compressed generator. Check says true. Same length, wrong curve, still a valid point here.
The Wycheproof key chip loads the key, digest and signature from tcId 1. The digest is SHA-256 of the six bytes 313233343030. Verify says true. On verify, one bit off flips a signature bit. Verify then says false.
Try brainpoolp256r1 / sign with secret 1 and the Wycheproof digest. The public key is G. That's everybody's secret. Want another secret? RFC 7027 key loads the one from appendix A.1.
brainpoolp256r1 / nonce shows k. Keep it secret. k and the signature give away the key. RFC 6979 has no Brainpool vector to compare. In brainpoolp256r1 / recover, id 0 finds the Wycheproof key. Id 1 finds another key. Wycheproof key reloads the sample.
brainpoolP384r1 points and signatures
The leads cover point math and ECDSA. G and 2G fills both points and scalar 3. x of G fills x. Try x = 0 in lift and check. Lift says "No point of brainpoolP384r1 has this x". Check says false.
Will a P-384 point pass? P-384's 2G fills the point, and check says true. P-384's compressed G fails instead. Both curves use 48-byte coordinates. Length doesn't tell you the curve.
The default G fails with the default digest and signature. Wycheproof key loads a matching key, digest and signature. The digest is SHA-384 of the six bytes 313233343030. Verify says true. one bit off flips a signature bit. Verify then says false.
Start with brainpoolp384r1 / sign. Secret 1 and the Wycheproof digest give public key G. That's an easy secret to guess. Want a different key pair? Pick RFC 7027 key for the secret from appendix A.2.
brainpoolp384r1 / nonce shows 48 bytes of k. Keep k secret. With the signature, it gives away the key. RFC 6979 prints no Brainpool vectors. In brainpoolp384r1 / recover, ids 0 and 1 both find verifying keys. Only 0 finds the Wycheproof key. Wycheproof key reloads that sample.
brainpoolP512r1 points and signatures
Same leads again, from add to recover. G and 2G fills both points and scalar 3. x of G fills x.
Want a point from a small x? x = 0 makes lift report "No point of brainpoolP512r1 has this x". Check says false. At x = 1 and 2, lift also finds nothing. x = 3 is the first hit. Lift gives two points. Check says true.
This curve has no length twin here. Its coordinates are 64 bytes. P-384 uses 48, P-521 uses 66. Their points are refused on length alone. Right length still doesn't guarantee a valid point. Use check for that.
The default G fails verification. Wycheproof key fills the matching key, digest and signature. Verify then says true. The digest is SHA-512 of the six bytes 313233343030. SHA-512 fits the 512-bit n exactly. one bit off flips a signature bit. Verify then says false.
Give brainpoolp512r1 / sign a try. Secret 1 signs the Wycheproof digest, and its public key is G. That's not the Wycheproof signature. Try RFC 7027 key for the secret from appendix A.3. secret 1 brings G back.
What does brainpoolp512r1 / nonce show? A 64 byte k. Keep it secret. k plus the signature gives away the key. RFC 6979 has no Brainpool vector for comparison. In brainpoolp512r1 / recover, id 0 finds the Wycheproof key. Id 1 finds another key. Wycheproof key reloads the sample.
Ed25519 signatures
Three leads this time: ed25519 / keypair, ed25519 / sign and ed25519 / verify. The RFC 8032 test 1 and RFC 8032 test 2 chips fill all of them, secret included. Test 2 signs a single byte, 72.
Sign either one and hold it next to the RFC. Same bytes. Reload and sign again. Still the same bytes. Boring, and that's the point.
The order 8 key chip is a lousy key with a surprising signature. It verifies under ZIP 215. Tick the strict checkbox and it fails. That chip and one bit off show up on verify only, where there's a signature to break.
The secret sits in the address bar like every other field. Fine for RFC vectors. Not for a key you care about.
Ed448 signatures
The ed448 / verify lead checks RFC 8032 signatures. Start with the RFC 8032, 1 octet chip. The context foo chip gives you the context vector.
Try wrong context next. It toggles between empty and 666f6f, and the answer changes. The one bit off chip flips a signature bit. One bit is enough to spoil the party.