Logo
Waseem Akram
HomeAboutResumeBlogVU Study MaterialStoreContact
W
Waseem Akram

Cybersecurity expert, web developer, and educator dedicated to sharing knowledge and empowering others in the tech world.

LinkedInGitHubFacebookInstagramYouTubeWhatsApp

Quick Links

  • Home
  • About
  • Services
  • Blog
  • VU Study Material
  • Contact
  • Resume
  • Store
  • Support Me

Contact Info

  • hello@hackerwasii.com
  • +92 313 711 9351
  • Okara, Punjab Pakistan

Newsletter

Subscribe to receive updates on new content, tutorials, and cybersecurity tips.

I respect your privacy. Unsubscribe at any time.

Now Playingon Spotify
© 2025 Waseem Akram. All rights reserved.Made with 🩵
Privacy PolicyTerms of ServiceRefund PolicyCookies Policy
DecryptionTryHackMe Walkthrough

Cipher's Secret Message – TryHackMe Walkthrough

W
Waseem AkramVerified account
Researcher, Pentester, Dev
2025-07-06
3 min read
1,000 views
Featured image for Cipher's Secret Message – TryHackMe Walkthrough

🧩 TryHackMe: Cipher's Secret Message – Detailed Walkthrough

🗂️ Room Overview

  • Room Name: Cipher's Secret Message
  • Category: Crypto
  • Difficulty: Easy
  • Objective: Decrypt a secret message encrypted with a shifting Caesar cipher and retrieve the flag.

🧠 Challenge Prompt

We are given:

  • An encrypted message:

a_up4qr_kaiaf0_bujktaz_qm_su4ux_cpbq_ETZ_rhrudm

The encryption logic:

Advertisement

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))
  • Instruction: Wrap the decoded message in the flag format THM{}.

🔍 Step 1: Understand the Algorithm

The function enc() describes a modified Caesar cipher:

  • It loops through each character in the message (enumerate gives both index i and character c).
  • If the character is alphabetical:
    • Determine the base ('A' for uppercase, 'a' for lowercase).
    • Add the index i to the alphabetical offset of the character.
    • Take modulo 26 to wrap around the alphabet.
    • Convert back to a character.
  • If it's not a letter (like a digit or underscore), it remains unchanged.

📌 Implication:

This cipher shifts each letter forward by its index position.


🔁 Step 2: Reversing the Cipher (Decryption Logic)

To decode:

Advertisement

  • For every character at index i, subtract i from its position in the alphabet.
  • Use modulo 26 to handle negative wraparound.
  • Preserve non-alphabetic characters.

✅ Decryption Function in Python:

def decrypt(ciphertext):
    result = []
    for i, c in enumerate(ciphertext):
        if c.isalpha():
            base = ord('A') if c.isupper() else ord('a')
            decoded_char = chr((ord(c) - base - i) % 26 + base)
            result.append(decoded_char)
        else:
            result.append(c)
    return ''.join(result)

🧪 Step 3: Run the Decryption

🔐 Input:

a_up4qr_kaiaf0_bujktaz_qm_su4ux_cpbq_ETZ_rhrudm

🧾 Output:

a_sm4ll_crypt0_message_to_st4rt_with_THM_cracks

🏁 Step 4: Format the Flag

As per the instructions, wrap the result in THM{}:

🎯 Final Flag:

THM{a_sm4ll_crypt0_********************************}

✅ Summary

Aspect Value
Cipher Type Caesar Variant (Index-based shifting)
Approach Decryption by reversing the positional shift
Tools Used Python
Skills Practiced Cryptographic logic, Python iteration, ASCII math

This walkthrough demonstrates how analyzing Python logic in challenges can help decode obfuscated or encrypted messages. Happy hacking!

Advertisement

DecryptionTryHackMe Walkthrough
W

Waseem AkramVerified account

Researcher, Pentester, Dev

Cybersecurity expert and educator with a passion for sharing knowledge and helping others stay safe online.

Comments

Comments are currently disabled. Please share your thoughts on social media.

Related Articles

Volatility Essentials Walkthrough – Complete Memory Forensics Guide with Volatility 3
VolatilityMemory Forensics+3

Volatility Essentials Walkthrough – Complete Memory Forensics Guide with Volatility 3

Master memory forensics with this hands-on Volatility Essentials walkthrough from TryHackMe. Learn how to detect malware, analyze memory dumps, automate analysis, and hunt rootkits using Volatility 3.

2025-06-254 min read
Roundcube RCE Vulnerability Explained [CVE-2025-49113] - TryHackMe Walkthrough
CVE-2025-49113Roundcube+3

Roundcube RCE Vulnerability Explained [CVE-2025-49113] - TryHackMe Walkthrough

Explore the CVE-2025-49113 vulnerability in Roundcube Webmail, learn how to exploit it manually and with automation, and follow a TryHackMe walkthrough.

2025-06-215 min read
🚀 Getting Started with Bash Scripting: Level Up Your Automation Game
ProgrammingLinux+2

🚀 Getting Started with Bash Scripting: Level Up Your Automation Game

Yo, stop typing commands like a noob! Learn how to write and run your first Bash script with this step-by-step guide. Automate your life and boost productivity like a pro!

2025-05-044 min read