Author

Topic: What is the difference between char[32] hashes and char[64] hashes? (Read 1032 times)

newbie
Activity: 37
Merit: 0
Ahh, makes sense - I should have caught that.  Sorry for the newbie question and thanks for the help!  Smiley
newbie
Activity: 8
Merit: 0
A hexadecimal character represents 4 bits; a 'char' (aka a byte) represents 8 bits.  So 64 hex characters stands for 256 bits, as does 32 bytes.  So the difference is notation, nothing else.


vip
Activity: 1386
Merit: 1140
The Casascius 1oz 10BTC Silver Round (w/ Gold B)
I think you have the difference between a character and a byte confused.

They are 64 hexadecimal characters long.  That means 32 bytes.  Each byte takes two symbols (0-9, A-F) to represent in hexadecimal, because there's 8 bits in a byte, and each hex symbol only represents 4 bits.
newbie
Activity: 37
Merit: 0
This is probably a simple question but I haven't seen an answer anywhere.

The protocol describes a number of char[32] hashes:
https://en.bitcoin.it/wiki/Protocol_specification#getblocks

But it looks like all the hashes are 64 characters long:

http://blockexplorer.com/rawblock/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

Why is this?

Base58 encoding it seems to make it 40 characters long.  Is it truncating the hash and only using the first 32 characters of it?
Jump to: