From fe0e1b2411ec13ef830ea6ea989ef19175f81b64 Mon Sep 17 00:00:00 2001 From: Maxime Vorwerk Date: Mon, 8 Jul 2024 13:46:15 +0200 Subject: [PATCH] basic-mod2 --- basic_mod2/message.txt | 1 + basic_mod2/sol.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 basic_mod2/message.txt create mode 100755 basic_mod2/sol.py diff --git a/basic_mod2/message.txt b/basic_mod2/message.txt new file mode 100755 index 0000000..fef97b1 --- /dev/null +++ b/basic_mod2/message.txt @@ -0,0 +1 @@ +432 331 192 108 180 50 231 188 105 51 364 168 344 195 297 342 292 198 448 62 236 342 63 \ No newline at end of file diff --git a/basic_mod2/sol.py b/basic_mod2/sol.py new file mode 100755 index 0000000..840c1ff --- /dev/null +++ b/basic_mod2/sol.py @@ -0,0 +1,20 @@ +#!/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 %= 41 + i = pow(i, -1, 41) + if i <= 26: + dec += chr(ord('a') + i - 1) + elif i <= 36: + dec += chr(ord('0') + i - 27) + elif i == 37: + dec += '_' + print(dec) +