Created
May 8, 2021 03:27
-
-
Save vesche/1ee6bde2f3278d4925b5b8c7ca9cf966 to your computer and use it in GitHub Desktop.
simple xor two files script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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