Files
advent-of-code/src/holt59/aoc/2015/day4.py
Mikaël Capelle 377e501d34
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
Start fixing 2015 for new API.
2024-12-08 12:13:41 +01:00

21 lines
515 B
Python

import hashlib
import itertools
from typing import Any, Iterator
from ..base import BaseSolver
class Solver(BaseSolver):
def solve(self, input: str) -> Iterator[Any]:
it = iter(itertools.count(1))
yield next(
i
for i in it
if hashlib.md5(f"{input}{i}".encode()).hexdigest().startswith("00000")
)
yield next(
i
for i in it
if hashlib.md5(f"{input}{i}".encode()).hexdigest().startswith("000000")
)