October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

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

SHA-256 is the sensible default for a new general-purpose hash. MD5 and SHA-1 are unsuitable where collision resistance matters, though legacy and error-detection uses differ.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a new general-purpose cryptographic hash, choose SHA-256 unless a protocol or compliance profile requires something else. Avoid MD5 and SHA-1 when collision resistance matters—especially when creating digital signatures. MD5 has a narrow remaining role in detecting accidental errors, while SHA-1 is mainly a legacy-compatibility concern as standards transition away from it.

What a hash does—and what it does not do

A cryptographic hash turns input of arbitrary length into a fixed-length digest. SHA-1 produces a 160-bit digest, SHA-256 produces a 256-bit digest, and MD5 produces a 128-bit digest. These sizes are specified in NIST’s Secure Hash Standard for SHA-1 and SHA-256 and IETF RFC 6151 for MD5.

As an Amazon Associate I earn from qualifying purchases.

A digest can help detect a change, but it does not automatically prove who created a file or that it came from a trusted source. If an attacker can replace both a file and the checksum published beside it, the attacker can make the two match. For authenticity, the expected digest must arrive through a trusted channel or be protected by an appropriate authenticated mechanism.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

How MD5, SHA-1, and SHA-256 compare

Algorithm Digest size Practical guidance
MD5 128 bits Not suitable where collision resistance is required. A narrow use remains for inline error detection when there is no active attacker.
SHA-1 160 bits Avoid for new uses requiring collision resistance, including new digital signatures. May remain relevant for legacy verification or a specifically permitted context.
SHA-256 256 bits Defensible default for a new general-purpose hash among these three, subject to the target protocol and applicable policy.

The longer digest is not the only reason to choose SHA-256. The decisive issue is whether the algorithm remains appropriate for the security property and context you need.

When MD5 is still acceptable

MD5 has known collision weaknesses. RFC 6151 says it is no longer acceptable where collision resistance is required, such as for digital signatures. If an attacker can construct two different inputs with the same digest, a system that relies on collision resistance may accept a harmful substitution.

The RFC preserves a narrow distinction: “Where the MD5 checksum is used inline with the protocol solely to protect against errors, an MD5 checksum is still an acceptable use.” That means accidental transmission-error detection—not protection against deliberate tampering. A checksum downloaded from the same untrusted location as the file does not establish authenticity.

RFC 6151 also says existing HMAC-MD5 uses may not require urgent removal, but advises that new protocol designs should not include HMAC-MD5. That qualified legacy observation is not a recommendation for new authentication designs.

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

Where SHA-1 stands now

SHA-1’s 160-bit digest does not make it a sound choice for new collision-resistant applications. NIST says federal agencies should use SHA-2 or SHA-3 as an alternative to SHA-1, and its policy directs agencies away from SHA-1 for digital signatures, timestamps, and other applications requiring collision resistance. SHA-1 may still be encountered when verifying legacy material or where specific guidance permits it; that is different from generating new signatures.

In a December 15, 2022 announcement, NIST set December 31, 2030 as the date for federal agencies to complete their transition away from SHA-1 for applying cryptographic protection to all applications. NIST also said SHA-1 may still be needed to handle information protected before that date. This is a federal-agency transition plan, not a universal legal deadline for every private organization. NIST further stated that after December 31, 2030, FIPS 140-validated cryptographic modules listing SHA-1 as an approved algorithm would move to the historical list.

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

Why SHA-256 is the default for a new use

SHA-256 is part of the SHA-2 family. NIST’s SP 800-131A Rev. 1 treats SHA-2 as acceptable for all hash-function applications covered by its guidance and encourages implementers to support SHA-256 at minimum when hash interoperability is needed. It is therefore the straightforward choice among these three for a new general-purpose cryptographic hash.

That is not permission to ignore the system around the hash. Follow the protocol’s current requirements, any required cryptographic-module validation, and your organization’s policy. For example, RFC 9155 specifically prohibits MD5 and SHA-1 signature hashes in TLS 1.2 and DTLS 1.2; protocol-specific requirements should be checked rather than inferred from a general recommendation.

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

Choose by the job you need the hash to do

  • Creating a new digital signature: Do not use MD5 or SHA-1. Use an algorithm permitted by the signature scheme and applicable policy; SHA-256 is the sensible choice among the three discussed here.
  • Checking for accidental file corruption: MD5 can serve as a basic error-detection checksum if accidental errors are the only concern. Prefer a digest obtained through a trusted channel if the file may be targeted.
  • Verifying an old signature or archived material: SHA-1 may arise in legacy verification. Preserve the distinction between checking previously protected information and creating new protection, and follow the relevant validation rules.
  • Implementing a named protocol or regulated system: Use that protocol’s current profile and your applicable compliance requirements, even if they narrow the general choice.
  • Storing passwords: Do not treat this comparison as a password-storage recommendation. General-purpose hashes and password-hashing schemes solve different problems; the cited guidance here does not establish any of these three as suitable password storage.

A practical decision path

  1. Identify the security service you need: accidental error detection, adversarial integrity, collision resistance, or a digital signature.
  2. If an active attacker matters, do not rely on a bare checksum received alongside the data as proof of authenticity.
  3. For a new general-purpose hash among MD5, SHA-1, and SHA-256, select SHA-256 unless a named protocol, validation rule, or policy says otherwise.
  4. Keep MD5 or SHA-1 only where a specific legacy or narrowly permitted use justifies it, and avoid generating new collision-resistant protections with either one.

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 *

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
Windows Errors? Fix Them Before They SpreadFree repair scan
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.