Cipher’s Secret Message (Writeup)
A ciphered secret message is recovered from an old system; can we decode it?
Step 1 : Note down given information.
The message — a_up4qr_kaiaf0_bujktaz_qm_su4ux_cpbq_ETZ_rhrudm
Encryption algorithm —
from secret import FLAG
def enc(plaintext):
return "".join(
chr((ord(c) - (base := ord('A') if c.isupper() else ord('a')) + i) % 26 + base)
if c.isalpha() else c
for i, c in enumerate(plaintext)
)
with open("message.txt", "w") as f:
f.write(enc(FLAG))
Step 2 : Reconnaissance.
Get Player’s stories in your inbox
Join Medium for free to get updates from this writer.
The next thing I did after noting down all the information we had available was search the code and find which cipher they used (You can use an AI tool for this) by doing so we find that this is a concise but elegant implementation of a Progressive Caesar Cipher in Python.
Step 3 : Decode
Now how do we decode this, you can simply ask a search engine or ai tool to decode it for you, however there's a chance that it turns out to be wrong most of the time and would take many tries to get the right flag.
Instead, you can run this code on PyCharm:
def dec(ciphertext):
return "".join(
chr((ord(c) - (base := ord('A') if c.isupper() else ord('a')) - i) % 26 + base)
if c.isalpha() else c
for i, c in enumerate(ciphertext)
)
encrypted = "a_up4qr_kaiaf0_bujktaz_qm_su4ux_cpbq_ETZ_rhrudm"
decrypted = dec(encrypted)
print("THM{" + decrypted + "}")I would say that running this code yourself is a better option. You can TRY the first option if you don't have tools like PyCharm to run the code but most of time you will get the wrong flag.
You can check this challenge out and solve it yourself using this link: TryHackMe | Cipher’s Secret Message
Thats it for this challenge. Hope to see you in the next one.
Signing of,
Player.



