We're basically a simple program that does this:
/dev/urandom
into a variable called buf
buf
into a value from 32 to 126 inclusive.sub_13C7
over a chunk of 8 bytes from buf
eight times (ie buf[0:8]
, buf[8:16]
, etc.sub_13C7
is a double that's stored into the v6
array as 128 bytes* We are given the output of `v6`
buf
array correctly we get the flag (after the encoding loop from the second bullet point)According to https://en.wikipedia.org/wiki/Fourier_series#Table_of_common_Fourier_series, this formula is very similar to the formula for a Fourier Series
The above is a random integer from 0 to 2 inclusive, it can be thought of as random noise added to the fourier series.
In exponential form (which helps when we're going to calculate the DFT)
Equating the variables from the 2 equations we have
The DFT (Discrete Fourier Transform) will give us a set of coeffcients . The random noise is small and won't affect the coeffcients.
We can use these coefficients to define a new Fourier Series (https://en.wikipedia.org/wiki/Discrete_Fourier_transform#math_Eq.2)
Note here, not to be confused in the above series where we defined .
sub_13C7
functionsub_13C7
.numpy
to calculate the DFT, which gives us complex values, in order to get the amplitude and phase (which gives us and ), we have to convert from complex to polar notation. This is trivial with np.abs
and np.angle
.flag{R34l1y_3aSy_R3ve7s3_W31C000m3_T0_0CTF/TCTF_2022_G000d_Luck}