Skip to content

Instantly share code, notes, and snippets.

@toby-bro
Created October 5, 2024 20:43
Show Gist options
  • Save toby-bro/b9d027da3d82589493c9e1b085335ce6 to your computer and use it in GitHub Desktop.
Save toby-bro/b9d027da3d82589493c9e1b085335ce6 to your computer and use it in GitHub Desktop.
FCSC2024 writeup fftea

FFTea

The code in craft_signal.py applies the inverse Fourier Transform on the bytes it reads from the flag.txt. So we only need to apply the Fourier Transform on the fftea data. This code thus recovers the flag :

import numpy as np

# Load the data from the "fftea" file
data = np.fromfile("challenge", dtype = np.complex64)
data = np.fromfile("fftea", dtype = np.complex64)

# Perform Fourier transform
original_data = np.fft.fft(data, n=64)

# Convert the complex64 array to bytes
flag = original_data.real.astype(np.complex64)
int_array = np.array([int(c.real) for c in flag])
aa = [chr(i) for i in int_array]
print(''.join(aa))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment