basic-mod2

This commit is contained in:
Maxime Vorwerk
2024-07-08 13:46:15 +02:00
parent 72d4417979
commit fe0e1b2411
2 changed files with 21 additions and 0 deletions

1
basic_mod2/message.txt Executable file
View File

@@ -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

20
basic_mod2/sol.py Executable file
View File

@@ -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)