Created
September 10, 2017 19:34
-
-
Save faidamine/ee26a2d24ae48844822d4f7745c1a197 to your computer and use it in GitHub Desktop.
This file contains 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/python | |
#Faid Mohammed Amine | |
#Fb : piratuer | |
### [Crypto] ASIS Finals 2017 - Simple Crypto | |
def xor_str(x, y): | |
if len(x) > len(y): | |
return ''.join([chr(ord(z) ^ ord(p)) for (z, p) in zip(x[:len(y)], y)]) | |
else: | |
return ''.join([chr(ord(z) ^ ord(p)) for (z, p) in zip(x, y[:len(x)])]) | |
KEY = 'musZTXmxV58UdwiKt8Tp'.encode("hex") | |
encrypted = open("flag.enc", "r") | |
cnt = encrypted.read() | |
encrypted.close() | |
decrypted = xor_str(KEY * (len(cnt) // len(KEY) + 1), cnt).decode("hex") | |
output = open("flag", "w") | |
output.write(decrypted) | |
output.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment