AntonKueltz / fastecdsa

Python library for fast elliptic curve crypto
https://pypi.python.org/pypi/fastecdsa
The Unlicense
270 stars 78 forks source link

Fix is_point_on_curve (fixes issue #48) #49

Closed olalonde closed 4 years ago

olalonde commented 4 years ago

See issue #48

antonio-fr commented 4 years ago

I would speed up the whole is_point_on_curve thing :

left = pow(y, 2, self.p)
right = pow(x,3,p) + (self.a * x) + self.b
return left == right % self.p
AntonKueltz commented 4 years ago

Agree with @antonio-fr that we should try to keep is_point_on_curve as cheap as possible since it's used whenever a new Point is constructed. If possible we should avoid modular square roots.

AntonKueltz commented 4 years ago

Based on looking at #48 some more I'm actually leaning towards closing this. Let me know if you agree with my comments in #48, it appears to me the logic is sound and correctly catching an invalid point.

AntonKueltz commented 4 years ago

Closing per the last comment left in issue #48. Let me know if you want to discuss further.