Skip to content

Instantly share code, notes, and snippets.

@0xa13d
Last active August 24, 2022 15:11
Show Gist options
  • Save 0xa13d/37bb327e904d14f0de757213dd331d8f to your computer and use it in GitHub Desktop.
Save 0xa13d/37bb327e904d14f0de757213dd331d8f to your computer and use it in GitHub Desktop.
Simple xor function for python
from itertools import cycle
def xor(key: bytes, data: bytes) -> bytes:
return bytes(a ^ b for a, b in zip(data, cycle(key)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment