/cipher.py Secret
Created
March 6, 2019 14:57
CSAW XOR
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
import hashlib | |
import sys | |
def xor(s1,s2): | |
return ''.join(chr(ord(a) ^ ord(b)) for a,b in zip(s1,s2)) | |
def repeat(s, l): | |
return (s*(int(l/len(s))+1))[:l] | |
key = sys.argv[1] | |
plaintext = sys.argv[2] + key | |
plaintext += hashlib.md5(plaintext).hexdigest() | |
cipher = xor(plaintext, repeat(key, len(plaintext))) | |
print cipher.encode('hex') |
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
274c10121a0100495b502d551c557f0b0833585d1b27030b5228040d3753490a1c025415051525455118001911534a0052560a14594f0b1e490a010c4514411e070014615a181b02521b580305170002074b0a1a4c414d1f1d171d00151b1d0f480e491e0249010c150050115c505850434203421354424c1150430b5e094d144957080d4444254643 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment