hamming distance for different keysizes