LegalFoundation & Legal CoursesBasics of Cyber ForensicsStart here. Evidence handling, imaging, hashing, chain of custody and your first analysis.Technical tutorial · Digital evidence and law
Hash Verification in Digital Evidence
A hash value is the one number that lets a court trust that the copy examined is the copy seized. This tutorial covers which algorithms to use and why, when to hash, how hash sets work, how to verify an image against its source and how to write hashes into the chain of custody and the report, with a worked synthetic example.

A cryptographic hash function takes any input, from a 2 KB text file to a 4 TB disk image, and produces a fixed-length value. Change one bit of the input and the value changes completely. The function runs one way, so the value cannot be turned back into the data. In digital forensics this gives us a fingerprint: compute it on the original at the moment of acquisition, compute it again on any copy, and if the two values match the copy is the same, bit for bit.
That is the whole idea. The practice is where cases are won or lost: which algorithm, computed when, by whom, recorded where and compared against what. This tutorial takes each in turn and ends with a worked example using invented values.
MD5, SHA-1 and SHA-256
The facts below come from NIST's hash functions project page and from SWGDE's 2019 position paper on MD5 and SHA-1 (document 12-F-002, version 1.0, 29 September 2019).
- Collision versus preimage
- A collision is two inputs that an attacker chooses which share one hash. A preimage attack would produce an input to match a hash someone else already recorded. Forensic integrity depends on resisting the second. That distinction is why an MD5 recorded in 2016 still proves what it proved then, and why new acquisitions should carry SHA-256 all the same.
- MD5 (128-bit)
- The first practical public collision attack was published in 2004. Two different files can be engineered to share an MD5 value. Nobody has shown how to take an existing file and build a different one with the same hash, which is why SWGDE still accepts MD5 for integrity verification and file identification. It is not acceptable for digital signatures or other security uses.
- SHA-1 (160-bit)
- NIST deprecated SHA-1 in 2011 and disallowed it for digital signatures at the end of 2013. The first public collision was demonstrated in 2017. In December 2022 NIST published a plan to transition away from its remaining uses. SWGDE treats it like MD5: acceptable for integrity and identification, not for security applications, and recommends moving on.
- SHA-2 family (SHA-256, SHA-512)
- Specified in FIPS 180-4. No successful collision attack is known. SHA-256 is the common choice in forensic tools and the one we recommend as the primary value in every report. SHA-3 (FIPS 202) is an approved alternative built on a different design, and SWGDE recommends adopting SHA-2 or SHA-3 as tools support them.
Hash at Acquisition and at Every Transfer
SWGDE's position paper makes the central point: a hash only protects data from the moment it is computed, and only if the value itself is kept safely. Chain of custody starts at collection, not at the lab door.
- 01Before acquisition
Connect the source through a hardware write blocker or a forensic duplicator. Photograph the device label and record make, model, serial number and capacity. These identify the object the hash will belong to.
- 02During acquisition
Let the imaging tool compute SHA-256 (and MD5 if the tool offers both at no extra cost) of the source data as it reads it. Choose a verify option so the tool re-reads the finished image and compares. Formats such as E01 store the acquisition hash inside the container; a raw dd image needs the value written in a side file and in your notes.
- 03On every handover
When the image moves from field laptop to evidence server, from server to analyst workstation, or from the lab to a client or court, the receiving side recomputes the hash and signs for the match. One line in the custody record per transfer: date, time, from, to, algorithm, value, result.
- 04Before analysis and before export
Verify the working copy before you begin and verify any derivative you hand over, such as an exported folder or a report appendix of files. Each derivative gets its own hash; it is not the same object as the image.
- 05At the end
Verify the master image once more when the case closes and record it. Years later, if the evidence is questioned, this is the chain that shows the image never changed in your custody.

Hash Sets and What They Can Prove
A hash set is a list of known values. The National Software Reference Library, run by NIST, publishes the Reference Data Set of hashes of known software files, updated quarterly and free to download. Matching a case image against it lets an examiner set aside operating system and application files and concentrate on what is left. Agencies also maintain known-bad sets for contraband material so that files can be flagged without an examiner viewing them.
SWGDE draws a line here that students should remember. Identifying a file as evidence by hash alone, without visual or other inspection, is acceptable only with SHA-2 or SHA-3 values that come from an authorised source meeting evidentiary standards. MD5 or SHA-1 may filter and triage; they should not be the only basis for saying what a file is.
- Known-good sets remove noise; known-bad sets flag targets
- Record the hash set name, version and date used
- A match on a filtered set is a lead, not a conclusion, unless SHA-2 or SHA-3 from an authorised source
- Image-level and file-level hashes answer different questions
A Worked Example With Invented Values
Everything in this example is made up, including the hash values, which are not the hashes of anything. An examiner receives a 2 TB external hard drive, serial number recorded as EXT-2TB-0001 in the seizure memo. She connects it through a write blocker and images it to E01 with SHA-256 verification enabled. The tool reports the source SHA-256 as 7c1e4a0b9d2f6e8a3b5c7d9e1f2a4b6c8d0e2f4a6b8c0d2e4f6a8b0c2d4e6f8a (example value) and, after re-reading the image, the same value. She records the algorithm, both values, the tool name and version, the start and end time and her name in the acquisition log and on the chain-of-custody form.
Three days later the image is copied to the analysis workstation. The analyst recomputes SHA-256 and gets the same example value. He signs the transfer line. Two weeks later the client asks for a copy on a new drive. The lab copies the E01 segments, recomputes the hash on the copy, gets the same value and writes it on the transfer letter alongside the original. The client's own examiner can now confirm, without trusting anyone, that what arrived is what was seized.
Now the awkward case. Suppose the verification read of the source had returned a different value, say a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90 (example value). The correct response is not to image again until two runs agree and quietly keep the matching pair. It is to find the cause, usually unreadable sectors that the tool zero-filled on one pass and read on another, or a drive that changed its own contents between reads, as SSDs can. Record both values, the tool's error log and the explanation. A report that shows a mismatch and explains it is stronger than one that hides it.
Recording Hashes in the Chain of Custody and the Report
NIST SP 800-86 reminds organisations that the integrity of collected data must be maintained and demonstrable. The record is how you demonstrate it.
- Name the object precisely: device make, model and serial, or image file name and segment count. A hash without its object proves nothing.
- State the algorithm every time. Write SHA-256, not just hash.
- Write the full value in a fixed-width font. Never truncate it to the first eight characters in the body of a report; put the full value in the body or in a table, not only in an appendix.
- Record the tool and its version, the date and time and the person for each computation and each verification.
- Keep the custody form and the report consistent. A value that differs between the two by one character will be noticed by opposing counsel before anyone else.
- Store the hash record separately from the image, for example in the case management system, so that a change to the image cannot be accompanied by a change to its recorded hash.
- Where a hash mismatch occurred, say so, explain it and show what was done. Silence is the only unacceptable option.
This is an technical tutorial written by the DFRTI editorial team from the sources below. It is not a vendor announcement and DFRTI has not independently tested any product named in it unless the text says so.
Sources
- SWGDE Position on the Use of MD5 and SHA1 Hash Algorithms in Digital and Multimedia Forensics (12-F-002, v1.0, 2019)Scientific Working Group on Digital Evidence
- Hash Functions project page (SHA-1 deprecation, FIPS 180-4, FIPS 202)NIST Computer Security Resource Center
- NIST SP 800-86, Guide to Integrating Forensic Techniques into Incident Response (2006)NIST
- National Software Reference Library (NSRL) and the Reference Data SetNIST
Disciplines
Tools mentioned
- Exterro FTK ImagerFTK Imager is the free tool most learners meet first. It makes forensic images of drives, folders and memory, verifies them with hashes and lets an examiner preview evidence before committing to a full acquisition.Exterro
- Hardware Write BlockersA hardware write blocker sits between an evidence drive and the examiner's computer and refuses every write command. It is the first device a new examiner should understand.Various manufacturers
- Forensic DuplicatorsA forensic duplicator is a standalone imaging device. It copies a source drive to a destination drive or image file, hashes the result and verifies it, without a computer in between.Various manufacturers
- X-Ways ForensicsX-Ways Forensics is the German examination tool that runs light, starts fast and gives the examiner the raw disk alongside the parsed view. Version 21.9 was current when this page was checked.X-Ways Software Technology AG
- AutopsyAutopsy is a free, open source examination platform that puts a graphical interface and ingest modules on top of The Sleuth Kit. For a student it is the first tool that shows a whole case from image to report at no cost.Sleuth Kit Labs
Learn this properly
LegalFoundation & Legal CoursesBasics of Cyber ForensicsStart here. Evidence handling, imaging, hashing, chain of custody and your first analysis.
LegalFoundation & Legal CoursesForensic Report WritingWrite clear forensic reports that answer the questions asked and survive cross-examination.
StorageDigital Storage ForensicsHDD ForensicsImage hard drives through a write-blocker, find hidden areas and recover deleted data.Go deeper with DFRTI
Free pages explain the ground. Structured courses, lab work and a mentor take you from knowing about it to doing it on a case.