17 lines
371 B
Python
17 lines
371 B
Python
file = [i.rstrip() for i in open("input").readlines()]
|
|
|
|
import hashlib
|
|
|
|
key = file[0]
|
|
i = 1
|
|
while True:
|
|
output = hashlib.md5("{}{}".format(key, str(i)).encode())
|
|
digest = output.hexdigest()
|
|
# change from [0:6] to [0:5] for sol 1
|
|
if len(set(digest[0:6])) == 1 and digest[0] == '0':
|
|
# we've 'mined' a coin
|
|
print(i)
|
|
break
|
|
|
|
i += 1
|