cslashm / ECPy

Apache License 2.0
36 stars 24 forks source link

multiplication by 0 not working well in secp256k1 #6

Closed avivz closed 4 years ago

avivz commented 5 years ago

So, I was trying to use your library to do some additive homomorphic stuff (vector commitments for bulletproofs using secp256k1 more specifically). I then encountered some trouble:

Running the following:

from ecpy.curves import Curve
C = Curve.get_curve("secp256k1")
G = C.generator
((0*G) + (0*G)) == `(0*G)

the last statement is 'False' mostly because 0*G == G

Similarly G-G gives an object with an invalid state that can't be printed.

cslashm commented 5 years ago

Thanks for reporting.

Indeed infinite point (with ø = 0.P, ∀ P ∈ Curve) seems not correctly handle. I look at that quickly

cslashm commented 4 years ago

Added a infinity point management in 1.0.0beta