28 lines
642 B
Python
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') |