Last active
September 19, 2018 11:46
-
-
Save ykm11/5e9986bc728421bb21030d3b3ca84c7f to your computer and use it in GitHub Desktop.
test
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
import zlib | |
import string | |
SECRET = "mugimugi_suko" | |
def check(pad : str): | |
data = SECRET + pad*20 | |
comp_data = zlib.compress(data.encode()) | |
return len(comp_data) | |
chars = string.ascii_lowercase + "_" | |
m = "o" | |
for _ in range(12): | |
candidate = [] | |
for ch in chars: | |
length = check(ch + m) | |
print(ch+m, length) | |
candidate.append((ch, length)) | |
candidate.sort(key=lambda x:x[1]) | |
if candidate[0][0] == m[0]: | |
m = candidate[1][0] + m | |
else: | |
m = candidate[0][0] + m | |
print(candidate[:5]) | |
print(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment