29 lines
785 B
Python
29 lines
785 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 "-" in sol:
|
|
if hashlib.md5(f"{door_id}{i}".encode()).hexdigest().startswith("00000"):
|
|
temp = hashlib.md5(f"{door_id}{i}".encode()).hexdigest()
|
|
if temp[5] in "01234567" and sol[int(temp[5])] == "-":
|
|
sol[int(temp[5])] = temp[6]
|
|
print(i, temp, temp[5], temp[6])
|
|
i += 1
|
|
|
|
print(f"Part 2 - SolutionPassword: {"".join(sol)}")
|
|
print(f'Runtime: {time()-start_time:.4f} s') |