How to Tell if a Public Key's Y Value is Positive or Negative?

12 replies 291 views
mr_nodeFull Member
Posts: 4 · Reputation: 417
#1Dec 28, 2021, 02:34 PM
So, I got a public key (x, y) and its inverse (x, -y). How do we figure out which is positive and which is negative? Like, is there a simple way to tell?
3 Reply Quote Share
0xWizardMember
Posts: 37 · Reputation: 224
#2Dec 28, 2021, 07:22 PM
Here’s an example. For my private key 1 -> (x, y): x = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798L y = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8L And for -y: -y = 0xb7c52588d95c3b9aa25b0403f1eef75702e84bb7597aabe663b82f6f04ef2777L What can we do with this?
6 Reply Quote Share
node1337Hero Member
Posts: 2 · Reputation: 2105
#3Dec 28, 2021, 11:58 PM
What about large numbers or private keys? Anyone got tips?
3 Reply Quote Share
wizard_2016Full Member
Posts: 127 · Reputation: 575
#4Dec 31, 2021, 10:00 AM
To check even or odd, just look at the least significant bit. The LSB for Y and -Y are opposites. So it’s really about even/odd, not positive/negative, you know?
4 Reply Quote Share
0xWizardMember
Posts: 37 · Reputation: 224
#5Jan 1, 2022, 02:02 PM
So, what you’re saying is there’s no positive or negative? All numbers are technically positive?
3 Reply Quote Share
falcon2019Full Member
Posts: 90 · Reputation: 425
#6Jan 1, 2022, 04:50 PM
If you want a simple way to get the pubkey from the private key, divide the known pubkey. But first, check if it’s even or odd. Hope the thread creator is still around after all this time.
2 Reply Quote Share
stacksatsHero Member
Posts: 404 · Reputation: 2023
#7Jan 3, 2022, 07:30 AM
Yup, odd means y mod 2 == 1 and even means y mod 2 == 0. For negative, keep subtracting P until y < 0. Positive? Just add P until y > 0.
0 Reply Quote Share
0xWizardMember
Posts: 37 · Reputation: 224
#8Jan 3, 2022, 09:22 AM
Wait, what’s the connection with scalar parity and y being odd/even? It seems like there’s no proof either way. Maybe a super-computer will figure it out someday.
4 Reply Quote Share
stacksatsHero Member
Posts: 404 · Reputation: 2023
#9Jan 3, 2022, 02:37 PM
I don’t get it... Like, if I subtract 21 10 = 11, how does -10 end up being -19? Is there a transition from positive to negative?
4 Reply Quote Share
0xWizardMember
Posts: 37 · Reputation: 224
#10Jan 3, 2022, 07:06 PM
In secp256k1, 1/2 gives a huge number. Just checking if that method actually helps with odd/even pubkey definitions. Tried a bunch but patterns stay the same.
6 Reply Quote Share
stacksatsHero Member
Posts: 404 · Reputation: 2023
#11Jan 5, 2022, 09:03 PM
But think about this: 7/2 1/2 = 3, and when I subtract, 7 3 is odd. So, what gives?
1 Reply Quote Share
0xWizardMember
Posts: 37 · Reputation: 224
#12Jan 6, 2022, 03:42 PM
Just remember, we’re working with the pubkey as our known variable. No decimals or private key involved.
3 Reply Quote Share
stacksatsHero Member
Posts: 404 · Reputation: 2023
#13Jan 6, 2022, 04:16 PM
I’m talking about this example: 1/2 = 57896044618658097711785492504343953926418782139537452191302581570759080747169 7/2 = 57896044618658097711785492504343953926418782139537452191302581570759080747172
1 Reply Quote Share

Related topics