Bitcoin Forum
April 28, 2024, 06:51:52 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: What is the difference between public key and public key hash.  (Read 348 times)
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18507


View Profile
September 28, 2023, 05:51:44 PM
Merited by hosseinimr93 (4), ABCbits (3), pooya87 (2), vapourminer (1), DdmrDdmr (1), Faisal2202 (1), albert0bsd (1), garlonicon (1)
 #21

Really! I mean aren't they made by encrypting the public key?
No. They are made by hashing the public key.

Pooya87 has explained the difference between hashing and encryption on the previous page: https://bitcointalk.org/index.php?topic=5468186.msg62907603#msg62907603

Encryption is a two way process, where anyone with the decryption key can decrypt the result and obtain the original message. Hashing is a one way process, which is not reversible, which outputs a message of a fixed size.

If you know an address, you cannot calculate the public key, because the address is hashed, not encrypted. It is a one way process which is not reversible.

This is just an example, to show the OP what it actually looks like.
Still, better to use real examples so OP can test the examples locally if they want to. For example, the valid public key based on your x coordinate is:
Code:
044f40875d8b57f9d80e12b54677893997c7573bf176711680356e0336a8c7b29fedd4b2428f4727d3eb55f1aff484ff51ba0e55e570fa87f096408b193d490e47

Take RIPEMD160(SHA256(public key)):
Code:
5597BB128B6F92626C39329A8764DE52C94C9C58

Add the network byte 0x00:
Code:
005597BB128B6F92626C39329A8764DE52C94C9C58

Take the double SHA256 hash of this:
Code:
3F53E1365784658BF7930D9083D47E62A333BCD8102428635BF7E2B9549E4B1E

Take the first four bytes of this string as a checksum (0x3F53E136), and append it to the public key hash:
Code:
005597BB128B6F92626C39329A8764DE52C94C9C583F53E136

Encode in to Base58 to get your address:
Code:
18oaCk6aLBNTh6f9h6Jh9hGeSQm6S6MRC9
1714330312
Hero Member
*
Offline Offline

Posts: 1714330312

View Profile Personal Message (Offline)

Ignore
1714330312
Reply with quote  #2

1714330312
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Faisal2202
Sr. Member
****
Online Online

Activity: 1190
Merit: 465


#SWGT CERTIK Audited


View Profile WWW
September 29, 2023, 08:52:26 PM
 #22

Pooya87 has explained the difference between hashing and encryption on the previous page: https://bitcointalk.org/index.php?topic=5468186.msg62907603#msg62907603
Thanks for mentioning his reply, I think I missed it out, I did not read pooya's reply, and thanks for the explanation you have made, the things are now crystal clear for me between encryption and hashing, I definitely get confused in them but from now on I will not.

Thanks a lot dear Pooya87, for your explanation, sorry, I did not saw that reply, I don't know how it missed, but if I would have saw that then I might have not made my 2nd reply here. Because your reply was enough but I am glad that I asked, because leo has made things more easy.

Pages: « 1 [2]  All
  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!