From cb37874d42b54a1063461e7c4db7e9346d6807cc Mon Sep 17 00:00:00 2001 From: rick Date: Sat, 6 Mar 2021 19:26:42 +0100 Subject: [PATCH] Ajout des 2 parties --- jour04/run.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 jour04/run.py diff --git a/jour04/run.py b/jour04/run.py new file mode 100644 index 0000000..9a3d411 --- /dev/null +++ b/jour04/run.py @@ -0,0 +1,29 @@ +import hashlib + +myInput = "iwrupvqb" +i = 1 +find = False +md = None + +print("Traitement de la partie 1…") + +while not find: + md = hashlib.md5((myInput + str(i)).encode("utf-8")) + if md.hexdigest()[0:5] == "00000": + find = True; + else: + i += 1 + +print(i) + +print("Traitement de la partie 2…") + +find = False +while not find: + md = hashlib.md5((myInput + str(i)).encode("utf-8")) + if md.hexdigest()[0:6] == "000000": + find = True; + else: + i += 1 + +print(i)