0
0
Fork 0
AdventOfCode/day_4/solution.py
2020-12-06 20:33:17 -07:00

19 lines
No EOL
403 B
Python

import hashlib
passkey = input("Input passkey here: ")
def find_suffix(passkey, leading_zeroes):
hexkey = ""
suffix = 0
while hexkey[:leading_zeroes] != "0" * leading_zeroes:
suffix += 1
hashkey = hashlib.md5(f"{passkey}{suffix}".encode())
hexkey = hashkey.hexdigest()
return suffix
print(f"Part 1 Suffix = {find_suffix(passkey, 5)}")
print(f"Part 2 Suffix = {find_suffix(passkey, 6)}")