Skip to content

Instantly share code, notes, and snippets.

@CrBoy
Created April 26, 2013 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CrBoy/5468403 to your computer and use it in GitHub Desktop.
Save CrBoy/5468403 to your computer and use it in GitHub Desktop.
簡單的 xor 程式
#!/usr/bin/python
import sys
infile = sys.argv[1]
outfile = sys.argv[2]
key = bytearray(sys.argv[3].decode('hex'))
b = bytearray(open(infile, 'rb').read())
i = 0
while i < len(b):
for j in range(len(key)):
b[i] ^= key[j]
i += 1
open(outfile, 'wb').write(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment