Skip to content

Commit

Permalink
2015 day 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacerulerwill committed Jan 7, 2025
1 parent a61ebcc commit f32fa53
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions puzzles/Y2015/D4/p1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import hashlib
from typing import Any


def puzzle(input: str) -> Any:
input = input.strip()
i = 0
while True:
hash_hex_string = hashlib.md5((input + str(i)).encode()).hexdigest()
if hash_hex_string[:5] == "00000":
return i
i += 1
12 changes: 12 additions & 0 deletions puzzles/Y2015/D4/p2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import hashlib
from typing import Any


def puzzle(input: str) -> Any:
input = input.strip()
i = 0
while True:
hash_hex_string = hashlib.md5((input + str(i)).encode()).hexdigest()
if hash_hex_string[:6] == "000000":
return i
i += 1

0 comments on commit f32fa53

Please sign in to comment.