Bitcoin Forum
May 25, 2024, 05:35:19 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Block hash - 256 or 512 bits?  (Read 547 times)
fevirfevir (OP)
Newbie
*
Offline Offline

Activity: 17
Merit: 6


View Profile
April 16, 2016, 08:40:31 PM
 #1

From reading the wiki (https://en.bitcoin.it/wiki/Block_hashing_algorithm), a block hash is 256 bits.

Out of curiosity, I copied a block hash (block 125551, just a random pick) and turned it into binary, see:
$ echo 00000000000008a3a41b85b8b29ad444def299fee21793cd8b9e567eab02cd81 | xxd -b -c 4
0000000: 00110000 00110000 00110000 00110000  0000
0000004: 00110000 00110000 00110000 00110000  0000
0000008: 00110000 00110000 00110000 00110000  0000
000000c: 00110000 00111000 01100001 00110011  08a3
0000010: 01100001 00110100 00110001 01100010  a41b
0000014: 00111000 00110101 01100010 00111000  85b8
0000018: 01100010 00110010 00111001 01100001  b29a
000001c: 01100100 00110100 00110100 00110100  d444
0000020: 01100100 01100101 01100110 00110010  def2
0000024: 00111001 00111001 01100110 01100101  99fe
0000028: 01100101 00110010 00110001 00110111  e217
000002c: 00111001 00110011 01100011 01100100  93cd
0000030: 00111000 01100010 00111001 01100101  8b9e
0000034: 00110101 00110110 00110111 01100101  567e
0000038: 01100001 01100010 00110000 00110010  ab02
000003c: 01100011 01100100 00111000 00110001  cd81

Now I'm counting 4 columns (2nd untill the 5th), 16 lines, and 8 characters per set. 4*16*8=512 bits.

I must be missing something obvious, but haven't found it, yet. Pointing out the obvious is appreciated. Thanks.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6653


Just writing some code


View Profile WWW
April 16, 2016, 09:02:05 PM
 #2

From reading the wiki (https://en.bitcoin.it/wiki/Block_hashing_algorithm), a block hash is 256 bits.

Out of curiosity, I copied a block hash (block 125551, just a random pick) and turned it into binary, see:
$ echo 00000000000008a3a41b85b8b29ad444def299fee21793cd8b9e567eab02cd81 | xxd -b -c 4
0000000: 00110000 00110000 00110000 00110000  0000
0000004: 00110000 00110000 00110000 00110000  0000
0000008: 00110000 00110000 00110000 00110000  0000
000000c: 00110000 00111000 01100001 00110011  08a3
0000010: 01100001 00110100 00110001 01100010  a41b
0000014: 00111000 00110101 01100010 00111000  85b8
0000018: 01100010 00110010 00111001 01100001  b29a
000001c: 01100100 00110100 00110100 00110100  d444
0000020: 01100100 01100101 01100110 00110010  def2
0000024: 00111001 00111001 01100110 01100101  99fe
0000028: 01100101 00110010 00110001 00110111  e217
000002c: 00111001 00110011 01100011 01100100  93cd
0000030: 00111000 01100010 00111001 01100101  8b9e
0000034: 00110101 00110110 00110111 01100101  567e
0000038: 01100001 01100010 00110000 00110010  ab02
000003c: 01100011 01100100 00111000 00110001  cd81

Now I'm counting 4 columns (2nd untill the 5th), 16 lines, and 8 characters per set. 4*16*8=512 bits.

I must be missing something obvious, but haven't found it, yet. Pointing out the obvious is appreciated. Thanks.

You read the hash as string and the characters are the binary of the ascii characters. What you want to do is convert the hex to a binary number,

fevirfevir (OP)
Newbie
*
Offline Offline

Activity: 17
Merit: 6


View Profile
April 16, 2016, 09:14:23 PM
 #3

argh... thanks!

00000000000008a3a41b85b8b29ad444def299fee21793cd8b9e567eab02cd81 = 0000000000000000000000000000000000000000000000000000100010100011101001000001101 1100001011011100010110010100110101101010001000100110111101111001010011001111111 1011100010000101111001001111001101100010111001111001010110011111101010101100000 0101100110110000001 --> 256 bits
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!