summary refs log tree commit diff stats
path: root/day4.py
diff options
context:
space:
mode:
Diffstat (limited to 'day4.py')
-rw-r--r--day4.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/day4.py b/day4.py
new file mode 100644
index 0000000..ab2bb88
--- /dev/null
+++ b/day4.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+from hashlib import md5
+
+secret_key = r'iwrupvqb'
+
+num = 1
+while True:
+    hashed = md5(str(secret_key + str(num)).encode('utf-8')).hexdigest()
+    if hashed[:5] == '00000':
+        print(num)
+        break
+    num += 1
+
+num = 1
+while True:
+    hashed = md5(str(secret_key + str(num)).encode('utf-8')).hexdigest()
+    if hashed[:6] == '000000':
+        print(num)
+        break
+    num += 1