Search code examples
audioencryptionfftfrequency-domain

Why is audio file encryption done in frequency domain?


When we want to encrypt an audio file (wav/mp3), why is the encryption done in the frequency domain? I looked at some audio encryption methods and they use the Fourier Transform and then they do some encryption in the frequency domain. Why we dont just take the data (int/float) from the wav/mp3 file, encrypt it and then write it back as a wav/mp3 file? Is there any advantage of encryption in frequency domain?

Some audio encryption algoritm that i found: http://ijcsit.com/docs/Volume%205/vol5issue03/ijcsit20140503393.pdf


Solution

  • No doubt due to why the majority of audio codec also use its frequency domain representation, it is more information efficient. When each of the freq domain bins only needs to store three parameters ( freq, magnitude and phase ) or even more concisely ( aj + bi) in the complex plane and an arbitrary audio curve in the time domain can be resurrected by just a handful of those freq bins it becomes compelling to perform the encryption on the more informational dense representation. Once in freq domain its also easier to discard non human perceived frequencies so reducing load. A knock on benefit is reduced compute demand when in freq domain for both compression and encryption.

    So a typical data flow would give you

    raw audio in PCM format ( time domain ) -> fft -> freq domain -> encryption -> decryption -> freq domain back again -> inverse fft -> resurrected raw audio
    

    If you are free of those constraints its perfectly feasible to do audio encryption directly in the time domain. Keep in mind once you muck with the time domain signal its freq domain representation will require ever greater information ( space + compute ) per unit of time, and hence harder to compress