Post
Topic
Board Development & Technical Discussion
Merits 2 from 2 users
Re: How to define which coordinate is negative?
by
NotATether
on 24/07/2022, 05:30:42 UTC
⭐ Merited by ETFbitcoin (1) ,PowerGlove (1)
comparing two public key im trying to find which one big or small

is there any alternative way to do this ,already pm you my code

please help!

Well you should split up this operation

Code:
R = P <= Q

You should make it:

Code:
eq = P.x == Q.x
lt = P.x < Q.x
R = eq or lt

You cannot directly compare two Point classes. Read this page to understand why: https://crypto.stackexchange.com/questions/98189/how-to-prove-that-an-elliptic-curve-point-is-smaller-or-greater-than-half-of-the

Quote from: the answer in the link above
If there were a polynomial time solution[1] then this would provide a polynomial time solution to the elliptic curve discrete logarithm problem. We strongly believe this not to be the case.
...

[1] They are talking about a similar problem, where you find if the point is on the smaller half or bigger half of the private key range. But this discussion is why you cannot check two Point classes for Less Than - because their private keys are unknown.



To work around this, you should compare the X coordinates directly.

This will tell you if the X points are smaller or bigger, and allows you to order the public keys by characteristic P (instead of by private key order N).

P.S. I would appreciate it if you post the questions about the code inside this thread, posting the same thing in the thread *and* in my PM mailbox is a bit annoying because I am already watching this thread.