Created
December 11, 2017 21:17
-
-
Save suzusime/20586b1ac752e06cf4b972d21f435b67 to your computer and use it in GitHub Desktop.
SECCON 2017 Online CTF - Vigenere3d
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
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz_{}" | |
#鍵を無理やり求めるやつ | |
def sa(s1,s2): | |
c = [] | |
for i in range(7): | |
i1 = s.find(s1[i]) | |
i2 = s.find(s2[i]) | |
c.append(i1-i2) | |
return c | |
#換字暗号の解読 | |
def dec(src,key): | |
c="" | |
keyall = key + key[::-1] | |
for i in range(len(src)): | |
c = c + s[(s.find(src[i]) + keyall[i%len(keyall)])%len(s)] | |
return c | |
key = sa("SECCON{","POR4dny") | |
ans = dec("POR4dnyTLHBfwbxAAZhe}}ocZR3Cxcftw9", key) | |
print(ans) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment