Hash Algorithm Comparison
A cryptographic hash maps input of any size to a fixed-length digest. The right choice depends on whether you need a non-security checksum or a collision-resistant digest.
| Algorithm | Digest size | Hex length | Collision resistance |
|---|---|---|---|
| MD5 | 128-bit | 32 chars | Broken — do not use for security |
| SHA-1 | 160-bit | 40 chars | Broken — do not use for security |
| SHA-256 | 256-bit | 64 chars | Strong |
| SHA-384 | 384-bit | 96 chars | Strong |
| SHA-512 | 512-bit | 128 chars | Strong |
Output length is the hex-string length; the digest size in bits is shown in parentheses.
Frequently asked questions
Is MD5 safe to use?
Not for security. MD5 has practical collision attacks, so never use it for signatures, passwords, or integrity against an attacker. It is still fine as a fast checksum against accidental corruption.
Which hash should I use for checksums?
SHA-256 is the common default: widely supported, fast enough, and collision-resistant. Use SHA-512 when you specifically want a longer digest.