scroll-tech / halo2-lib

Monorepo of halo2 crates
MIT License
23 stars 19 forks source link

halo2-ecc: `ec_double` helper doesn't work for secp256r1 #29

Open DreamWuGit opened 1 month ago

DreamWuGit commented 1 month ago

halo2-ecc/src/ecc/mod.rs helper ec_double helper only work for secp256k1 , not work for p256, need to be updated as following: if current point is P (x, y) then lambda = (3* x ^2 + a) / 2y (mod p) x_3 = lambda^2 - 2x (mod p) y_3 = lambda(x_3 -x) (mod p) the point(x_3, y_3) is the addition result.

DreamWuGit commented 1 month ago

better to make modification compatible to both two curves instead of creating new helper special use for r1 curve.