I need a functionality to xor all possible single bytes with a bytestream. I have that function:
def byteChallenge(text):
for i in range(0xff):
res = ([bytes([i]) ^ bytes([a]) for a in text])
print(res)
where text = bytes.fromhex(hexstring)
and I am getting an unreasonable error:
TypeError: unsupported operand type(s) for ^: 'bytes' and 'bytes'
both bytes[i]
and bytes[a]
are of the same bytes type.
How i fix that?