Files
AdventOfCode2016/05/05-1.py
2024-12-19 21:44:29 +01:00

28 lines
642 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
door_id = "abbhdwsy" #real
#door_id = "abc" #example
from time import time
import hashlib
start_time = time()
if __name__ == "__main__":
#result = hashlib.md5("abc3231929".encode())
#print(result.hexdigest())
sol = ""
i = 0
while len(sol) <8:
if hashlib.md5(f"{door_id}{i}".encode()).hexdigest().startswith("00000"):
temp = hashlib.md5(f"{door_id}{i}".encode()).hexdigest()
print(i, temp, temp[5])
sol += temp[5]
i += 1
print(f"Part 1 - SolutionPassword: {sol}")
print(f'Runtime: {time()-start_time:.4f} s')