Hashing
Overview
Hashing converts data into a fixed-length, one-way value — used to verify integrity and to store passwords without keeping plaintext.
Key concepts
- Hash value / message digest, collisions
- Salting and peppering passwords
- SHA-256 (current) vs SHA-1/MD5 (deprecated)
How it works
Hashing converts data into a fixed-length value called a hash. A hash is designed to be one-way — the original data should not be recoverable from it. It's commonly used to verify integrity and to store passwords without keeping the plaintext.
Core terms
| Term | Meaning |
|---|---|
| Hash value / message digest | The fixed-length output created by a hashing algorithm (both terms mean the same thing). |
| Hash function | The algorithm that creates a hash value from data. |
| Collision | When two different inputs produce the same hash value — a weakness in an algorithm. |
Strengthening password hashes
| Term | Meaning |
|---|---|
| Salt | Random data added to a password before hashing, making password-cracking attacks harder. |
| Pepper | A secret value added to passwords before hashing, stored separately from the password database. |
Common algorithms
| Algorithm | Status |
|---|---|
| SHA-256 | Commonly used, currently secure — produces a 256-bit hash value. |
| SHA-1 | Older, no longer recommended due to known weaknesses. |
| MD5 | Older, no longer considered secure for security purposes. |