Sora
Description: A simple encryption function
Question
This obnoxious kid with spiky hair keeps telling me his key can open all doors.
Can you generate a key to open this program before he does?
Writeup
On the top is the main function. It’s a pretty simple program, encrypt
runs on the main program, and then if the result of encrypt is 0, probably to indicate success, the flag is printed, otherwise it’s not.
Let’s have a peek into encrypt
.
Here, we can see that stuff is done to the input (namely, each character in input is multipled by 8, then 19 is added to it, which is then modded with 61, with 65 finally being added to it), and it is compared with the corresponding element in secret
.
From the program, we can see that secret
is a string with the value 'aQLpavpKQcCVpfcg'
. I made a python script that basically iterates over all letters to get the required input.
ciphertext = "aQLpavpKQcCVpfcg"
for i in ciphertext:
for j in range(ord('A'),ord('z'):
if (j*8 + 0x13) % 0x3d + 0x41 == ord(i):
print(chr(j),end='')
break
I know the code isn’t the cleanest, but it’s easy and gets the job done so ¯\_(ツ)_/¯
You get the pasword, which is "try_to_break_meG"