I referred the below papers to understand the working of Phase Encoding,but the explanation is not proper.Just a few steps have been given in brief.



Can someone please explain the concept of how Audio Steganography using Phase Encoding works?


Here is the algorithm:

  1. Divide an input signal $S$ into $n$ consecutive blocks $S_i$ ($i\in\{1,\ldots,n\}$) of length $l$ each

  2. Compute magnitude $A_i$ and phase $\phi_i$ of each block using FFT where A(i)=abs(fft(S{i})) and Phi(i)=angle(fft(S{i})) in MATLAB.

    For example, here are the first 3 elements of $\phi$:
    Input phases of the first 3 segments (Recall that FFT of real signal has odd symmetry which is clearly visible on plots)

  3. Compute phase differences $\Delta\phi_i=\phi_i-\phi_{i-1}$ for $i\in\{2,\ldots,n\}$

  4. To encode your binary data $d$ of length $m:m<l$ assign $$\phi_{data}[i]= \begin{cases} \pi/2,& d_i=0\\ -\pi/2,& d_i=1 \end{cases}$$ for $i\in\{1,\ldots,m\}$.

  5. Replace following elements of first phase sequence, $ {\phi_1} $, with ${\phi _{data}}[i]$ for $i\in\{1,\ldots,m\}$ as: $${\phi '_1}[ {L/2 - m + i}] = {\phi _{data}}[i]\,$$ To maintain odd symmetry property of DFT, repeat same progress as: $${\phi '_1}[{L/2 + 1 + i}] = - {\phi _{data}}[{m + 1 - i}]$$

  6. To maintain phase differences sequentially reassign $\phi '_i=\phi_{i-1}+\Delta\phi_i$ for $i\in\{2,\ldots,n\}$
    Here are the first 3 elements of $\phi '$ after this step:
    enter image description here
    (Note how encoded $d$ has affected next blocks)

  7. Reconstruct the signal using inverse FFT applied to each block $A_i exp(j \phi '_i)$ (where $j$ is imaginary unit) and joining all blocks together.

Explanations to many details like the length of blocks and why particular steps are taken are given in the documents you and endolith linked to.

A minimal IPython Notebook version: github.com/danylo-dubinin/secret_in_wav.

  • 1
    $\begingroup$ What an awesome answer! $\endgroup$ – kdrtkl Feb 26 '17 at 18:48
  • $\begingroup$ Would love to see a toy implementation of this! $\endgroup$ – Petrus Theron May 24 '18 at 9:34
  • $\begingroup$ @PetrusTheron, cool! Thanks for being interested :) I have a minimal IPython Notebook version here github.com/danylo-dubinin/secret_in_wav. It's without the graphs which i showed in this answer because they are from Mathematica version of this program which I didn't publish back then. I can publish it later too though if you want :) Should be still somewhere on the old laptop. $\endgroup$ – Dan Oak May 25 '18 at 13:38
  • $\begingroup$ Hi @danoak, thanks! I'm a Clojure guy, so Mathematica version would be much appreciated :) $\endgroup$ – Petrus Theron May 25 '18 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.