What Is Hashing?
A hash function takes any input and produces a fixed-size output (digest). It's a one-way function: easy to compute the hash, impossible to reverse it.
Hash Example
SHA-256("Hello") =
185f8db32271fe25f561a6fc938b2e26
4306ec304eda518007d1764826381969
SHA-256("hello") = (different!)
2cf24dba5fb0a30e26e83b2ac5b9e29e
1b161e5c1fa7425e73043362938b9824
Properties
Deterministic
Same input always = same output
ConsistentFast
Quick to compute for any input size
EfficientOne-Way
Cannot reverse to get input
IrreversibleAvalanche Effect
Tiny input change = completely different hash
SensitiveCommon Algorithms
SHA-256Standard choice, widely used in TLS, Bitcoin
SHA-3 (Keccak)Backup standard, different design
BLAKE2/BLAKE3Fast modern alternatives
MD5BROKEN - collisions found, never use for security
SHA-1BROKEN - deprecated, avoid
Use Cases
- Password storage (with proper KDF)
- Data integrity verification
- Digital signatures
- Blockchain proof-of-work
- File deduplication
- HMAC for message authentication
Password Hashing
Don't use plain SHA for passwords! Use specialized password hashing functions: Argon2 (recommended), bcrypt, or scrypt. These are intentionally slow to prevent brute force attacks.