23 lines
343 B
Python
23 lines
343 B
Python
from lib import *
|
|
import hashlib
|
|
|
|
part_1 = True
|
|
|
|
if part_1:
|
|
digits = 5
|
|
else:
|
|
digits = 6
|
|
|
|
data = open(0).read().strip()
|
|
|
|
for i in range(10**9):
|
|
text = data + str(i)
|
|
md5_hash = hashlib.md5(text.encode()).hexdigest()
|
|
for c in md5_hash[:digits]:
|
|
if c != "0":
|
|
break
|
|
else:
|
|
print(i)
|
|
break
|
|
|