Rating: 3.0
I started by running test values through the algorithm. Specifically, flag{
turned out to be 65639, 65645, 65632, 65638, 65658
. This is how the flag output starts so
once again we can create a key using the same method as in aptenodytes-forsteri.
This time we have to use the entire ascii character set though.
The output was much longer than the first challenge so I took the time to read it from a file and decode the flag using the created lookup table.
Here's the script to do so:
import time
from Crypto.Util.number import *
import linecache
keyText = "abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()-=_+ABCDEFGHIJKLMNOPQRSTUVWXYZ[]{}`~'\"\\ /?.>,<"
key = {}
def encrypt():
p = getPrime(1024)
q = getPrime(1024)
e = 2**16+1
n=p*q
ct=[]
i = 0
for ch in keyText:
ct.append((ord(ch)^e)%n)
key[ch] = str(ct[i])
i += 1
encrypt()
plainText = list(key.keys())
cypherText = list(key.values())
data = linecache.getline('hoazin.txt', 4)
flag = data.split(', ')
flag[-1] = flag[-1].rstrip()
flagText = ""
for ct in flag:
pos = cypherText.index(ct)
flagText += plainText[pos]
print(flagText)
flag{tH1s_ic3_cr34m_i5_So_FroZ3n_i"M_pr3tTy_Sure_iT's_4ctua1ly_b3nDinG_mY_5p0On}