Bitcoin Forum
June 15, 2024, 05:51:06 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Wallet Address hash generation  (Read 1044 times)
rklz (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
July 11, 2014, 04:24:22 AM
 #1

Hi, im using this tutorial https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses#How_to_create_Bitcoin_Address to understand how to creat bitcoin wallet addresses.

But, for example, if u start from step 5 and hash this string 445C7A8007A93D8733188288BB320A8FE2DEBD2AE1B47F0F50BC10BAE845C094 with sha 256 again the result is:

7760845DCFD8C366AE89620BE2F368D255D710BC7493628CA0DCDED9CA476E5A and not D61967F63C7DD183914A4AE452C9F6AD5D462CE3D277798075B107615C1A8A30 like the step 6 shows.

Where is my error? I cant' figure this out.


To hash with sha 256 im using: http://www.xorbin.com/tools/sha256-hash-calculator
or

NodeJS: var hash = crypto.createHash('sha256').update(p).digest('hex');

(same results)

Thanks in advance!
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
July 11, 2014, 04:50:39 AM
Last edit: July 11, 2014, 05:17:05 AM by DeathAndTaxes
 #2

The problem is your tool.   The tool you are using is hashing the input as "text".  Bitcoin public keys are byte arrays.  We may represent them as a hex values but you need to be hashing the actual bytes (i.e "0x77" is the value 119 not two numeric digits seven and seven).

You need a tool which hashes the bytes.  Here is one.   It supports RIPEMD160 as well so you can walk through the example from the beginning.
http://www.fileformat.info/tool/hash.htm?hex=445C7A8007A93D8733188288BB320A8FE2DEBD2AE1B47F0F50BC10BAE845C094

Peter R
Legendary
*
Offline Offline

Activity: 1162
Merit: 1007



View Profile
July 11, 2014, 05:00:38 AM
 #3

Damn, Gerald, you keep beating me by a few minutes!


Run Bitcoin Unlimited (www.bitcoinunlimited.info)
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
July 11, 2014, 05:12:45 AM
 #4

This is a common mistake. I admit when I first did this I was baffled by the different results. The problem is indeed the online tool. In fact for the last 3 years I've wondered why nobody made an online SHA256 hashing tool that has the option to convert the HEX to actual binary and then hash it.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
July 11, 2014, 05:17:54 AM
 #5

In fact for the last 3 years I've wondered why nobody made an online SHA256 hashing tool that has the option to convert the HEX to actual binary and then hash it.

The tool I linked does (and it outputs RIPEMD-160 was well).
rklz (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
July 11, 2014, 07:43:24 AM
 #6

Thanks you so much for your help guys!
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!