basic-mod2 - PicoCTF2022

100 points

AUTHOR: WILL HONG

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

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

Answer

import string

alphabet=' '+string.ascii_lowercase+string.digits+'_'
#print(alphabet[37])

text='104 290 356 313 262 337 354 229 146 297 118 373 221 359 338 321 288 79 214 277 131 190 377'
tab_text=text.split()
#print(tab_text)
for digit in tab_text:
    digit=int(digit)%41
    for i in range(41):
      if (digit*i)%41==1: print(alphabet[i], end="")
    
#print(alphabet)

Po zastosowaniu takiego kodu otrzymałem 1nv3r53ly_h4rd_8a05d939. Co było poprawną odpowiedzią :)

picoCTF{1nv3r53ly_h4rd_8a05d939}