Bitcoin address SHA256 pipe gives wrong output

0 votes

Step 5-6 of manual: https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses

Calculating sha256sum secondly:

5 - Perform SHA-256 hash on the extended RIPEMD-160 result
445C7A8007A93D8733188288BB320A8FE2DEBD2AE1B47F0F50BC10BAE845C094

6 - Perform SHA-256 hash on the result of the previous SHA-256 hash
D61967F63C7DD183914A4AE452C9F6AD5D462CE3D277798075B107615C1A8A30

I try to repeat step 6, but sha256sum is wrong:

# echo -n 445C7A8007A93D8733188288BB320A8FE2DEBD2AE1B47F0F50BC10BAE845C094 | sha256sum
7760845dcfd8c366ae89620be2f368d255d710bc7493628ca0dcded9ca476e5a  -
# echo -n 445C7A8007A93D8733188288BB320A8FE2DEBD2AE1B47F0F50BC10BAE845C094 | openssl sha256 
(stdin)= 7760845dcfd8c366ae89620be2f368d255d710bc7493628ca0dcded9ca476e5

even this wrong too:

# echo 445C7A8007A93D8733188288BB320A8FE2DEBD2AE1B47F0F50BC10BAE845C094 | openssl sha256 
(stdin)= 9edec8be4a03dd9e605f465c60ae4c77c752516f58384016c6c7384028b39f6e

How to get: D61967F63C7DD183914A4AE452C9F6AD5D462CE3D277798075B107615C1A8A30?

Sep 5, 2018 in Blockchain by slayer
• 29,370 points
822 views

1 answer to this question.

0 votes

You need to hash the raw byte data rather than its ASCII hex dump.

$ echo -n $'\x44\x5C\x7A\x80\x07\xA9\x3D\x87\x33\x18\x82\x88\xBB\x32\x0A\x8F\xE2\xDE\xBD\x2A\xE1\xB4\x7F\x0F\x50\xBC\x10\xBA\xE8\x45\xC0\x94' | sha256sum
d61967f63c7dd183914a4ae452c9f6ad5d462ce3d277798075b107615c1a8a30  -
$ echo -n $'\x44\x5C\x7A\x80\x07\xA9\x3D\x87\x33\x18\x82\x88\xBB\x32\x0A\x8F\xE2\xDE\xBD\x2A\xE1\xB4\x7F\x0F\x50\xBC\x10\xBA\xE8\x45\xC0\x94' | openssl sha256
(stdin)= d61967f63c7dd183914a4ae452c9f6ad5d462ce3d277798075b107615c1a8a30
answered Sep 5, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
1 answer

How Bitcoin wallet find unspent transaction output(UTXOs)?

The wallet apps are connected to the ...READ MORE

answered May 22, 2018 in Blockchain by Shashank
• 10,400 points
1,271 views
0 votes
1 answer

How are unique public address generated in bitcoin?

In brief, the public addresses are generated ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,370 points
775 views
+3 votes
3 answers

How to validate bitcoin address?

I found these 2 scripts online: Javascript: <html> <head> <script type="text/javascript" ...READ MORE

answered Aug 17, 2018 in Blockchain by slayer
• 29,370 points
6,513 views
+1 vote
1 answer

How to generate Bitcoin address?

Convert the hex string back to bytes ...READ MORE

answered Aug 20, 2018 in Blockchain by slayer
• 29,370 points
1,157 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,434 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,928 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,456 views
0 votes
1 answer

How to extract h160 address of bitcoin blockchain?

You can extract the data using the ...READ MORE

answered Jul 16, 2018 in Blockchain by digger
• 26,740 points
2,557 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP