I am trying to compute the hamming distance between two hex strings. First, the strings are converted from base 16 to base 10, then they are xor'd and the bits are counted:
SELECT (CONV('b4124b0d195b2507', 16, 10)) ^ (CONV('eae26aebf1f139f9', 16, 10));
This results in 0.
Independently running
SELECT (CONV('b4124b0d195b2507', 16, 10));
and
SELECT (CONV('eae26aebf1f139f9', 16, 10));
give me the answers I would expect (12975515996039881991 and 16925207911220722169).
Where is the flaw in my logic?
is what you want
The conv as per the docs
http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_conv
You need to convert back to numbers to xor