Created
December 29, 2016 18:02
-
-
Save astamatto/e6f00c5920b14d96dc2d1019194d56aa 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
from hashlib import md5 | |
inp = "wtnhxymk" | |
#inp = "abc" | |
def parte1(): | |
i, index, psw = 0, 0, [] | |
while i < 8: | |
md = md5((inp + str(index)).encode("utf-8")).hexdigest() | |
if md.startswith("00000"): | |
psw.append(md[5]) | |
i += 1 | |
index += 1 | |
print("".join(psw)) | |
def parte2(): | |
i, index, psw = 0, 0, ['_']*8 | |
while i < 8: | |
md = md5((inp + str(index)).encode("ascii")).hexdigest() | |
if md.startswith("00000"): | |
pos, v = int(md[5], 16), md[6] | |
if -1 < pos < 8 and psw[pos]=='_': | |
psw[pos] = v | |
i += 1 | |
index += 1 | |
print("".join(psw)) | |
parte2() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment