LocalToolkit
HomeHash & Checksum › Hash Algorithm Comparison

Which Hash Algorithm Should You Use?

A short decision table, because the answer depends on whether an attacker can choose your input.

🔒 Runs in your browser. Nothing is uploaded — verify it in the network panel, or disconnect and try again.

The only question that matters

Ask whether an adversary can influence the bytes you are hashing. If not — you are detecting bit-rot, deduplicating blobs, or busting a cache — almost any function works and you should pick for speed and availability. If yes, collision resistance is mandatory and only the SHA-2 and SHA-3 families qualify.

AlgorithmOutputCollision statusChoose it for
MD5128 bitBroken (2004)Legacy checksums, cache keys, non-adversarial integrity only
SHA-1160 bitBroken (SHAttered 2017)Reproducing values from systems you do not control; git object IDs
SHA-256256 bitNo known attackThe default for integrity, content addressing, code signing, JWT HS256
SHA-512512 bitNo known attackProtocols that specify it; 64-bit native performance
SHA-3 / Keccak224–512 bitNo known attackDiversity from Merkle–Damgård; sponge construction; NIST standard since 2015
BLAKE3extendableNo known attackVery high throughput, tree hashing, parallel verification
Argon2idconfigurablen/aPassword storage — memory-hard and deliberately slow

Two mistakes that outrank algorithm choice

Is a longer digest always safer?

No. Collision resistance grows as 2 to the power of half the digest length: 2^64 for MD5, 2^128 for SHA-256. Both MD5 and SHA-256 exceed what any attacker can reach by brute force, yet MD5 is broken because the attack is analytic, not brute force. Length buys headroom; it does not buy a sound design.

Migration advice that works: introduce SHA-256 alongside the old digest, store both for a release cycle, then drop the weak column. Never rewrite history in place if downstream systems depend on the old values.

How to use it

  1. Find your row in the table above.
  2. Confirm the 'collision status' column is acceptable for your threat model.
  3. If a secret is involved, switch to HMAC rather than a bare hash.
  4. If a password is involved, switch to Argon2id, scrypt or bcrypt.

Worth knowing

  • MD5 collisions are constructible in seconds on commodity hardware today.
  • SHAttered (2017) produced two PDFs sharing a SHA-1 digest.
  • SHA-2 was published in 2001 and remains unbroken for collisions.
  • NIST selected Keccak as SHA-3 in 2012 and standardised it in 2015.

Limitations

  • This table describes cryptographic properties, not library availability in your language.
  • Some hardware and FIPS profiles restrict which functions you may use.
  • No hash provides keyed integrity — that requires HMAC or a signature.
  • Performance varies enormously between native, hardware-accelerated and JavaScript implementations.

Frequently asked questions

What is the best hash algorithm in 2026?
For integrity: SHA-256. For keyed authentication: HMAC-SHA256. For passwords: Argon2id. There is no single winner because the requirements differ.
Is SHA-3 better than SHA-256?
SHA-3 is a structurally different design (a sponge rather than Merkle–Damgård) chosen through an open NIST competition. It offers diversity if SHA-2 is ever weakened, but no practical advantage today.
Why is bcrypt still recommended if it is from 1999?
Because age is irrelevant next to design. bcrypt is deliberately slow and salted. Its one weakness is a 72-byte input cap and no memory hardness, which is where Argon2id improves on it.
Can two different files have the same SHA-256?
By pigeonhole principle, yes — infinitely many inputs share each digest. By computation, no one has found a pair and the work required is estimated at 2^128 operations.
Related tools
SHA-256 Hash GeneratorMD5 Hash GeneratorSHA-512 Hash GeneratorHMAC GeneratorSHA-1 Hash GeneratorFile Checksum Verifier
Keep reading
How browser-only processing worksAll Hash & Checksum toolsEvery tool on the site