Bitcoin Forum
December 03, 2016, 11:58:14 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: protocol specs on wiki  (Read 870 times)
brybot
Newbie
*
Offline Offline

Activity: 24


View Profile
May 23, 2011, 03:16:10 AM
 #1

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
1480766294
Hero Member
*
Offline Offline

Posts: 1480766294

View Profile Personal Message (Offline)

Ignore
1480766294
Reply with quote  #2

1480766294
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480766294
Hero Member
*
Offline Offline

Posts: 1480766294

View Profile Personal Message (Offline)

Ignore
1480766294
Reply with quote  #2

1480766294
Report to moderator
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
May 23, 2011, 03:37:28 AM
 #2

Probably endianness problems.

Looking at this block:
http://blockexplorer.com/rawblock/000000000000479de7df494b25c838f0e102d696e08ad2bb74066d7a7ae69511
Its binary header is:
Code:
01000000 version
1d8f4ec0443e1f19f305e488c1085c95de7cc3fd25e0d2c5bb5d000000000000 previous block
9762547903d36881a86751f3f5049e23050113f779735ef82734ebf0b4450081 Merkle root
d8c8c84d timestamp
b3936a1a bits
334b035b nonce

Hashed once:
0cdb93c3412d2f30eb7d8dfd13d3142eaa8738c0de2337ac8a80c623715d9c07
Hashed twice:
1195e67a7a6d0674bbd28ae096d602e1f038c8254b49dfe79d47000000000000

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
brybot
Newbie
*
Offline Offline

Activity: 24


View Profile
May 23, 2011, 03:46:35 AM
 #3

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?
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
May 23, 2011, 03:56:00 AM
 #4

Yes, the comments need to be removed. To make that example, I just used this online tool:
http://www.fileformat.info/tool/hash.htm

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
kjj
Legendary
*
Offline Offline

Activity: 1302



View Profile
May 23, 2011, 04:57:39 AM
 #5

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.

p2pcoin: a USB/CD/PXE p2pool miner - 1N8ZXx2cuMzqBYSK72X4DAy1UdDbZQNPLf - todo
I routinely ignore posters with paid advertising in their sigs.  You should too.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!