Hashes and integrity · 01 How it works

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.

  1. 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.

  2. 02
    Second-preimage resistance

    Given a file, it must be infeasible to find a different one with the same value.

  3. 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.

terminale
$ echo -n "Exhibit 1" | sha256sum
$ echo -n "exhibit 1" | sha256sum
# two completely different values for a single lower-case letter

The most common algorithms

AlgorithmValue lengthStatus for forensic use
MD5128 bits (32 characters)Collisions constructible since 2004: only as a companion
SHA-1160 bits (40 characters)Practical collision demonstrated in 2017: avoid on its own
SHA-256256 bits (64 characters)No known practical attack: recommended standard
SHA-512 / SHA-3512 bits or variableRobust, less common in everyday tools
Continue with
02 Step-by-step procedure

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.

↑