substitution0

Published: July 20, 2023Updated: December 9, 2025

Description

A monoalphabetic cipher includes its key at the top of the file. Once you map each ciphertext letter back through the key, the hidden flag drops out immediately.

Open the file; its first line contains the substitution key (e.g., ZGSOCXPQUYHMILERVTBWNAFJDK).

Extract the ciphertext (the characters between picoCTF{ and the closing brace) and run a simple script to map each letter back to the plain alphabet.

python3 - <<'PY' alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" key = "ZGSOCXPQUYHMILERVTBWNAFJDK" enc = "5NG5717N710L_3A0MN710L_357GX9XX" flag = "picoCTF{" + ''.join(alphabet[key.index(c)] if c.isalpha() else c for c in enc) + "}" print(flag) PY

Solution

  1. Step 1Derive the mapping
    Because the key lists ciphertext letters in order of plaintext A–Z, you simply look up each encrypted character’s index in the key and pull the corresponding letter from the alphabet.
  2. Step 2Assemble the flag
    Handle underscores/digits literally, wrap the decoded string with picoCTF{…}, and you have the final flag.

Flag

picoCTF{5UB5717U710N_3V0LU710N_357...}

This challenge is intentionally straightforward, so no frequency analysis is required once the key is provided.