MySQL XOR produces incorrect results
The problem is that some long string failed to fit into a BIGINT UNSIGNED.

On the other hand, consider avoiding going through decimal:

mysql&gt; SELECT HEX(0x9000084e703720f9 ^ 0x801A93A5A18A773F)
+----------------------------------------------+
| HEX(0x9000084e703720f9 ^ 0x801A93A5A18A773F) |
+----------------------------------------------+
| 101A9BEBD1BD57C6                             |
+----------------------------------------------+

mysql&gt; SELECT (0x9000084e703720f9 ^ 0x801A93A5A18A773F);
+-------------------------------------------+
| (0x9000084e703720f9 ^ 0x801A93A5A18A773F) |
+-------------------------------------------+
|                       1160411291139790790 |
+-------------------------------------------+


8.0 can handle bit operations longer than 64 bits, but perhaps not in this context.