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.
256 bits รท 8 = 32 bytes
Each hex digit represents 4 bits, so: 256 bits รท 4 = 64 hex digits
Each group of 4 binary bits becomes 1 hex digit:
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
| 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 |