Hamming distance & tests