Bitcoin Forum
April 27, 2024, 04:32:30 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Compressed and uncompressed  (Read 445 times)
RentGPU (OP)
Sr. Member
****
Offline Offline

Activity: 661
Merit: 258


View Profile
September 17, 2017, 05:03:40 PM
Merited by ABCbits (2)
 #1

Sorry for my newbie question , actually there is 2 questions.
First, does the prefix (02 or 03) of the compressed publickey point refer to it's position of the x-axis up or down ,postive or negative?

Second, can i get the compressed publickey point from an uncompressed publickey point without knowing it's private key, if yes is there a site or software can do this for me?....thx alot.

2016 GPU Miner
1714192350
Hero Member
*
Offline Offline

Posts: 1714192350

View Profile Personal Message (Offline)

Ignore
1714192350
Reply with quote  #2

1714192350
Report to moderator
1714192350
Hero Member
*
Offline Offline

Posts: 1714192350

View Profile Personal Message (Offline)

Ignore
1714192350
Reply with quote  #2

1714192350
Report to moderator
1714192350
Hero Member
*
Offline Offline

Posts: 1714192350

View Profile Personal Message (Offline)

Ignore
1714192350
Reply with quote  #2

1714192350
Report to moderator
"Bitcoin: mining our own business since 2009" -- Pieter Wuille
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714192350
Hero Member
*
Offline Offline

Posts: 1714192350

View Profile Personal Message (Offline)

Ignore
1714192350
Reply with quote  #2

1714192350
Report to moderator
1714192350
Hero Member
*
Offline Offline

Posts: 1714192350

View Profile Personal Message (Offline)

Ignore
1714192350
Reply with quote  #2

1714192350
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
September 17, 2017, 05:35:09 PM
Merited by ABCbits (2)
 #2

Sorry for my newbie question , actually there is 2 questions.
First, does the prefix (02 or 03) of the compressed publickey point refer to it's position of the x-axis up or down ,postive or negative?
It refers to the position on the y-axis. Specifically 0x02 is used to indicate that the y value is even and 0x03 is used to indicate that it is odd.

Second, can i get the compressed publickey point from an uncompressed publickey point without knowing it's private key, if yes is there a site or software can do this for me?....thx alot.
Yes, you can. In fact all compressed public keys are actually computed from the uncompressed public key as the uncompressed public key is the one that is actually derived.

What kind of software are you looking for?

RentGPU (OP)
Sr. Member
****
Offline Offline

Activity: 661
Merit: 258


View Profile
September 17, 2017, 05:37:54 PM
 #3

Sorry for my newbie question , actually there is 2 questions.
First, does the prefix (02 or 03) of the compressed publickey point refer to it's position of the x-axis up or down ,postive or negative?
It refers to the position on the y-axis. Specifically 0x02 is used to indicate that the y value is even and 0x03 is used to indicate that it is odd.

Second, can i get the compressed publickey point from an uncompressed publickey point without knowing it's private key, if yes is there a site or software can do this for me?....thx alot.
Yes, you can. In fact all compressed public keys are actually computed from the uncompressed public key as the uncompressed public key is the one that is actually derived.

What kind of software are you looking for?
An online site that can convert uncompressed point to it's compressed one , script or something

2016 GPU Miner
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4610



View Profile
September 17, 2017, 06:16:26 PM
Merited by ABCbits (1)
 #4

An online site that can convert uncompressed point to it's compressed one , script or something

There really isn't any "conversion" to do.

An uncompressed point has an x-coordinate and a y-coordinate. To get the compressed value, just throw away the y-coordinate, and add the appropriate (02 or 03) prefix.
RentGPU (OP)
Sr. Member
****
Offline Offline

Activity: 661
Merit: 258


View Profile
September 17, 2017, 07:08:40 PM
 #5

An online site that can convert uncompressed point to it's compressed one , script or something

There really isn't any "conversion" to do.

An uncompressed point has an x-coordinate and a y-coordinate. To get the compressed value, just throw away the y-coordinate, and add the appropriate (02 or 03) prefix.
Thats in order to convert uncompressed to compressed what i need is the opposite , or in other words how i know the right prefix 02 or 03

2016 GPU Miner
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
September 17, 2017, 07:30:45 PM
 #6

Thats in order to convert uncompressed to compressed what i need is the opposite , or in other words how i know the right prefix 02 or 03
No, that's exactly what you asked, to convert uncompressed pubkey to compressed one. Just look at the last digit of the y value (last 32 bytes of pubkey) and see if that is an even or odd digit. If it is even, the prefix byte is 0x02. If it is odd, the prefix byte is 0x03.

DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4610



View Profile
September 17, 2017, 07:38:00 PM
Merited by ABCbits (3)
 #7

how i know the right prefix 02 or 03

If you know the uncompressed?

Look at the value of the y-coordinate.  If the last digit is an odd number (1, 3, 5, 7, 9) then use a prefix of "03". If it is not an odd number (0, 2, 4, 6, 8 ) then use a prefix of "02"

Here's an example:

Uncompressed public key (prefix in black, x-value in blue, y-value in red):
04890821F2C9C8A01DDD5C019E75FD6D46D41D4575047CDEDD7946AA56EAE01A80FCA0ABC7E90526EB41EA6A9E4C6FA0A9FCED8DCF7E25FCD46509FFF2BD5088B8

Notice that the final digit of the red portion (y-value) is 8. So, we throw away that red portion, and change the prefix from 04 (uncompressed) to 02 (compressed/even):
02890821F2C9C8A01DDD5C019E75FD6D46D41D4575047CDEDD7946AA56EAE01A80



Here's another example:

Uncompressed public key (prefix in black, x-value in blue, y-value in red):
041C2E319C3F82FE654A77B6DF323166E1D771974B64CEF70F5AB97EAC9DA1A7CCDC44D9E9E893B53C9968C3D41EF20356484243530027456BFCF1AD97AC223839

Notice that the final digit of the red portion (y-value) is 9. So, we throw away that red portion, and change the prefix from 04 (uncompressed) to 03 (compressed/odd):
031C2E319C3F82FE654A77B6DF323166E1D771974B64CEF70F5AB97EAC9DA1A7CC


There really isn't any "conversion" to do.

An uncompressed point has an x-coordinate and a y-coordinate. To get the compressed value, just throw away the y-coordinate, and add the appropriate (02 or 03) prefix.
Thats in order to convert from uncompressed to compressed

Correct.  That's what you asked for, twice.

See here:

can i get the compressed publickey point from an uncompressed publickey point without knowing it's private key

An online site that can convert uncompressed point to it's compressed one
RentGPU (OP)
Sr. Member
****
Offline Offline

Activity: 661
Merit: 258


View Profile
September 17, 2017, 07:53:38 PM
 #8

how i know the right prefix 02 or 03

If you know the uncompressed?

Look at the value of the y-coordinate.  If the last digit is an odd number (1, 3, 5, 7, 9) then use a prefix of "03". If it is not an odd number (0, 2, 4, 6, 8 ) then use a prefix of "02"

Here's an example:

Uncompressed public key (prefix in black, x-value in blue, y-value in red):
04890821F2C9C8A01DDD5C019E75FD6D46D41D4575047CDEDD7946AA56EAE01A80FCA0ABC7E90526EB41EA6A9E4C6FA0A9FCED8DCF7E25FCD46509FFF2BD5088B8

Notice that the final digit of the red portion (y-value) is 8. So, we throw away that red portion, and change the prefix from 04 (uncompressed) to 02 (compressed/even):
02890821F2C9C8A01DDD5C019E75FD6D46D41D4575047CDEDD7946AA56EAE01A80



Here's another example:

Uncompressed public key (prefix in black, x-value in blue, y-value in red):
041C2E319C3F82FE654A77B6DF323166E1D771974B64CEF70F5AB97EAC9DA1A7CCDC44D9E9E893B53C9968C3D41EF20356484243530027456BFCF1AD97AC223839

Notice that the final digit of the red portion (y-value) is 9. So, we throw away that red portion, and change the prefix from 04 (uncompressed) to 03 (compressed/odd):
031C2E319C3F82FE654A77B6DF323166E1D771974B64CEF70F5AB97EAC9DA1A7CC


There really isn't any "conversion" to do.

An uncompressed point has an x-coordinate and a y-coordinate. To get the compressed value, just throw away the y-coordinate, and add the appropriate (02 or 03) prefix.
Thats in order to convert from uncompressed to compressed

Correct.  That's what you asked for, twice.

See here:

can i get the compressed publickey point from an uncompressed publickey point without knowing it's private key

An online site that can convert uncompressed point to it's compressed one
I got it now thanks alot for the detailed answer.

2016 GPU Miner
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!