Author

Topic: SHA 256 - 32 or 64 byte hash? (Read 1477 times)

legendary
Activity: 3808
Merit: 7912
November 25, 2016, 08:04:30 AM
#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.
legendary
Activity: 4424
Merit: 4794
November 25, 2016, 07:41:10 AM
#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
full member
Activity: 237
Merit: 100
November 25, 2016, 07:15:17 AM
#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!
Jump to: