Skip to content

Instantly share code, notes, and snippets.

@jrglee
Created November 26, 2012 14:21
Show Gist options
  • Save jrglee/4148460 to your computer and use it in GitHub Desktop.
Save jrglee/4148460 to your computer and use it in GitHub Desktop.
Script to xor hex strings
#!/usr/bin/env python
import sys
a = sys.argv[1].decode("hex")
b = sys.argv[2].decode("hex")
def tohex(v):
return chr(v).encode("hex")
out = [tohex(ord(x) ^ ord(y)) for (x, y) in zip(a, b)]
print " ".join(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment