finish hamming_dist function