Skip to content

Instantly share code, notes, and snippets.

@vesche
Created May 8, 2021 03:27
Show Gist options
  • Save vesche/1ee6bde2f3278d4925b5b8c7ca9cf966 to your computer and use it in GitHub Desktop.
Save vesche/1ee6bde2f3278d4925b5b8c7ca9cf966 to your computer and use it in GitHub Desktop.
simple xor two files script
#!/usr/bin/env python
import sys
def get_bytes(file_name):
with open(file_name, 'rb') as f:
return [byte for byte in f.read()]
out_bytes = list()
for a, b in zip(get_bytes(sys.argv[1]), get_bytes(sys.argv[2])):
out_bytes.append(a ^ b)
with open('out.raw', 'wb') as f:
f.write(bytearray(out_bytes))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment