Hash Algorithm Comparison
Hash algorithms fall into two groups with opposite requirements. General-purpose hashes such as SHA-256 should be fast, and suit checksums and signatures. Password hashes such as bcrypt and Argon2 must be deliberately slow, because speed is what lets an attacker crack a stolen database. Using one where the other belongs is the most common mistake.
Choosing a hash is usually a two-step decision. First, is this a password? If so, the answer is Argon2id, scrypt or bcrypt, and nothing else on this page is appropriate. If not, the answer is almost always SHA-256.
The rest is detail: whether a shared secret is involved (use HMAC), whether you need interoperability with something older, and whether the algorithm you inherited is still safe to keep.
General-purpose hashes
9 entriesFast by design. For checksums, signatures and integrity — never for passwords.
| Algorithm | Digest | Status | Use it for |
|---|---|---|---|
| MD5 | 128 bit, 32 hex | Broken — practical collisions since 2004 | Non-security checksums and legacy compatibility only. Never for signatures. |
| SHA-1 | 160 bit, 40 hex | Broken — practical collision demonstrated 2017 | Legacy compatibility only. Git still uses it for object naming, for historical reasons. |
| SHA-256 | 256 bit, 64 hex | Secure — no practical attack | The default choice. Checksums, signatures, certificates, content addressing. |
| SHA-512 | 512 bit, 128 hex | Secure — no practical attack | Where a specification requires it, or when benchmarked faster on 64-bit hardware. |
| SHA-3 / Keccak | Configurable | Secure — different internal design | A structurally independent alternative to SHA-2. Immune to length extension. |
| BLAKE3 | 256 bit default | Secure — very fast | High-throughput hashing of large files. Not yet as widely supported. |
| CRC32 | 32 bit | Not cryptographic | Accidental corruption detection only. Trivial to forge deliberately. |
| xxHash | 64 or 128 bit | Not cryptographic | Extremely fast. For hash tables, deduplication and change detection where no attacker is involved. |
| SipHash | 64 bit, keyed | Not a general hash | Keyed, and designed to stop hash-flooding attacks on hash tables. Used internally by several languages for exactly that. |
Password hashes
5 entriesDeliberately slow and salted. For storing passwords, and nothing else.
| Algorithm | Cost control | Status | Notes |
|---|---|---|---|
| Argon2id | Time, memory and parallelism | Current recommendation | Winner of the Password Hashing Competition. Resists GPU and custom-hardware attacks through memory cost. |
| scrypt | CPU and memory | Strong | Memory-hard. A good choice where Argon2 is unavailable. |
| bcrypt | Cost factor | Still acceptable | Well understood and available everywhere. Silently truncates input beyond 72 bytes — a real trap with long passphrases. |
| PBKDF2 | Iteration count | Acceptable, weakest of the four | Not memory-hard, so it resists GPU attacks poorly. Use only when a standard mandates it. |
| Plain SHA-256 or MD5 | None | Do not use | Listed only because it is still found in the wild. Too fast, and unsalted by default, so a stolen database falls in hours. Migrate on next login. |
Keyed hashing
3 entriesProving a message came from someone holding the shared secret.
| Construction | Built on | Status | Notes |
|---|---|---|---|
| HMAC-SHA256 | SHA-256 | Secure | The standard way to authenticate a message with a shared secret. Used by webhooks and API signing. |
| HMAC-SHA512 | SHA-512 | Secure | Same construction, longer digest. |
| Naive H(secret + message) | Any Merkle–Damgård hash | Insecure | Vulnerable to length extension: an attacker can append data and compute a valid digest without the secret. This is why HMAC exists. |
Notes
- "Broken" means collision resistance is broken: an attacker can construct two different inputs with the same digest. Preimage resistance still holds for MD5 and SHA-1, which is why they still detect accidental corruption.
- A hash is not encryption. It is one-way by design, and there is no key that recovers the input. If you need to get the original back, you want encryption, not hashing.
- Salting is what stops precomputed tables. Password hash functions generate and store a salt automatically; a bare SHA-256 does not, which is one of several reasons it is unsuitable for passwords.
Frequently asked questions
Which hash should I use if I only remember one?
Is MD5 safe for anything?
Why not hash passwords with SHA-256?
What is length extension?
Does bcrypt really ignore long passwords?
Related tools
All tools →- Hash Generator Generate MD5, SHA-1, SHA-256 and SHA-512 digests at once. In your browser
- SHA-256 Hash Generator Generate a SHA-256 digest — the modern default. In your browser
- MD5 Hash Generator Generate an MD5 checksum from any text. In your browser
- HMAC Generator Sign a message with a secret key using HMAC. In your browser
- Bcrypt Generator and Verifier Create and verify bcrypt password hashes. Server-side
- Password Strength Checker Estimate how long a password would take to crack. In your browser
More reference tables
All references →Last reviewed .