You're thinking of cryptographic hashes. There are many kinds of hash (geographic, perceptual, semantic, etc), many of which are designed to only be slightly different.
There is a class of hashes known as locality-sensitive hashes, which are designed to preserve some metric of "closeness".