Title: What is the difference between char[32] hashes and char[64] hashes? Post by: bitcoinandroid on September 12, 2011, 05:42:22 AM 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? Title: Re: What is the difference between char[32] hashes and char[64] hashes? Post by: casascius on September 12, 2011, 05:46:35 AM 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. Title: Re: What is the difference between char[32] hashes and char[64] hashes? Post by: RSmith on September 12, 2011, 05:56:43 AM 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.
Title: Re: What is the difference between char[32] hashes and char[64] hashes? Post by: bitcoinandroid on September 12, 2011, 06:13:04 AM Ahh, makes sense - I should have caught that. Sorry for the newbie question and thanks for the help! :)
|