implemented hamming function; to test