# A Novel Image Encryption Algorithm Based on Voice Key and Chaotic Map
## 2 Principles of the Proposed Method
### Proposed Image Encryption and Decryption Algorithm
#### 2.2.1 Encryption Process
#### 4.2.2 Correlation between Adjacent Pixels

The correlation between adjacent pixels is strong for plaintext images, and it can be easily cracked by the attackers. Therefore, in order to increase the difficulty of decryption and improve the security for ciphertext images, the correlation between adjacent pixels should be reduced [26; 27]. In this article, the horizontal, vertical and diagonal adjacent pixels of the plaintext and ciphertext images of Lena from red, green and blue channels are analyzed for correlation under different \(Fp\) conditions. The correlation calculation formula is as follows:

\[\left\{ \begin{aligned} r_{xy}=\frac{cov(x,y)}{\sqrt{D(x)}\sqrt{D(y) }}\\ cov(x,y)=\frac{1}{N}\sum\limits_{i=1}^{N}(x_{i}-E(x))(y_{i}-E(y))\\ E(x)=\frac{1}{N}\sum\limits_{i=1}^{N}x_{i}\\ E(y)=\frac{1}{N}\sum\limits_{i=1}^{N}y_{i}\\ D(x)=\frac{1}{N}\sum\limits_{i=1}^{N}(x_{i}-E(x))^{2}\\ D(y)=\frac{1}{N}\sum\limits_{i=1}^{N}(y_{i}-E(y))^{2}\\ \end{aligned} \right. \tag{8}\]

where, \(x_{i}\) and \(y_{i}\) (\(i=1\), \(2\), \(\dots\), \(N\)) are the brightness values of two adjacent pixels from each color channel, and \(r_{xy}\) is the correlation coefficient of two adjacent pixels. The size of the pixel sample set selected in the image is denoted by \(N\), where all pixels are selected. The expectation and variance of the variable \(x\) are denoted by \(E(x)\) and \(D(x)\), respectively, while \(E(y)\) and \(D(y)\) denote the expectation and variance of variable \(y\), respectively. Table 4 shows the coefficients of two adjacent pixels of the encrypted ciphertext image under different \(Fp\) conditions, different color channels and different directions. These coefficients are significantly reduced and are all close to zero. Table 5 shows a comparison with other algorithms. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{**Image**} & \multicolumn{3}{c}{**Horizontal**} & \multicolumn{3}{c}{**Vertical**} & \multicolumn{3}{c}{**Diagonal**} \\ \cline{2-10}  & **Ref. [28]** & **Ref. [29]** & **Ref. [30]** & **Ref. [28]** & **Ref. [29]** & **Ref. [30]** & **Ref. [28]** & **Ref. [29]** & **Ref. [30]** \\ \hline Lena & 0.01534 & 0.0214 & \(-\)0.038118 & 0.01391 & 0.0465 & \(-\)0.029142 & 0.01399 & 0.009 & 0.002736 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: The comparison of image correlation coefficients. #### 4.2.3 Ability of Resisting Differential Attack

The image encryption algorithm should effectively resist differential attacks. Therefore, it should be very sensitive to subtle changes in the original image. The number of changing pixel rate (NPCR) and the unified averaged changed intensity (UACI) are the two most common quantitative methods used to evaluate the robustness of an image encryption algorithm against differential attacks. The ideal values of NPCR and UACI are 99.6094% and 33.4635% [31; 32; 33; 34], respectively. These two metrics are defined by the following expressions:

\[NPCR(C_{1},C_{2})=\sum_{j=1}^{j=N}\sum_{i=1}^{i=M}\frac{D(i,j)}{M\times N}\times 1 00\% \tag{9}\]

\[UACI=(C_{1},C_{2})=\sum_{j=1}^{j=N}\sum_{i=1}^{i=M}\frac{|c_{1}(i,j)-c_{2}(i,j) |}{M\times N\times 255}\times 100\% \tag{10}\]

\[D(i,j)= \begin{cases}0,C_{1}(i,j)=C_{2}(i,j)\\ 1,C_{1}(i,j)\
eq C_{2}(i,j)\end{cases}  \tag{11}\]

where, \(C_{1}\) and \(C_{2}\) represent two different encrypted images, and their corresponding plaintext images only differ in pixel values at one position. Let \(C_{1}(i,j)\) and \(C_{2}(i,j)\) be the \(i\)th row and \(j\)th column pixels of two cipher images \(C_{1}\) and \(C_{2}\), respectively. The size of the image is \(M\times N\) and \(D(i,j)\) represents whether the corresponding pixel values \(C_{1}(i,j)\) and \(C_{2}(i,j)\) of the two images are equal or not. Table 6 shows the NPCR and UACI values of the red, green and blue channels of Lena image for varying values of \(n_{w1}\)-\(n_{w}6\) while keeping \(Fp\) as constant, and varying values of \(Fp\) while keeping \(n_{w1}\)-\(n_{w}6\) constant. Table 7 shows the comparison with other algorithms.