How to tell if a public key point y is positive or negative, odd or even?

12 replies 78 views
0xOracl3Member
Posts: 3 · Reputation: 128
#1Jul 31, 2021, 04:16 AM
So you have a bitcoin public key (x, y) and its additive inverse (x, -y). How do you figure out which one is the positive point and which one is the negative one? Here’s an example: Private key 1 -> (x, y) x = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798L y = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8L -y = 0xb7c52588d95c3b9aa25b0403f1eef75702e84bb7597aabe663b82f6f04ef2777L Private key 2 -> (x, y) x = 0xc6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5L y = 0x1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52aL -y = 0xe51e970159c23cc65c3a7be6b99315110809cd9acd992f1edc9bce55af301705L Private key 3 -> (x, y) x = 0xf9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9L y = 0x388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672L -y = 0xc77084f09cd217ebf01cc819d5c80ca99aff5666cb3ddce4934602897b4715bdL Also, how do you know which public key is odd and which is even? Like, for example, private key 1 has x,y as odd, while private key 2 has x,y as even (based on the public key). Just some extra info: When it comes to doubling bitcoin public keys, think of it like this: in regular math, if you take 7 and divide it by 2, you get 3 and a remainder of 1. To get 7 back, it’s 3*2 = 6 + 1 = 7. And as for elliptical curve crypto, here’s a quick example: Private key 7 gives you the following pub key: x = 0x5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bcL y = 0x6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a508
5 Reply Quote Share
Posts: 13 · Reputation: 149
#2Jul 31, 2021, 07:08 AM
How about to calculation larga number/large private key?
2 Reply Quote Share
omega2013Member
Posts: 11 · Reputation: 171
#3Jul 31, 2021, 09:22 AM
can you write something more about these calculation methods
0 Reply Quote Share
paul2017Senior Member
Posts: 218 · Reputation: 1426
#4Jul 31, 2021, 10:27 AM
The sign (or more precisely even/odd) is determined simply by the value of the least-significant bit Notice that the values of the LSBs for Y and -Y are opposites in all of your examples. That's why they are referred to as even/odd and not positive/negative. To answer your question, there is no "positive/negative". All numbers are positive.
4 Reply Quote Share
Posts: 13 · Reputation: 149
#5Jul 31, 2021, 02:17 PM
simply method to derive pubkey to private key is divide the known pubkey..but the first challenge must be make sure pubkey is even or odd. I hope the creator of this thread its OK after 10 years and starting discussion again.
3 Reply Quote Share
5tack5atsSenior Member
Posts: 142 · Reputation: 897
#6Jul 31, 2021, 06:26 PM
Odd: y mod 2 == 1 Even: y mod 2 == 0 Negative: always (subtract P until y < 0) Positive: always (add P until y > 0) Relation between scalar parity and y odd/even: not proven to exist, but also not proven to not exist. Perhaps a quantum super-computer the size of our solar system may come up with some equation. The solution obviously needs to consider G.x, G.y and the absurdly high degrees of polynomials involved with each new group addition.
3 Reply Quote Share
omega_bearFull Member
Posts: 116 · Reputation: 780
#7Jul 31, 2021, 07:55 PM
I don know ... If subtract  21 -10 = 11, -10 = 1, -10 = -9 ,-10 = -19. how come to  -21 subtracting 10 from 21? because middle of a number of subtraction is a transfer from positive to negative zones.
3 Reply Quote Share
Posts: 13 · Reputation: 149
#8Aug 1, 2021, 01:11 AM
in ecc secp256k1 1/2 = 57896044618658097711785492504343953926418782139537452191302581570759080747169 7/2 = 57896044618658097711785492504343953926418782139537452191302581570759080747172 57896044618658097711785492504343953926418782139537452191302581570759080747172 / 57896044618658097711785492504343953926418782139537452191302581570759080747169 = 7 So the above method from @sss555 is not work to define the pubkey is odd or even. I already try many use method to separate odd and even but pattern to cyclic odd and even is always same.
0 Reply Quote Share
omega_bearFull Member
Posts: 116 · Reputation: 780
#9Aug 2, 2021, 10:59 PM
7/2 - 1/2 = 3, 7 -3 = odd
3 Reply Quote Share
Posts: 13 · Reputation: 149
#10Aug 2, 2021, 11:08 PM
remember we just have the pubkey as known variable, no decimal or pvkey
5 Reply Quote Share
omega_bearFull Member
Posts: 116 · Reputation: 780
#11Aug 4, 2021, 08:22 AM
I talk abot this 1/2 = 57896044618658097711785492504343953926418782139537452191302581570759080747169 7/2 = 57896044618658097711785492504343953926418782139537452191302581570759080747172
1 Reply Quote Share
Posts: 13 · Reputation: 149
#12Aug 6, 2021, 05:29 AM
just run ecctools from @Alberto
5 Reply Quote Share
omega_bearFull Member
Posts: 116 · Reputation: 780
#13Aug 6, 2021, 09:08 AM
I using ecctools another situation: x = 0x123456789 b  = 1 c = 0x100000000 Xx = x + b Xx = Xx - c # = 0x2345678a print(hex(x-Xx)) output: 0xffffffff [Program finished] if  know range of pubkey after subtraction it is posible or not, verify with brute in range ffffff,like in scrypt , brute 0xffffffff anyone try their examples and you get fffff too ffff will be know range but what about if  "c" in my code wrong ? 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   [moderator's note: consecutive posts merged]
4 Reply Quote Share

Related topics