Bitcoin Forum
June 30, 2024, 12:36:11 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: SHA 256 - 32 or 64 byte hash?  (Read 1460 times)
BlackJacky (OP)
Full Member
***
Offline Offline

Activity: 237
Merit: 100


View Profile
November 25, 2016, 12:15:17 PM
 #1

This is a more technical question regarding a hash:

If I use SHA 256 on this site http://www.xorbin.com/tools/sha256-hash-calculator and I produce a 256-bit (32-byte) hash value. Should the hash value not have 32 digits because it is 32-byte? I calculate 256 digits where 8 digits are 1 byte so I would get 32 digits but I receive a 64 digits hash value.

What do I understand wrong here?

Thx to everyone helping me out!
franky1
Legendary
*
Offline Offline

Activity: 4270
Merit: 4536



View Profile
November 25, 2016, 12:41:10 PM
 #2

This is a more technical question regarding a hash:

If I use SHA 256 on this site http://www.xorbin.com/tools/sha256-hash-calculator and I produce a 256-bit (32-byte) hash value. Should the hash value not have 32 digits because it is 32-byte? I calculate 256 digits where 8 digits are 1 byte so I would get 32 digits but I receive a 64 digits hash value.

What do I understand wrong here?

Thx to everyone helping me out!

the result is HEX not ascii.

hex only uses 4 bits per hex 'character/digit' not 8 bits per 'character/digit'
so
FF in binary is 11111111
its not 11111111 11111111

so FF is one byte not 2 bytes

in short hex is more 'binary efficient' than ascii because you can fit more 'character/digit' per byte, compared to ascii

I DO NOT TRADE OR ACT AS ESCROW ON THIS FORUM EVER.
Please do your own research & respect what is written here as both opinion & information gleaned from experience. many people replying with insults but no on-topic content substance, automatically are 'facepalmed' and yawned at
xhomerx10
Legendary
*
Offline Offline

Activity: 3892
Merit: 8290



View Profile
November 25, 2016, 01:04:30 PM
 #3

^^
Absolutely.  What Franky says is spot on.  I thought I might add my two cents to maybe clarify.
Here is the SHA256 hash of your post:

Code:
101011100010011011011110000101000111101100001111110000110000111011000100100110000001010110110110011000011111111001011111011110111001111010001111010110010010110000100111011000110111010010001101011100001110000111001010111111110100011101101011111100010011100

 Converted to hex format is it:

Code:
57136f0a3d87e187624c0adb30ff2fbdcf47ac9613b1ba46b870e57fa3b5f89c

 64 characters right?  But if you view it like this:

Code:
57 13 6f 0a 3d 87 e1 87 62 4c 0a db 30 ff 2f bd cf 47 ac 96 13 b1 ba 46 b8 70 e5 7f a3 b5 f8 9c

 32 separate hexadecimal numbers (or 32 bytes) each one representing 8 of the bits in the hash.
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!