What is a Hash Function?
A hash function takes input data of any size and produces a fixed-size output (the "hash" or "digest").
Key Properties
- Deterministic: Same input always produces same output
- Fast: Quick to compute for any input size
- One-way: Cannot reverse hash to get input
- Collision-resistant: Hard to find two inputs with same hash
- Avalanche effect: Small input change = completely different hash
Common Algorithms
| Algorithm | Output Size | Status |
|---|
| BLAKE3 | Variable | ✅ Secure, Fast |
|---|
Example: SHA-256
Input: "Hello"
SHA-256: 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
Input: "hello" (just lowercase)
SHA-256: 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
Completely different output!
Use Cases
| Password storage | bcrypt, Argon2 (NOT raw SHA) |
|---|
| Digital signatures | SHA-256 or SHA-3 |
|---|
| Hash tables | Non-crypto (MurmurHash) |
|---|
| Checksums | SHA-256 or BLAKE3 |
|---|
| Git commits | SHA-1 (legacy) → SHA-256 |
|---|