axiom-crypto / halo2-lib

Monorepo of halo2 crates
MIT License
236 stars 145 forks source link

feat: add support for secp256r1 #225

Open DCMMC opened 9 months ago

DCMMC commented 9 months ago

Background

secp256r1 is a widely used elliptic curve. Axiom's halo2-lib provides an implementation of secp256k1. At present, ec_double and check_is_on_curve in halo2-ecc ignore the ax term in y^2 = x^3 + ax + b because secp256k1 does not need this term. To make their implementation more generalized and support more curves such as secp256r1, this PR fixes ec_double and check_is_on_curve and adds an implementation of secp256r1.

Test

cargo test --package halo2-ecc --lib -- secp256r1::tests::ecdsa::test_secp256r1_ecdsa --exact --nocapture