The way we know (cryptographic) hashes is mostly that they are totally different if the input is changed for just the minimum amount.

md5('This is some boring string to test with')    // d546c64928a28b5f605610a919680907
md5('This is another boring string to test with') // a74c1d74da495895bf48056ac979723a

Here you see that the hash is totally different, though I only changed one word.

What I'm looking for is a hash function that returns returns an output which is just as similar, as the inputs are similar, and just as different as the inputs are different

fn('This is some boring string to test with')     // 00dd2171b47cc2748c2874c42284737
fn('This is another boring string to test with')  // 01ed2371b47cc5748c2874c42284738
fn('The quick brown fox jumps over the lazy dog') // 27bc27999aa2c3c2452cff234feee21

See how the first two hashes are quite similar, but the third one is completely different.

I don't want just a simple error-checking mechanism that can detect slight changes though (like CRC). I want to be able to check if two hashes most probably have the a look-a-like origin, by seeing that the hashes are also look-a-likes.

My goal is to understand if it is possible to have hashes of let's say two (actual) fingerprints, and then merely based on the hashes conclude if the original fingerprints probably were from the same finger.

A long time ago I once learned such functions exist.

Can anyone tell me what these types of hashes are named, and what some examples are?

  • 2
    How is this a topic of information security? As the question currently is I'm voting to close it as off-topic. Apart from that have a look at Locality-sensitive hashing. – Steffen Ullrich Oct 3 '17 at 18:41
  • why is a hashing algorithm usable for fingerprint recognition, without having to store the original fingerprint, not something for Information Security? – nl-x Oct 3 '17 at 19:22
  • With this argument everything is something for information security, e.g. asking how to compare strings etc. I think a general question about similarity fingerprints is off-topic while it could be on-topic if the presented problem is not a generalized similarity fingerprint but an actual information security problem which might (or might be not) solved with such similarity fingerprints. A clear description of the use case would also make clear what kind of similarity is actually needed to solve the specific problem. – Steffen Ullrich Oct 3 '17 at 19:37
  • I have no idea and this is not related to your question either, i.e. off-topic too. – Steffen Ullrich Oct 3 '17 at 20:43
  • @SteffenUllrich what stackexchange would you think this question would lie under?? I don't see how this is off topic at all. – MikeSchem Oct 4 '17 at 21:20

Not sure if there existing hashes that do this. The reason being when hashes were developed, the requirement that any change in the inputs would create a large change in the output was a basic requirement of a hash. That being said I can purpose a way to do it.

An example would be a hash that just counts the occurrences of each letter in the input. For simplification let's say this hash only takes lowercase alphabet characters. So the length of the hash will be 26. Each position in the hash would refer to a different character. So the first position would total up all the a', the second would hold the total of the b's...

hello world

would hash to


because there are no a's, no b's, no c's, 1 d, ect

a change to

hello worlds

would hash to


The only difference would be the count for the "s".

Obviously there are many problems with this such as you can only have a maximum of 9 instances of each letter, but this is only an example to show how a hash could show small changes in output for small changes in the input.

  • I also was thinking of other ways how to make a custom algorithm. But surely one must already exist working out of the box? – nl-x Oct 3 '17 at 19:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.