Post
Topic
Board Development & Technical Discussion
Re: Determine if a public key point y is negative or positive, odd or even?
by
COBRAS
on 19/01/2025, 02:01:10 UTC


N =    115792089237316195423570985008687907852837564279074904382605163141518161494337

def inv(v): return pow(v, N-2, N)
def divnum(a, b): return ( (a * inv(b) ) % N )


x =0xfffffffffffff# 0x123456789

b  = 1

c = (0x123456789 *(-1%N)%N)%N

print("c",hex(c))

Xx =(x + b %N)%N

Xx = (Xx - c %N)%N


# = 0x2345678a


print("x+Xx",hex((x+Xx%N)%N))

res:

c 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8bacf0d9b8
x+Xx 0x20000123456788


N =    115792089237316195423570985008687907852837564279074904382605163141518161494337

def inv(v): return pow(v, N-2, N)
def divnum(a, b): return ( (a * inv(b) ) % N )


x =0xfffffffffffff# 0x123456789

b  = 1

c = (0x123456789 *(1%N)%N)%N

print("c",hex(c))

Xx =(x + b %N)%N

Xx = (Xx - c %N)%N


# = 0x2345678a


print("x+Xx",hex((x+Xx%N)%N))


result:

c 0x123456789
x+Xx 0x1ffffedcba9876

[Program finished]

edcba9876 !=0x123456789