2015/day04.py

20 lines
327 B
Python

import hashlib
def main():
INPUT = b"yzbqklnj"
DIFFICULTY = 5
i = 0
END = "0" * DIFFICULTY
while True:
message = INPUT + str(i).encode("ascii")
digest = hashlib.md5(message).hexdigest()
if digest[:DIFFICULTY] == END:
print(i)
break
i += 1
main()