0
0
Fork 0

Add code for 2015 advent that I did historically.

This commit is contained in:
Oliver-Akins 2020-12-06 20:33:17 -07:00
parent 13968ed94e
commit 9e9e556c73
25 changed files with 598 additions and 0 deletions

19
day_4/solution.py Normal file
View file

@ -0,0 +1,19 @@
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)}")