Hashes and integrity: how it works
The properties that make a hash function suitable for forensic use and why MD5 and SHA-1 are no longer enough on their own.
A cryptographic hash function is a public, deterministic algorithm: it uses no secret keys, and anyone applying it to the same data gets the same result. To serve as a seal it must have three properties.
- 01
Preimage resistance
Given a hash value, it must be infeasible to find data that produce it. You cannot go back from the hash to the file.
- 02
Second-preimage resistance
Given a file, it must be infeasible to find a different one with the same value.
- 03
Collision resistance
It must be infeasible to find any two pieces of data with the same value.
The avalanche effect
A good hash algorithm shows the avalanche effect: a minimal change in the input — a comma, a capital letter — changes on average half the bits of the value. Two “almost identical” values do not mean two almost identical files: values either match or they differ.
$ echo -n "Exhibit 1" | sha256sum
$ echo -n "exhibit 1" | sha256sum
# two completely different values for a single lower-case letterThe most common algorithms
| Algorithm | Value length | Status for forensic use |
|---|---|---|
| MD5 | 128 bits (32 characters) | Collisions constructible since 2004: only as a companion |
| SHA-1 | 160 bits (40 characters) | Practical collision demonstrated in 2017: avoid on its own |
| SHA-256 | 256 bits (64 characters) | No known practical attack: recommended standard |
| SHA-512 / SHA-3 | 512 bits or variable | Robust, less common in everyday tools |
Hashes and integrity: the step-by-step procedure
How hash values are computed, documented and verified during a forensic acquisition and in the later stages.
The pages of this topic
Back to the overviewHashes and integrity: the tools
From commands built into operating systems to forensic software: what is used to compute and verify hash values.
Hashes and integrity: pitfalls to avoid
Values computed too late, weak algorithms, the wrong files: the mistakes that take away the value of the hash seal.
Hashes and integrity: value in court
How the hash value meets the requirement to preserve original data and prevent their alteration, and its limits before a judge.
Hashes and integrity: a case study
A dispute over a video filed in a lawsuit: how hash values settle the question of whether the copies match.
Hashes and integrity: the checklist
The essential checks for using hash values correctly during an acquisition and in the later stages.
Hashes and integrity: frequently asked questions
Short answers to the most common doubts about hash values, algorithms and the integrity of digital evidence.