1
0
Fork 0
adventofcode/2015/4/coin.py

14 lines
317 B
Python
Executable File

#!/usr/bin/env python3
import sys, hashlib
key = sys.stdin.readline().strip()
def findmd5(n):
result = " "
i = 0
while result[:n] != "0" * n:
i = i + 1
result = hashlib.md5((key + str(i)).encode('utf-8')).hexdigest()
return i
print(findmd5(5), findmd5(6))