Is there a hash function for binary data which produces closer hashes when the data is more similar? <p>I'm looking for something like a hash function but for which it's output is closer the closer two different inputs are?</p> <p>Something like:</p> <pre><code>f(1010101) = 0 #original hash f(1010111) = 1 #very close to the original hash as they differ by one bit f(0101010) = 9999 #not very close to the original hash they all bits are different </code></pre> <p>(example outputs for demonstration purposes only)</p> <p>All of the input data will be of the same length.</p> <p>I want to make comparisons between a file a lots of other files and be able to determine which other file has the fewest differences from it. </p>