s1 = '0x54'
s2 = '0xa1'
How do we XOR s1 and s2 to get '0xf5' as output?
s1 = '0x54' s2 = '0xa1' def XOR(s1, s2): return "0x" + "{:x}".format(int(s1[2:], 16)^int(s2[2:], 16)) XOR(s1,s2)
That should work