# Design, Implementation, and Analysis of a Block Cipher Based on a Secure Chaotic Generator
## 3 Experiments Results and Security Analysis
### Correlation Analysis  
Another key property of a secure cryptosystem is that the correlation of the encrypted image should be close to zero and very different from the correlation of the plain image, which is generally close to one. To measure this property, \(N=8000\) pairs of two adjacent pixels in the horizontal (HC), vertical (VC), and diagonal (DC) directions from the original and the ciphered images were randomly selected. Then, the correlation coefficients were calculated using the following equation:  
\[\rho_{xy}=\frac{cov(x,y)}{\sqrt{D(x)}\sqrt{D(y)}} \tag{29}\]  
with:  
\[cov(x,y)=\frac{1}{N}\sum_{i=1}^{N}\left([x_{i}-E(x)][y_{i}-E(y)]\right) \tag{30}\]  
\[E(x)=\frac{1}{N}\sum_{i=1}^{N}x_{i} \tag{31}\]  
\[D(x)=\frac{1}{N}\sum_{i=1}^{N}\left(x_{i}-E(x)\right)^{2} \tag{32}\]  
Furthermore, \(x\) and \(y\) were the gray-level values of two adjacent pixels in the image.  
In Table 8, we give the mean correlation coefficient value based on 10 images ciphered by 100 different secret keys. From this table, the correlation coefficients in all directions of the plain images were close to one, indicating that the pixels were highly correlated, while those of encrypted images were near to zero, which proved that there was no correlation between the plain and ciphered images.  
These results can be observed visually in Figure 17, in which we show the correlation of adjacent pixels of the Goldhill (512 \(\times\) 512 \(\times\) 3) and encrypted Goldhill images in the three directions: horizontal, vertical, and diagonal, respectively.  
\begin{table}
\begin{tabular}{l l l l l l l l} \hline \hline \multirow{2}{*}{**Image**} & \multirow{2}{*}{**Size**} & \multicolumn{3}{c}{**Plain Image**} & \multicolumn{3}{c}{**Encrypted Image**} \\ \cline{3-8}  & & & **HC** & **VC** & **DC** & **HC** & **VC** & **DC** \\ \hline Airplane & \(512\times 512\times 3\) & R & 0.97191 & 0.96051 & 0.93848 & 0.00006 & \(-0.00153\) & 0.00024 \\  & & G & 0.  
**Entropy Analysis**  
The random behavior of the encrypted image can also be evaluated using the entropy information defined by:  
\[H(C)=\sum_{i=0}^{N_{c}-1}P(c_{i})\times log_{2}\frac{1}{P(c_{i})} \tag{33}\]  
where \(H(C)\) is the entropy of the encrypted image \(C\), \(P(c_{i})\) is the occurrence value of each level (\(i=0,\ 1,\ 2,\...,\ 255\)). In the condition of equal probability levels \((P(c_{i})=2^{-8})\), the entropy is maximum, \(H(C)=8\).  
We show in Table 9 the entropy test results of the original and encrypted images. It is clear that the results for the encrypted images were close to the optimal value. Based on these results, the proposed chaos-based cryptosystem had a high degree level of resilience.  
\begin{table}
\begin{tabular}{l c c c} \hline \hline
**Image** & **Size** & **Plain** & **Encrypted** \\ \hline Airplane & \(512\times 512\times 3\) & 6.6639 & 7.9997 \\ Black & \(256\times 256\times 1\) & 0.0000 & 7.9974 \\ Bridge & \(512\times 512\times 1\) & 5.7056 & 7.9992 \\ Cameraman & \(256\times 256\times 1\) & 6.9046 & 7.9977 \\ Flowers & \(256\times 256\times 3\) & 7.5434 & 7.9991 \\ Goldhill & \(512\times 512\times 3\) & 7.6220 & 7.9997 \\ Kiel & \(512\times 512\times 1\) & 6.9589 & 7.9994 \\ Lena & \(512\times 512\times 3\) & 5.6822 & 7.9998 \\ Sailboat & \(512\times 512\times 3\) & 7.7632 & 7.9998 \\ White & \(256\times 256\times 1\) & 0.0000 & 7.9968 \\ \hline \hline \end{tabular}
\end{table}
Table 9: Entropy test results.  
Figure 17: Distribution of adjacent pixels in the plain and encrypted images of Goldhill in the three directions: horizontal, vertical, and diagonal, respectively.  
Based on all of these results of the histogram, chi-square, correlation, and information entropy analysis, the proposed chaos-based cryptosystem was secure against statistical attacks.