# How to control the output of a hash function to output to specific data according to similarity?

I do not know if the question lies exactly in that field but i'll give it a try unless rejection. I want to study methods of applying LSH functions to feet in a specific area of digest values. Briefly i would like to control the results of hash functions such as "similar" inputs (similarity is defined by an lsh algorithm given a distance metric (i.e:hamming distance)) fall to a specific value. That is i want to control the output of lsh to result in a specific range of values.

-
 Is your question about existing Locality-sensitive hashing functions? Or, is it how to take a Cryptographical hash function, and use it to create a Locality-sensitive hash function? – poncho Dec 12 '11 at 15:59 @poncho The second one but also how i can control the output range. I.e: i want to have such outputs to a specific range of values – curious Dec 12 '11 at 16:33

If you're looking for a more efficient method of selecting hash inputs to constrict the hash output, well, they're not known to exist for cryptographical hash functions. In fact, if there was a large, easily computable subset of inputs that generated a biased hash output, that would imply a cryptographical weakness of the hash function. For example, to find a collision in the hash function, one could just take inputs from the subset, and hash those; if there was a bias in the hash outputs, one would find a collision with probability $0.5$ with a number of hashes strictly less than $1.17741 \cdot 2^{N/2}$ attempts (where $N$ is the size of the hash function); this is a weakness (although a small one if the bias is small, or it takes a large amount of computation to find elements in the subset).
@curious: Well, if you want similar points to hash to the same value with high probability, the obvious thing to do is to find a mapping function $map$ such that $P[map(p1)==map(p2)]>P1$, and then define $LSH(p) = Hash(map(p))$. However, I suspect that doesn't answer your question. What is the underlying problem you're trying to solve? – poncho Dec 12 '11 at 18:18