October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

MD5 vs. SHA-256: Which Hash Should You Use?

SHA-256 is the choice for new cryptographic uses that need collision resistance. MD5 has only a narrow role in error-only checksums, and neither plain hash is suitable for password storage.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a new cryptographic use that needs collision resistance, choose SHA-256—not MD5. MD5 may still work as an inline checksum when the goal is only to catch accidental errors, but neither an MD5 nor a plain SHA-256 digest is an appropriate way to store passwords.

MD5 and SHA-256 at a glance

Both algorithms turn input data into a fixed-length digest, often called a hash. Their digest lengths differ, but the practical choice depends on what you need the hash to do—not just how many bits it outputs.

As an Amazon Associate I earn from qualifying purchases.

Question MD5 SHA-256
Digest length 128 bits, according to IETF RFC 6151 (2011). 256 bits, specified by NIST FIPS 180-4 (2015).
Collision resistance RFC 6151 says MD5 is no longer acceptable where collision resistance is required, including digital signatures. NIST SP 800-107 Rev. 1 (2012) gives SHA-256 an expected collision resistance of 128 bits.
Suitable for password storage as a single fast hash? No. No.
Relative speed A general speed ranking is not established here; performance depends on implementation and workload. A general speed ranking is not established here; performance depends on implementation and workload.

What collision resistance means—and why it matters

A collision occurs when two different inputs produce the same digest. Collision resistance is the difficulty of finding such a pair. It matters when a system relies on a hash to bind a signature or other security-sensitive operation to particular data: if an attacker can create two different inputs with the same digest, a hash-based check may no longer provide the intended protection.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Digest length alone does not describe every security property. NIST SP 800-107 Rev. 1 estimates SHA-256’s collision resistance at 128 bits and its preimage resistance at 256 bits. Preimage resistance concerns finding an input for a chosen digest; second-preimage resistance concerns finding a different input that matches the digest of a specified input. These are distinct attack goals, not interchangeable descriptions of “hash strength.”

When to use SHA-256

Choose SHA-256 for a new design that requires collision resistance, including digital-signature-related uses. NIST specifies SHA-256 as part of the Secure Hash Standard and describes secure hashes as a way to detect message changes. Its standard also discusses their use in digital-signature verification and message-authentication codes.

FIPS 180-4 was published in August 2015. NIST’s catalog records a March 2023 planning note that the standard would be revised following public comment. Check NIST’s current publication catalog for a successor when making a compliance decision.

When an MD5 checksum may still be acceptable

MD5 should not be used where collision resistance is required. RFC 6151’s narrow exception is an inline checksum used solely to protect against errors. In that limited setting, MD5 can detect accidental corruption if the expected checksum is trustworthy and the application clearly states the security service it provides.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This exception does not make MD5 a safe choice for signatures or protection against a malicious attacker. It is specifically about detecting errors, not establishing that data came from a particular person or was not deliberately replaced.

Does a matching hash prove a download is authentic?

No—not by itself. A matching digest shows that the file you checked produces the same digest as the value you compared it with. If an attacker can replace both the file and the published checksum, an unauthenticated comparison cannot tell you that the file is genuine.

When malicious substitution is a concern, obtain the expected digest through a trustworthy authenticated channel or verify a digital signature. A hash can help detect a change; authentication is what establishes whose data or checksum you are trusting.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why neither hash is right for storing passwords

A single MD5 or SHA-256 operation is a fast general-purpose hash, not a password-storage scheme. Fast hashing makes it practical for an attacker with stolen password data to test guesses offline. Choosing SHA-256 because it is stronger than MD5 does not solve that problem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

NIST SP 800-63B Revision 4 says verifiers should store passwords in a form resistant to offline attacks, using a suitable password-hashing scheme with a salt and a cost factor. The cost factor makes guessing more expensive and should be set as high as practical without harming verifier performance. Use a dedicated scheme designed for password hashing rather than either bare digest.

Choosing the right option

  • New security-sensitive design or digital signatures: use SHA-256 when collision resistance is required; do not use MD5.
  • Accidental-error check only: MD5 can fit RFC 6151’s limited inline-checksum exception, provided the application makes the limited security purpose clear.
  • Download authenticity against an attacker: use a trusted authenticated source for the digest or verify a digital signature; a bare checksum is not proof of origin.
  • Password storage: use a suitable salted password-hashing scheme with an appropriately expensive cost factor, not MD5 or plain SHA-256.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.