PicoCTF 2022 - basic-mod2

From: picoCTF 2022


Challenge

Points - 100
Category - Cryptography

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})

Message

The message contains a series of numbers

104 290 356 313 262 337 354 229 146 297 118 373 221 359 338 321 288 79 214 277 131 190 377 

We will need to use a modulo formula to get our numbers down to the 1-37 range. Then assign the corresponding characters to the resulting numbers.

Methodology

Python script

nums = '104 290 356 313 262 337 354 229 146 297 118 373 221 359 338 321 288 79 214 277 131 190 377'.split()

a=[]
for num in nums:
    a +=[pow(int(num)%41,-1,41)]

b=''
for num in a:
    if num<=26:
        b+=chr(num+64)
    elif num == 37:
        b+='_'
    else:
        b+=str(num-27)

print('picoCTF{'+ b +'}')

Flag

picoCTF{1#####################9}


Tags: CTF  picoCTF  Cryptography 

Written on March 28, 2022