It is often said in judicial opinions and legal briefs that the hash value derived from a file is like a fingerprint that uniquely corresponds to the source file. See, e.g., http://www.ca5.uscourts.gov/opinions/pub/17/17-41116-CR0.pdf

While this may be true in a practical sense, I question whether it is literally true. It is my understanding that the hash function is a many-to-one function, and therefore multiple source files could produce the same hash value. I understand that the utility of the hash function is that making a small change to a source file does not result in a small change to hash value derived from that file.

My understanding was confirmed by posters on the stack exchange computer science website See, https://math.stackexchange.com/questions/2889072/can-different-source-files-produce-the-same-hash-value

  • 4
    I'm voting to close this question as off-topic because it's a question about math or programming and not about the law. Aug 20, 2018 at 19:55
  • No. Several different files can create the same hash value, it is inherent in the way hashes are calculated. In practical usage, it depends on how the hash is calculated (what algorithm) and how large the hash is. If you, say, calculate a hash that is 3 bits, as soon as you have more than 8 different files, at least 2 will have the same hash. Some of the hash algorithms has been "hacked", meaning that there are ways to create a second file with the same hash. If you use a good algorithm the hash will in practice be a good fingerprint, with a very low probability of a files beting mixed up.
    – ghellquist
    Aug 20, 2018 at 20:38
  • Read the case cited. Courts make findings of fact. Sometimes these findings are based on technical misapprehensions. I would appreciate any input that other participants in the law site may have. Don’t see what harm it would do to post here. Thanks.
    – GAS4
    Aug 20, 2018 at 20:45

2 Answers 2


Are file hash codes really unique identifiers?

Literally, no, they are not. And the reason is obvious: the pigeonhole principle. However, given the current state of affairs in mathematics and computing, the chance of false positives is way too low to prevail in court under a standard of proof beyond a reasonable doubt in decisions that rely on hash values as evidence.

Once a person is able to present multiple different files which are associated to the same hash value, any legal precedent and jury instruction that relies on the assumption of uniqueness of hash values (and likewise, of digital signatures) would need to be stricken. But it is unrealistic to expect this to happen anytime soon.

  • 1
    I think that not only would someone need to present multiple different files which are associated to the same hash value, it should also need be reasonable for someone to mistake one of these files for another. The likelihood of 2 similar, but subtly different, files having the same hash is even more remote.
    – brhans
    Aug 20, 2018 at 20:22
  • 1
    @brhans I totally agree. The point is that a reproducible non-uniqueness of hash values would require a little bit of additional scrutiny of the evidence, instead of the automatic presumption of file identity that currently is deemed valid. And I speak in terms of "a little bit" because, as you rightly point out, the possibility of false positives still would be very remote. Aug 20, 2018 at 20:31
  • I agree that the distinction does not affect the sufficiency of proof beyond a reasonable doubt. It’s just that the statement of fact is, factually, incorrect. I think judges like to be precise with their findings.
    – GAS4
    Aug 20, 2018 at 20:48
  • A human fingerprint's uniqueness depends to a certain degree on how it is compared to other potential candidates - it's not hard to produce false positives or negatives under the right circumstances. In my layman's opinion it seems that a file hash would require less effort to make a finding of uniqueness to a greater degree of certainty than is currently the case with human fingerprints...
    – brhans
    Aug 20, 2018 at 21:05
  • @GAS4 "I think judges like to be precise with their findings" They should, but many of them are sloppy and/or corrupt. One thing I learned as a litigant in pro per is that many judges distort the evidenced facts so that those judges can force an invalid outcome. Since then, when I read appellate opinions, I am mindful not to concede as necessarily truthful the appellate judges' version of the facts of a case. Even where the judge has integrity, notions of judicial economy allow that judge to rely on expert testimony unless the adversary offers credible evidence in the latter's favor. Aug 20, 2018 at 21:25

I agree with @IñakiViggers' answer to a point. I take exception to his statement that:

... the chance of false positives is way too low to prevail in court under a standard of proof beyond a reasonable doubt...

I would say instead that to a degree it depends upon which hash algorithm was used. For example, the MD5 algorithm has "extensive vulnerabilities", and is "only [effective] against unintentional corruption" (see Ref 1). In other words, it is not only realistic, it has already happened for certain algorithms. Yet these algorithms remain in wide use. Why? Because they are fit for some purposes, but not others.

Consequently, I would answer the OP's question this way:

Hash codes provide an assurance of uniqueness with a high degree of probability, but it is not an absolute guarantee. Also, the strength of this assurance hinges on two factors:

  1. which algorithm was used to calculate the hash (digest), and
  2. the "intent of usage"; in other words was it used with the intent of discerning accidental errors (e.g. as in the git protocol), or was it intended to act as a backstop against deliberate file manipulation (e.g. as in a high-value contract)

As a point of speculation only, I would hazard a guess that the reason the OP's referenced legal opinion still stands is that the absolute veracity of a hash value has not met the appropriate legal challenge. It is, after all, an opinion, and subject to change as the facts themselves do.

[1: ]https://en.wikipedia.org/wiki/MD5

  • Your speculation is correct. I have not seen anyone challenge the description of hash codes as unique identifiers or “fingerprints” — even to the extent of adding the qualifier, “for all practical purposes.”
    – GAS4
    Aug 20, 2018 at 22:31
  • Nor is anyone likely to challenge it until the time comes when the authenticity of a "file fingerprint" becomes crucial in the outcome of a legal argument. Law changes under precedent, math and science under discovery.
    – Seamus
    Aug 20, 2018 at 22:44

Not the answer you're looking for? Browse other questions tagged .