Return `data` xor-ed with `key`.
(data: ByteString, key: str)
| 3483 | |
| 3484 | |
| 3485 | def xor(data: ByteString, key: str) -> bytearray: |
| 3486 | """Return `data` xor-ed with `key`.""" |
| 3487 | key_raw = binascii.unhexlify(key.lstrip("0x")) |
| 3488 | return bytearray(x ^ y for x, y in zip(data, itertools.cycle(key_raw))) |
| 3489 | |
| 3490 | |
| 3491 | def is_hex(pattern: str) -> bool: |