advent-of-code/2015/04/part01.py

21 lines
375 B
Python
Raw Normal View History

2021-12-01 11:07:21 +01:00
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)