How to bitwise XOR of hex numbers in Python?

You can get the XOR of any type of numbers using the ^ operator. Specifically for hex numbers, you can use:

a = 0x12ef
b = 0xabcd
print(hex(a ^ b))

This will give the output:


The 0x at the beginning of the numbers implies that the number is in hex representation. You can use the ^ operator for other integer representations as well.