Description
A list of integers is provided along with instructions to take each number mod 37 and map it onto a custom alphabet (A–Z, digits, underscore). Implement the mapping to decode the hidden flag.
Setup
Grab the message file and convert the space-separated numbers into a Python list.
Apply modulo 37 to each entry, then treat 0–25 as A–Z, 26–35 as digits, and 36 as an underscore.
Concatenate the recovered characters and wrap them with `picoCTF{}`.
wget https://artifacts.picoctf.net/c/128/message.txt
cat message.txt
cat message.txt | sed -e "s/^/[/" | sed 's/ *$//' | sed -e "s/$/]/" | sed -e "s/ /, /g"
python3 mod1.py
Solution
- Step 1Normalize the inputTransform the message into a Python array (a quick sed oneliner wraps it in brackets and adds commas). This makes iterating and applying modulo arithmetic trivial.
- Step 2Map each valueFor every number `n`, compute `n % 37` to keep it inside the alphabet range, then index into the character set `ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_`.
- Step 3Assemble the flagBuild a string starting with `picoCTF{`, append each decoded character, and close with `}` to produce the final answer.
Flag
picoCTF{R0UND_N_R0UND_B6B...}
Simple modular arithmetic plus a custom alphabet turns the numeric sequence back into the plaintext flag.