Cryptography Challenges Walkthrough: From Classical Ciphers to RSA and Obfuscated Python

Base64 Decoding:

The challange name explicitly indicates Base64 encoding. After downloading the provided text file, decoding its contents using any standard Base64 decoder yields the flag directly.

The ciphertext is:

The sequence:

The ciphertext is:

The input consists of - and . symbols grouped by slashes — a classic Morse representation. However, decoding directly yields gibberish. Observing the length and structure, the decoded Morse output is actually a Baconian cipher string composed of two distinct characters (e.g., A/B or dot/dash pairs). Converting the Morse-decoded string in to binary (A=0, B=1), then applying Baconian decoding with a 5-bit alphabet yields the final flag.

The initial string ends in ==, indicating Base64. Decoding produces HTML numeric character references (Lz...). Converting these decimal codes to ASCII yields another Base64 string. A second Base64 decode reveals slash-delimited decimal ASCII values, which — when converted to characters — spell out the flag’s inner content.

The numeric string:

Given primes p = 473398607161, q = 4511491, and public exponent e = 17, compute:

  • n = p * q
  • φ(n) = (p−1) * (q−1)
  • d ≡ e⁻¹ mod φ(n) using the extended Euclidean algorithm

The modular inverse of e modulo φ(n) yields the private key d.

A .pyc file is decompiled to reveal three nested encoding functions: XOR-then-add, add-then-XOR, and Base32. To reverse:

  1. Base32-decode the final string
  2. Apply inverse of encode2: subtract 36, then XOR with 36
  3. Apply inverse of encode1: subtract 25, then XOR with 36

Executing this chain recovers the original flag string.

Tags: Base64 caesar-cipher morse-code rail-fence baconian-cipher

Posted on Tue, 11 Aug 2026 16:32:20 +0000 by snowgirl