MD5 is broken, SHA-1 is deprecated, and SHA-256 is the current standard. A clear explanation of cryptographic hash functions, what makes them secure, and how to choose the right one.
Cryptographic hash functions are fundamental building blocks of modern computing security — used in password storage, file integrity verification, digital signatures, and blockchain. Understanding the difference between MD5, SHA-1, SHA-256, and SHA-512 helps you make the right security decisions and understand why some algorithms are no longer considered safe.
A hash function takes an input of any length and produces a fixed-length output called a hash, digest, or checksum. The key properties of a good cryptographic hash function:
| Algorithm | Output size | Speed | Security status (2026) | Use cases |
|---|---|---|---|---|
| MD5 | 128-bit (32 hex chars) | Very fast | Broken — do not use for security | File checksums (non-security), legacy systems |
| SHA-1 | 160-bit (40 hex chars) | Fast | Deprecated — do not use for security | Git commit hashes, legacy TLS (deprecated) |
| SHA-256 | 256-bit (64 hex chars) | Moderate | Secure — current standard | Digital signatures, TLS, file integrity, blockchain |
| SHA-512 | 512-bit (128 hex chars) | Slightly slower | Secure — higher security margin | High-security applications, 64-bit systems |
| SHA-3 (Keccak) | 224–512-bit | Moderate | Secure — different algorithm family | Applications needing diversity from SHA-2 |
| bcrypt / Argon2 | Configurable | Intentionally slow | Secure — purpose-built for passwords | Password hashing only |
Collision attacks — finding two different inputs that produce the same hash — have been demonstrated for both MD5 and SHA-1. In 2017, Google's Project Zero demonstrated the first practical SHA-1 collision (the “SHAttered” attack). MD5 collisions can be generated in seconds on modern hardware.
For integrity checking (detecting accidental file corruption, not malicious tampering), MD5 is still usable. For any security-sensitive application — digital signatures, certificate fingerprinting, HMAC authentication — use SHA-256 or better.
A critical point that causes many security vulnerabilities: fast hash functions like SHA-256 are not appropriate for password storage. They are designed to be fast, which means a GPU can test billions of guesses per second against a leaked password hash. Password hashing requires intentionally slow algorithms:
Hash functions are non-negotiable knowledge for developers working with security, data integrity, or authentication. Use SHA-256 or SHA-512 for all new security-sensitive applications; avoid MD5 and SHA-1 for anything beyond non-security checksums. Never use fast hash functions for password storage — use bcrypt or Argon2id instead. The ToolsGravity Hash Generator computes all major hash types instantly for text and files, with results ready to copy for integrity verification or comparison.