Bitcoin Forum
September 21, 2024, 03:04:14 AM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What is the difference between char[32] hashes and char[64] hashes?  (Read 1012 times)
bitcoinandroid (OP)
Newbie
*
Offline Offline

Activity: 37
Merit: 0


View Profile
September 12, 2011, 05:42:22 AM
 #1

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?
casascius
Mike Caldwell
VIP
Legendary
*
Offline Offline

Activity: 1386
Merit: 1140


The Casascius 1oz 10BTC Silver Round (w/ Gold B)


View Profile WWW
September 12, 2011, 05:46:35 AM
 #2

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.

Companies claiming they got hacked and lost your coins sounds like fraud so perfect it could be called fashionable.  I never believe them.  If I ever experience the misfortune of a real intrusion, I declare I have been honest about the way I have managed the keys in Casascius Coins.  I maintain no ability to recover or reproduce the keys, not even under limitless duress or total intrusion.  Remember that trusting strangers with your coins without any recourse is, as a matter of principle, not a best practice.  Don't keep coins online. Use paper or hardware wallets instead.
RSmith
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
September 12, 2011, 05:56:43 AM
 #3

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.


bitcoinandroid (OP)
Newbie
*
Offline Offline

Activity: 37
Merit: 0


View Profile
September 12, 2011, 06:13:04 AM
 #4

Ahh, makes sense - I should have caught that.  Sorry for the newbie question and thanks for the help!  Smiley
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!