Hashing function to speed up bucket search in LSH