φ : x 7 → (ψ 7 → ψ(x))
Files given:
This problem is quite straight forward, we have two equations and two unknowns:
m1 = bytes_to_long(FLAG[:n//2])
m2 = bytes_to_long(FLAG[n//2:])
p = getPrime(1024)
e = 0x10001
m1 = pow(m1, e, p)
m2 = pow(m2, e, p)
f = (13 * m2 ** 2 + m1 * m2 + 5 * m1) % p
g = (7 * m2 + m1 ** 2) % p
print(f'p = {p}')
print(f'f = {f}')
print(f'g = {g}')
which can easily be solved using Mathematica:
Module[{p=...,f=...,g=...,e=65537,m,d},
m={m1,m2}/.Solve[{13m2^2+m1 m2+5m1==f,7m2+m1^2==g},{m1,m2},Modulus->p][[1]];
d=ModularInverse[e,p-1];
StringJoin@FromCharacterCode@IntegerDigits[PowerMod[m,d,p],256]
]
Solution at solve.m
Flag:
grey{Equations_are_beautify_arent_they_Gb9kkmVPHDUNpJCU}