basic-mod2
03/29/2022
By: draNx
Tags: crypto PicoCTF-2022Problem Description:
A new modular challenge! Download the message here. Take each number mod 41 and find the modular inverse for the result. Then map to the following character set: 1-26 are the alphabet, 27-36 are the decimal digits, and 37 is an underscore. Wrap your decrypted message in the picoCTF flag format (i.e. picoCTF{decrypted_message})
Hints:
Reveal Hints
Do you know what the modular inverse is? | The inverse modulo z of x is the number, y that when multiplied by x is 1 modulo z | It's recommended to use a tool to find the modular inversesBasic-Mod2
Fairly similar to the first challenge, just with an extra step
message = "104 85 69 354 344 50 149 65 187 420 77 127 385 318 133 72 206 236 206 83 342 206 370"
alphabet = "abcdefghijklmnopqrstuvwxyz0123456789_"
result = ""
for num in message.split():
start = int(num) % 41
result += alphabet[pow(start, -1, 41) - 1]
print(result)
Flag: picoCTF{1nv3r53ly_h4rd_(unique code)}