From 7cd45f9bbef4c12cc12a659eb3d1105073a7a385 Mon Sep 17 00:00:00 2001 From: Maxime Vorwerk Date: Mon, 8 Jul 2024 14:00:31 +0200 Subject: [PATCH] basic-mod1 --- basic_mod1/message.txt | 1 + basic_mod1/sol.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 basic_mod1/message.txt create mode 100755 basic_mod1/sol.py diff --git a/basic_mod1/message.txt b/basic_mod1/message.txt new file mode 100755 index 0000000..940caf6 --- /dev/null +++ b/basic_mod1/message.txt @@ -0,0 +1 @@ +128 322 353 235 336 73 198 332 202 285 57 87 262 221 218 405 335 101 256 227 112 140 \ No newline at end of file diff --git a/basic_mod1/sol.py b/basic_mod1/sol.py new file mode 100755 index 0000000..f086db4 --- /dev/null +++ b/basic_mod1/sol.py @@ -0,0 +1,19 @@ +#!/home/maxime/.pyvenv/bin/python3 + +with open("message.txt", 'r') as f: + text = f.read().strip() + + cipher = text.split(' ') + + dec = "" + for i in cipher: + i = int(i) + i %= 37 + if i <= 25: + dec += chr(ord('a') + i) + elif i <= 35: + dec += chr(ord('0') + i - 26) + elif i == 36: + dec += '_' + print(dec) +