Hashing Explained: MD5, SHA-256, and When to Use Each

Hashing converts data of any size into a fixed-length, one-way digest used to verify integrity — MD5 is fast but no longer cryptographically secure, while SHA-256 and SHA-512 remain considered secure for current use.

Key Points

  • A hash is one-way — it cannot be reversed back to the original input
  • MD5 is no longer secure for cryptographic use due to known collision attacks
  • SHA-256 and SHA-512 are currently considered cryptographically secure
  • Hashing is for verification and comparison, not for hiding data that needs to be recovered later

Why hashing exists

A hash function takes an input of any size and produces a fixed-length output (the “hash” or “digest”) in a way that is deterministic (the same input always produces the same hash) and, for a good hash function, practically impossible to reverse back to the original input. This makes hashing useful for verifying data integrity and storing sensitive values without keeping the original.

MD5

MD5 produces a 128-bit hash and was widely used historically for checksums (verifying a downloaded file wasn’t corrupted). MD5 is no longer considered secure for cryptographic purposes — collisions (two different inputs producing the same hash) can be deliberately engineered — so it should not be used for password storage or security-sensitive verification today, only for basic non-security integrity checks.

SHA-256 and SHA-512

SHA-256 and SHA-512 are part of the SHA-2 family and produce 256-bit and 512-bit hashes respectively. They are considered cryptographically secure at present and are widely used for digital signatures, certificate fingerprints, blockchain, and secure checksums. SHA-512 generally performs faster than SHA-256 on 64-bit systems and produces a longer digest, but for most applications either is considered secure — the choice is often about consistency with an existing system rather than a meaningful security difference.

What hashing is not for

Hashing is not encryption — a hash cannot be “decrypted” back to the original input, because it isn’t meant to be reversible. If you need to recover the original data later, you need encryption, not a hash function. Hashing is used to verify or compare, not to hide-and-later-reveal.

Frequently Asked Questions

Is MD5 completely useless today?

It's still fine for basic non-security checksums, like verifying a file wasn't accidentally corrupted, but it should not be used for passwords or security-sensitive verification.

Can a hash be decrypted back to its original value?

No, hashing is intentionally one-way — if you need to recover the original data later, you need encryption instead of a hash.

Explore More

Browse every free calculator and tool, or find more practical guides.