Skip to content

Instantly share code, notes, and snippets.

@ykm11
Last active September 19, 2018 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ykm11/5e9986bc728421bb21030d3b3ca84c7f to your computer and use it in GitHub Desktop.
Save ykm11/5e9986bc728421bb21030d3b3ca84c7f to your computer and use it in GitHub Desktop.
test
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