> FFT CIPHER (FREQUENCY DOMAIN)
The idea in plain English: Any sound can be described in two ways: as a waveform (how the air pressure changes over time) or as frequencies (which pitches are present). The Fourier Transform converts between these two views. This puzzle takes your message, converts it to a waveform, then transforms it into frequencies (the "frequency domain"). You get the frequency data. To decode, you apply the inverse transform to convert it back to a waveform, then read the numbers as ASCII codes.
Why this really exists: The Fourier Transform is one of the most important mathematical tools ever invented. JPEG compresses images by transforming blocks of pixels into frequencies and discarding invisible ones. MP3 does the same for sound. MRI machines use it to reconstruct body images from magnetic signals. Your WiFi uses it. The GPS in your phone uses it. Radar, sonar, astronomy — they all rely on the Fourier Transform.
▸ Concrete Example
Say the message is "HI" (ASCII: H=72, I=73). The values [72, 73] are a simple 2-point signal.
[72, 73] → transform → frequency domain: [(72+73), (72-73)] = [145, -1]
You receive the frequency data: [(145, 0), (-1, 0)] as complex numbers
Inverse DFT (decoding):
[145, -1] → inverse transform → [72, 73] → "HI"
Apply iDFT to frequency data → round to integers → ASCII text
In practice, messages are much longer (padded to a power of 2 like 8, 16, 32...), but the math is the same.
▸ How to Decode (Step by Step)
1. The puzzle gives you frequency data as [real, imag] pairs (complex numbers)
2. Apply the inverse Discrete Fourier Transform (iDFT)
3. Round each result to the nearest integer
4. Convert integers to ASCII characters
5. Join characters → the answer word
freq = np.array([complex(r, i) for r, i in freq_pairs])
signal = np.fft.ifft(freq)
chars = [chr(int(round(x.real))) for x in signal]
word = ''.join(chars)
💡 At diff 6-7, only magnitudes are given — you need to reconstruct the phase using conjugate symmetry (real signal property). The magnitude-only version is harder because half the data is missing.
▸ Real-World Applications
- JPEG images: Divide image into 8×8 blocks, transform, discard high frequencies
- MP3 audio: Transform sound into frequencies, remove ones humans can't hear
- MRI scans: Medical imaging uses Fourier Transform to reconstruct body cross-sections
- WiFi & 5G: OFDM modulation uses FFT to pack data onto multiple frequency carriers
- Astronomy: Radio telescopes use FFT to process signals from deep space