Skip to content

MD5 vs. SHA-256: Which Hash Fits the Evidence Record?

MD5 helps compare evidence with a legacy record. SHA-256 is the stronger choice for new baselines. Compare digests using the same algorithm and bytes.

By Sourabh4 min read

Use SHA-256 to establish a new evidence integrity baseline. Keep an MD5 digest when it lets you compare against a legacy acquisition record or reference set. Compare MD5 with MD5 and SHA-256 with SHA-256, with the same byte scope on both sides.

MD5 vs. SHA-256 in an Evidence Record

Scroll horizontally if needed to see the full table.

QuestionMD5SHA-256
What does it produce?A 128-bit digest, usually displayed as 32 hexadecimal charactersA 256-bit digest, usually displayed as 64 hexadecimal characters
When does it help?Comparing with a historical MD5 manifest or a legacy reference setEstablishing and checking a new integrity baseline
How strong is the comparison?Known collision weaknesses limit the conclusions an MD5 match can supportStronger collision resistance for contemporary integrity work

A collision occurs when two different inputs produce the same digest under one algorithm. The SWGDE position on legacy hashes describes the narrower uses for MD5 and encourages adoption of newer standards. NIST FIPS 180-4 specifies SHA-256. See the cryptographic hash glossary entry for how a digest summarizes a byte stream.

Teaching diagram. A hexadecimal MD5 digest has 32 characters and a SHA-256 digest has 64.

When a tool shows unlabeled values, use the manifest or tool settings to identify the algorithm. Digest length is a clue. Several algorithms and truncation schemes can produce the same number of characters.

Read the Algorithm and Byte Scope Before Comparing

Start with the input description on each line. A hash of a disk image, a hash of one file inside it, and a hash of the exported archive that holds that file answer three different questions.

Use a pair with the same algorithm and scope. A mismatch in that pair means the inputs differ, assuming both hashes were computed correctly. If the only older record is MD5, calculate MD5 on the corresponding bytes for that comparison and record its limits.

Teaching diagram. Compare the matching algorithm when it is available for the same byte scope.

Two Algorithms on the Same Three Bytes

The example below hashes the ASCII bytes for abc without any spaces or line breaks. It was checked with Python 3.14.0. Use Python 3.9 or later and save the code as a script.

python
from hashlib import md5, sha256

sample = b"abc"
print("MD5", md5(sample, usedforsecurity=False).hexdigest())
print("SHA-256", sha256(sample).hexdigest())
print("SHA-256 for abd", sha256(b"abd").hexdigest())

The MD5 starts with 90015098 and the SHA-256 starts with ba7816bf. Both digest values describe the same three bytes. Those prefixes are provided for orientation. Compare full digests when verifying evidence.

The final line hashes abd. The input is still three bytes long. Replacing the final c with d changes the SHA-256 prefix to a52d159f. Since both results use SHA-256, the different digests tell you that the input bytes differ.

Teaching illustration based on the verified sample. Changing one byte changes the SHA-256 digest even though both inputs have the same length.

Carry an MD5-Only Record Forward

  1. Preserve the original MD5 manifest and the details that identify its input.
  2. Compare the current item with that manifest using MD5 on the same byte scope. Investigate any mismatch before giving the item a verification status.
  3. Compute SHA-256 directly from the item bytes and record the date and tool. Keep the historical MD5 comparison and new SHA-256 baseline as two distinct results.

Keep the reference digest in a trusted case record. A digest match with an unverified reference shows only that the two values agree.

A SHA-256 calculated today establishes a baseline for the bytes available today. It cannot supply a SHA-256 verification for earlier custody. If neither the original bytes nor a contemporaneous SHA-256 record is available, state that limit.

For the transfer procedure and where to record the two SHA-256 readings, see verifying a SHA-256 hash after copying evidence.

What a Match Can Support

Imagine you receive a copy of a lab export and compare it with the original manifest. If the scoped SHA-256 digest agrees, that supports the claim that the checked bytes agree with the baseline. Your conclusion depends on knowing where the baseline came from.

The same digest can be copied into two text files without anyone checking either evidence file. Calculate the digest on the file you actually received. Keep the manifest with the case so someone else can repeat the comparison.

A different filename can still refer to the same bytes. A change to a file’s contents, such as saving it with a different encoding, can give the same-looking text a different digest. Compare the exact bytes covered by the record.

When an Older Manifest Contains Both Digests

Suppose the manifest lists MD5 and SHA-256 for the same file. Calculate each on the exact received file and compare it with its matching recorded algorithm. If one comparison fails, investigate the input scope, transcription, and source record before signing off.

If you need to explain the result in a report, list the algorithm, exact filename, byte scope, reference record, and outcome. “SHA-256 matched the sender’s manifest for the 7,102-byte export” tells the next examiner more than “hash verified.”

Was this page helpful?