Skip to content

Latest commit

 

History

History

Magic-I

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Aero CTF 2020 : Magic I

category : crypto

points : 205

write-up

XOR encryption

key is the sum of one column of a magic square of unknown dimension.

We are given the value of key % x^2, where x is the dimension.

After some computation, we got key = x^2 * (x^2 - 1) / (2x) = (x^3 - x) / 2

Assume x is even, and x = 2y, then key = 4y^3 - y, and key % x^2 = key % 4y^2 = 4y^2 - y.
Plug in the value and find out that there is no integer solution.

Assume x is odd, and x = 2y + 1, then key = 4y^3 + 6y^2 + 2y, and key % x^2 = 2y^2 + y.
Then use Wolfram to find the answer, which is y = 51985830717457237488973954964904090788909 and then we can decrypt the flag.

other write-ups and resources