def hash_distance(sim_hash_one, sim_hash_two):
    """
    Calculates hamming distance between two sim hashes.
    :param sim_hash_one: long - sim hash
    :param sim_hash_two: long - sim hash
    :return: (int) returns hamming distance.
    """
    f = 128
    x = (sim_hash_one ^ sim_hash_two) & ((1 << f) - 1)
    ans = 0
    while x:
        ans += 1
        x &= x - 1
    return ans