Post
Topic
Board Development & Technical Discussion
Re: zero point of secp256k1
by
akaki
on 20/12/2021, 19:46:22 UTC
Yes, indeed I calculate (-k*G + k*G) as any other EC addition using this function :

Code:
   LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], P)) % P
As I said before, there is no exists inverse of zero (a[0] = b[0], b[0]-a[0] = 0)

If you modinv() function returning something with a zero argument, this is mean that is a wrong (or simplified - without error checking) implementation of modular multiplicative inverse. And that is why you're getting unexpected strange numbers in result.

Basically, zero-point, or identity point cannot be calculated, it is defined as [0;1;0] in projective coordinates or [P,0] in affine. Due to all of this, addition algorithms should contain  something like "if (p1.y != p2.y and p1.x == p2.x) return zero"


Thanks, I updated my modinv function.

conclusion of discussion:
Code:
-k*G+k*G=(0,P) for k€Z, with P = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F

The N*G result for k=1 is just coincidence.