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

21 lines
376 B
Python

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[:6] != "000000":
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)