๐Ÿ”ข SHA256: It's All Just Binary Numbers

Hexadecimal is just concise cosmetics for binary
โœจ Every HASH VALUE is just a big binary number.
Hexidecimal is simply how we display it to stay sane.

๐Ÿ’ก The Core Truth

When you hash something with SHA256, the computer produces a 256-bit binary number. That's 256 zeros and ones. But humans hate reading that, so we display it in hexadecimal.

Example: Hash of "hello"
HEXADECIMAL (what you see)
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
โฌ‡๏ธ This is actually... โฌ‡๏ธ
BINARY (what it really is)
0010110011110010010011011011101001011111101100001010001100001110 0010011011101000001110110010101011000101101110011110001010011110 0001101100010110000111100101110000011111101001110100001001011110 0111001100000100001101100010100100111000101110011000001000100100
โฌ‡๏ธ Which equals... โฌ‡๏ธ
DECIMAL (as one huge number)
20424989103923901075348170812983653635287848107825812940773313024167566566436
Key Point: All three representations above are the exact same number. Just displayed differently. Like how "twelve" = "12" = "XII" = "1100โ‚‚"

๐Ÿ“ Why 256 "Bits"?

Binary Digits
256
zeros and ones
Hex Digits
64
0-9, A-F
Bytes
32
8 bits each

256 bits รท 8 = 32 bytes
Each hex digit represents 4 bits, so: 256 bits รท 4 = 64 hex digits

๐Ÿ”„ How Binary Converts to Hex

Each group of 4 binary bits becomes 1 hex digit:

0000
โ†“
0
0001
โ†“
1
0010
โ†“
2
0011
โ†“
3
0100
โ†“
4
0101
โ†“
5
0110
โ†“
6
0111
โ†“
7
1000
โ†“
8
1001
โ†“
9
1010
โ†“
A
1011
โ†“
B
1100
โ†“
C
1101
โ†“
D
1110
โ†“
E
1111
โ†“
F
๐Ÿ’ก That's it! 4 bits always equals exactly 1 hex digit.
So 256 bits = 64 hex digits.

๐Ÿ”ฌ Real Example: First Byte of a Hash

Let's take the first 8 bits (1 byte) of the "hello" hash:

Format Value Explanation
Binary 00101100 The raw bits (8 bits = 1 byte)
Hex (grouped) 0010 1100 โ†’ 2C Split into 4-bit chunks
Hex (final) 2C What you see in the hash
Decimal 44 If you treat it as a regular number

The full SHA256 hash is just 32 of these bytes in a row:
2C F2 4D BA 5F B0 A3 0E 26 E8 3B 2A C5 B9 E2 9E
1B 16 1E 5C 1F A7 42 5E 73 04 33 62 93 8B 98 24

โ“ Why Do We Use Hex Instead of Binary?

Practical Reasons:

  • Shorter: 64 characters instead of 256
  • Readable: Easier to spot differences in hashes
  • Copy/paste friendly: Less error-prone
  • Byte-aligned: 2 hex digits = 1 byte perfectly
Format Length Readability
Binary 256 characters ๐Ÿ˜ต Terrible
Hex 64 characters ๐Ÿ˜Š Good
Decimal ~78 characters ๐Ÿ˜ OK but weird
Base64 44 characters ๐Ÿ˜• Compact but non-standard for hashes

๐Ÿงช Try It Yourself: Hash Any Text

Results:

HEXADECIMAL
BINARY (first 64 bits shown)
...rest omitted for space (192 more bits)
AS A DECIMAL NUMBER

๐ŸŒ Where You See This In The Wild

// Git commits (SHA1, but same concept)
git log
commit a3f5e8d2c1b9... โ† This is hex display of a binary number

// File checksums
sha256sum myfile.txt
e3b0c44298fc1c14... โ† This is hex display of a binary number

// Bitcoin addresses
1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa โ† Based on hash (hex โ†’ base58)

// SSL Certificate fingerprints
SHA256: 2C:F2:4D:BA:5F:B0... โ† Same hex, just with colons
๐ŸŽฏ BOTTOM LINE:

Every SHA256 hash is a 256-bit binary number.
Hex is just the human-friendly costume we put on it.

The computer doesn't care - it works with raw bits.
We use hex so our brains don't melt.