Post
Topic
Board Development & Technical Discussion
Re: zero point of secp256k1
by
akaki
on 20/12/2021, 15:33:28 UTC
Maybe the zero infinity point is just an abstract notion and therefore we are not allowed to calculate (-k*G + k*G) as a normal addition.
You can't calculate -P+P in a "normal" way, because this points have same X, so it will lead to division by zero (or, if we talking about EC math - multiplicative modular inverse of zero which doesn't exist).

Quote from: akaki
-2*G + 2*G=(49667982834466148699028630885550314015746939561788444090107179747772288677390, 37758011528734597361759657276645959964664126776856991748971785837209648797521).
Nobody can't help you here, until you explain how exactly you're calculated this numbers


Yes, indeed I calculate (-k*G + k*G) as any other EC addition using this function :

Code:
def ECadd(a, b):
    LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], P)) % P
    x = (LamAdd * LamAdd - a[0] - b[0]) % P
    y = (LamAdd * (a[0] - x) - a[1]) % P
    return x, y

It seems to work for K=1 as I get N*G (verified by EC multiplication).

What would be the modification to have the correct result for any K ? If it's not supposed to be always the same, does it have any link with k=1 ?