verklegarden / crysol

Elliptic curve cryptography in pure Solidity for on- and offchain operations
Apache License 2.0
54 stars 3 forks source link

tests: Add test vectors from Paul Miller's `noble-curves` #23

Open pmerkleplant opened 3 months ago

pmerkleplant commented 3 months ago

Paul Miller's noble-curves project provides different test vectors crysol should test again:

Note that .json files should be used, which can be injected either via forge's stdJson library or simple shell script using cast to abi-encode the vectors.

obatirou commented 1 day ago

Made the first part with https://github.com/verklegarden/crysol/pull/32 for secp256k1 Point validity and de/encoding vectors. For ECDSA it will be in an other PR. From my understanding: to use the verify function from the ECDSA library, one would need to do some processing on vector values as it uses a scalar as a privateKey. Hence, one would need to get the SecretKey from the scalar d. For that it would require to have access to secretKeyFromUint from Secp256k1.

pmerkleplant commented 18 hours ago

it would require to have access to secretKeyFromUint from Secp256k1.

Feel free to import the Secp256k1 library anywhere necessary. 👍