What is a Hash?
A cryptographic hash is a one-way function that converts input data into a fixed-size string of characters. The same input always produces the same hash, but you cannot reverse a hash to find the original input.
Common Hash Algorithms
MD5 (128-bit)
Fast but considered cryptographically broken. Still used for checksums and non-security purposes.
SHA-1 (160-bit)
Legacy algorithm, no longer recommended for security. Used in older systems and Git commit hashes.
SHA-256 (256-bit)
Part of SHA-2 family. Widely used for security, including Bitcoin and SSL certificates.
SHA-512 (512-bit)
Stronger version of SHA-256. Used when maximum security is required.
Common Uses for Hashing
- Password storage - store password hashes instead of plain text passwords
- File integrity - verify downloaded files haven't been tampered with
- Digital signatures - sign documents and verify authenticity
- Blockchain - create unique identifiers for blocks and transactions
- Data deduplication - identify duplicate files without comparing contents
Hash Security Tips
Important security notes:
- Never use MD5 or SHA-1 for security-critical applications
- Always use salted hashes for password storage
- For passwords, use specialized algorithms like bcrypt or Argon2
- SHA-256 is sufficient for most non-password security needs