Compute Hamming Distance
You're missing a big simplification.  The hamming distance is the count of ones in x^y, so simply perform that xor and count the set bits.  There should be no need to convert to string.