Hashes and integrity · 04 Pitfalls to avoid

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.

The hash is a powerful but literal tool: it certifies exactly what it is given, at the moment it is computed. Mistakes almost always come from this.

The most frequent mistakes

  • Computing the value only after opening, renaming or converting the file.
  • Using only MD5 or SHA-1 for important evidence.
  • Quoting the value without stating the algorithm, or with characters copied by hand and mistyped.
  • Hashing a compressed archive rather than the files it contains, or vice versa, without saying so.
  • Not recomputing the value at later steps, relying only on the initial one.
  • Confusing the value of the whole disk with those of individual partitions.

Different hashes do not always mean tampering

If two values do not match, the first thought is tampering, but the cause is often trivial: an interrupted copy, a faulty medium, an automatic format conversion while sending. For this reason, besides the value, it is worth documenting the exact size in bytes and the path the file followed: it helps understand what happened.

Continue with
05 Value in court

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.

↑