You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
375 B
Python
21 lines
375 B
Python
3 years ago
|
from hashlib import md5
|
||
|
|
||
|
with open("input") as f:
|
||
|
puzzle_input = f.read().strip()
|
||
|
|
||
|
# puzzle_input = "abcdef"
|
||
|
# puzzle_input = "pqrstuv"
|
||
|
|
||
|
solution = 0
|
||
|
|
||
|
cur_hash = ""
|
||
|
|
||
|
while cur_hash[:5] != "00000":
|
||
|
solution += 1
|
||
|
md5_input = puzzle_input + str(solution)
|
||
|
cur_hash = md5(md5_input.encode("utf-8")).hexdigest()
|
||
|
|
||
|
print(cur_hash)
|
||
|
print(puzzle_input)
|
||
|
print(solution)
|