Hash Algorithm Comparison
| Algorithm | Output Size | Security | Speed |
|---|
| MD5 | 128 bits | Broken | Fastest |
| SHA-1 | 160 bits | Weak | Fast |
| SHA-256 | 256 bits | Strong | Moderate |
| SHA-512 | 512 bits | Strong | Varies |
Common Use Cases
File Integrity
Verify downloads haven't been corrupted or tampered with by comparing hashes.
Password Storage
Never store plaintext passwords. Hash them (with proper algorithms like bcrypt, not raw SHA-256).
Data Deduplication
Quickly identify duplicate files without comparing full contents.
Caching Keys
Generate cache keys from request parameters for deterministic lookups.
Important Security Notes
- Always use salts when hashing passwords
- MD5 and SHA-1 should not be used for security
- Use bcrypt, scrypt, or Argon2 for password hashing