Title: protocol specs on wiki Post by: brybot on May 23, 2011, 03:16:10 AM I was trying to use an online sha-256 calculator to verify blocks, but I have had no luck. I was just stringing together the "header" and applying the sha-256 algorithm twice. Then I noticed that I get different results to "hello" than is displayed on the wiki. It shows two rounds of the hash algorithm. I get a match for the first round, but not on the second. Any idea what is going on here? Thanks
https://en.bitcoin.it/wiki/Protocol_specification Title: Re: protocol specs on wiki Post by: theymos on May 23, 2011, 03:37:28 AM Probably endianness problems.
Looking at this block: http://blockexplorer.com/rawblock/000000000000479de7df494b25c838f0e102d696e08ad2bb74066d7a7ae69511 Its binary header is: Code: 01000000 version Hashed once: 0cdb93c3412d2f30eb7d8dfd13d3142eaa8738c0de2337ac8a80c623715d9c07 Hashed twice: 1195e67a7a6d0674bbd28ae096d602e1f038c8254b49dfe79d47000000000000 Title: Re: protocol specs on wiki Post by: brybot on May 23, 2011, 03:46:35 AM Any chance you could show me how you did those hashes? If it were an endian problem, I'd expect to get the wrong hash for "hello" on both cases, not just one.
For the block you posted, I didnt get the right hash in either case. Am I to remove the the " previous block" text and just leave the values when I do the computation? Title: Re: protocol specs on wiki Post by: theymos on May 23, 2011, 03:56:00 AM Yes, the comments need to be removed. To make that example, I just used this online tool:
http://www.fileformat.info/tool/hash.htm Title: Re: protocol specs on wiki Post by: kjj on May 23, 2011, 04:57:39 AM Keep in mind that the most significant bits are on the right. The first hash has a leading zero, which is actually a trailing zero. It is important to the second round.
|