# Securing IoT Data Using Steganography: A Practical Implementation Approach
## 3 Proposed Solution
### Hiding Algorithm  
The proposed IoT steganographic scheme generates a stego signal which is sent over the IoT network. To accommodate several wireless technologies used in IoT networks (e.g., cellular, WiFi and vehicular communications), the stego signal is modulated using orthogonal frequency division multiplexing (\(OFDM\)) and one of the multiple modulations and coding schemes (\(MCS\)s) such as \(QPSK\), \(BPSK\), \(16-QAM\) or \(64-QAM\) is chosen in a way to obtain the maximum bandwidth while considering the capability of the transmitting IoT device. The stego signal is then sent over an additive white Gaussian noise (\(AWGN\)) channel to modulate the noisy environment. At the receiver, the signal is demodulated and the embedded data are extracted.  
To generate the stego signal, we divided the cover signal into \(M\) frames of 4 ms and \(N\) samples each, \(s_{c}(m,n)\), \(1\leq m\leq M\) and \(1\leq n\leq N\). \(FFT\) was applied to each frame in the frequency domain such as \(S_{c}(m,k)=FFT(s_{c}(m,n))\) and the magnitude spectrum \(|S_{c}(m,k)|\) was isolated. The hiding band range is specified using \(F_{HDmin}\leq k\leq F_{HDmax}\), where \(F_{HDmin}\) and \(F_{HDmax}\) are the minima and the maxima of \(FBL\) (i.e., for a sampling frequency of 16 kHz, \(F_{HDmin}\) and \(F_{HDmax}\) are 1 and 28, respectively). The _threshold_ value was set as the minimum energy required for a magnitude frequency component to be selected for data hiding. The distortion level of the magnitude spectrum \(\Delta(m,k)\) was set at \(\rho_{dB}\) below the magnitude spectrum, where \(\rho_{dB}\) is the amount of attenuation from the original spectrum and is approximately 13 dB.  
The embedding process in the phase and the generation of the stego channel using \(QPSK/OFDM\) modulation is described in Algorithm 1.  
```
Input:\(s_{c}(m,N)\) Output:\(s_{s}(m,n)_{Modulated}\) \(m=1\), \(n=1\) while\(m\leq M\)do while\(n\leq N\)do \(|S_{s}(m,n)|\leftarrow|S_{c}(m,n)|\) while\(F_{HDmin}\leq k\leq F_{HDmax}\)do if\(10*log_{10}(|S_{c}(m,k)|)\geq\textit{threshold}_{dB}\)then if\(\Delta(m,k)_{dB}\geq SLB_{dB}\)then \(\phi_{s}(m,k)\leftarrow\phi_{c}(m,k)+\delta(m,k)\) \(s_{s}(m,n)=iFFT(|S_{c}(m,k)|e^{i\phi_{s}(m,k)})\) \(s_{s}(m,n)_{Modulated}\leftarrow QPSK/OFDM(s_{s}(m,n))+AWGN\) return\(s_{s}(m,n)_{Modulated}\)
```  
**Algorithm 1**Compute \(|\phi_{s}(m,k)|\) and modulate \(s_{s}(m,n)\)  
\(\delta(m,k)\) represents the modification in the phase value induced by the embedded bits in a given phase component such as: \(\phi_{s}(m,k)\leftarrow\phi_{c}(m,k)+\delta(m,k)\). The embedding in a given phase component is defined as follow: \(|\phi_{c}(m,k)|=(a_{n}2^{n}+a_{n-1}2^{n-1}+a_{n-2}2^{n-2}+...a_{2}2^{2}+a_{1}2 ^{1}+a_{0}2^{0})\), where \(a_{n}=\{0,1\}\) represents the bit value of the cover phase at a given \(LSB\) position, \(n=\{8,16\}\) depending on the quantization value of the audio signal and \(\delta(m,k)=(d_{i}2^{i}+d_{i-1}2^{i-1}+...+d_{0}2^{0})\), where \(d_{i}=\{0,1\}\) is the binary representation of the payload that will be injected into a given phase component. The value of stego phase is recalculated as: \(|\phi_{s}(m,k)|=(a_{n}2^{n}+a_{n-1}2^{n-2}+d_{i}2^{i}+...d_{1}2^{1}+d_{0}2^{0 }+a_{1}2^{1}+a_{0}2^{0})\). Finally, the new phase is multiplied with its magnitude to produce the stego spectrum therefore \(S_{s}(m,k)=|S_{c}(m,k)|e^{i\phi_{s}(m,k)}\). The inverse \(iFFT\) transformation is applied on the segment to get the new stego signal segment \(s_{s}(m,n)\). The principal parts of our audio hiding technique are represented in Figure 5, where the embedding of area blocks illustrate steps 3 to 6 in Algorithm 1.