From 45277d41f54230107285f7be9315c1c620450f38 Mon Sep 17 00:00:00 2001 From: Samuel Ortion Date: Wed, 27 Nov 2024 18:00:13 +0100 Subject: [PATCH] day4: part 1 and 2 with python --- 2015/days/04/md5.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 2015/days/04/md5.py diff --git a/2015/days/04/md5.py b/2015/days/04/md5.py new file mode 100644 index 0000000..2454d9f --- /dev/null +++ b/2015/days/04/md5.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import hashlib + +key = "yzbqklnj" + +i = 0 +while True: + result = hashlib.md5(f'{key}{i}'.encode()) + if result.hexdigest().startswith("0"*6): + print(i) + break + i += 1