โ† Home ยท ๐Ÿ”‘ Hash Generator

MD5 vs SHA-256: Hashing Explained for Developers

Updated August 22, 2026 ยท Read time: ~6 min ยท Part of the Web Toolkit dev guide series

You've seen MD5, SHA-1, and SHA-256 in checksum tools, package managers, and database tables โ€” but which one should you actually use in 2026? This guide explains what hashing is, why MD5 and SHA-1 are cryptographically broken, and when each algorithm is (or isn't) safe.

The one-line rule

For any security-sensitive use โ€” passwords, integrity checks against tampering, API signatures โ€” use SHA-256 (or stronger), never MD5 or SHA-1. MD5 and SHA-1 remain only in legacy compatibility and non-security contexts (e.g., accidental-duplicate detection).

1. What a hash actually is

A hash function maps any input โ€” a file, a password, a message โ€” to a fixed-size digest:

MD5("hello world")   = 5eb63bbbe01eeed093cb22bb8f5acdc3
SHA-1("hello world") = 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
SHA-256("hello world") = b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9

Three defining properties make hashes useful:

2. The comparison table

AlgorithmDigest sizeBroken?Status in 2026Good for
MD5128-bit (32 hex)Yes โ€” collisions since 2004Never for securityCaching keys, dedupe
SHA-1160-bit (40 hex)Yes โ€” SHAttered 2017Deprecated everywhereLegacy git objects
SHA-256256-bit (64 hex)No known practical attackIndustry defaultSignatures, integrity, TLS
SHA-512512-bit (128 hex)No known practical attackStronger siblingHigh-security contexts

3. Why MD5 and SHA-1 are broken

Collision = two different inputs producing the same digest. In 2004, researchers demonstrated MD5 collisions; by 2008 they were producing them in seconds on consumer hardware. SHA-1's first real collision ("SHAttered", 2017) took Google roughly 6,500 CPU-years โ€” still feasible for a well-resourced attacker, and the method has only gotten cheaper since.

Why this matters: if an attacker can craft a file that hashes identically to a legitimate one, they can swap malicious content into a system that trusts hash-based fingerprints โ€” think package downloads, certificates, or code signing. There's also the birthday paradox: collisions for an n-bit hash become practical at roughly 2^(n/2) operations โ€” for MD5 that's ~2^64 (fast), for SHA-256 ~2^128 (world was not built for that).

4. Password hashing โ€” a separate topic

Even SHA-256 is the wrong tool for passwords. Password hashes need to be slow to resist brute force, which is why the industry uses bcrypt, scrypt, or Argon2 (and salts everything). Plain SHA-256 for passwords is vulnerable to fast dictionary attacks โ€” use a password-stretching KDF instead. MD5-for-passwords is worst of all: roughly 10^10 hashes per second are trivial on GPUs.

5. What SHA-256 is used for today

Compute MD5, SHA-1, SHA-256, SHA-512 and HMAC for any text instantly โ€” in your browser.

Open Hash Generator

6. Frequently asked questions

Is MD5 still used? Yes, but only where integrity-adversary isn't a concern: checksums for accidental corruption, caching keys, deduplication. Never for security. Is SHA-256 quantum-safe? Grover's algorithm halves effective strength to 2^128 โ€” still safe in practice for decades. Can I reverse a hash? No, but short inputs (passwords, names) can be found via precomputed rainbow tables โ€” which is why salt exists. Which should I pick for checksums? SHA-256: universally supported and practical.

โ˜• Support this free tool โ€” every tip keeps it ad-free
โ† Toolkit ยท Premium ยท Privacy