How to XOR two arrays of bytes in Python

Viewed 217

I would like to perform an XOR between two arrays of bytes declared as:

a = bytes([0x01, 0x02, 0x04, 0x08])
b = bytes([0x55, 0x55, 0x55, 0x55])

I already tried a ^ b, but I've got the following error:

unsupported operand type(s) for ^: 'bytes' and 'bytes'

What is the most conscice way to perform the XOR operation?

0 Answers
Related