hamming alg implement