Skip to content

Tuti

Cryptography is coupled with all kinds of equations very much!

Files given:

python
m_1, m_2 = flag[: l // 2], flag[l // 2:]

x, y = bytes_to_long(m_1), bytes_to_long(m_2)

k = '''
000bfdc32162934ad6a054b4b3db8578674e27a165113f8ed018cbe9112
4fbd63144ab6923d107eee2bc0712fcbdb50d96fdf04dd1ba1b69cb1efe
71af7ca08ddc7cc2d3dfb9080ae56861d952e8d5ec0ba0d3dfdf2d12764
'''.replace('\n', '')

assert((x**2 + 1)*(y**2 + 1) - 2*(x - y)*(x*y - 1) == 4*(int(k, 16) + x*y))

We are given the equation

and need to find integer solutions for . Since this is a quadratic in both , we can easily solve this quadratic for in terms of as

and this tells us that is a factor of . Factoring this in yafu, we can write a quick brute force script to print all possible flags.

Solution at solve.sage

Flag: CCTF{S1mPL3_4Nd_N!cE_Diophantine_EqUa7I0nS!}