# Design, Implementation, and Analysis of a Block Cipher Based on a Secure Chaotic Generator
## 3 Experiments Results and Security Analysis
### Histograms of encrypted images  
The ciphered image must have a uniform distribution and this is a basic condition for any cryptosystem to be strong against statistical attacks. We encrypted 10 color and gray plain images with varying features and sizes and then we deducted the histograms of the plain images and corresponding ciphered images. The obtained results are given in Figures 7-16, and on each figure, we show: (a) the plain image, (b) the histogram of the plain image, (c) the corresponding ciphered image, and (d) the histogram of the ciphered image.  
Figure 11: Histograms: (**a**) Flowers image, (**b**) histogram of plain Flowers, (**c**) encrypted Flowers, and (**d**) histogram of encrypted Flowers.  
Figure 12: Histograms: (**a**) Goldhill image, (**b**) histogram of plain Goldhill, (**c**) encrypted Goldhill, and (**d**) histogram of encrypted Goldhill.  
Figure 13: Histograms: (**a**) Kiel image, (**b**) histogram of plain Kiel, (**c**) encrypted Kiel, and (**d**) histogram of encrypted Kiel.  
Note that visually the histograms of the encrypted images appeared to have a uniform distribution and were very different from those of the single images. Therefore, no visual information could be detected from the encrypted images by the proposed chaos-based cryptosystem.  
To check the uniformity of the histogram, we applied the chi-square test (using Equation (28)) to statistically confirm it. However, here, \(N_{c}\) was the number of values (256), \(O_{i}\) were the detected occurrence frequencies of each color value \(\in[0,\,255]\) in the histogram of the encrypted image, and \(E_{i}\) was the anticipated occurrence frequency of the uniform distribution, provided by \(E_{i}=(L\times C\times P)/N_{c}\). The distribution of the tested histogram was uniform if it met the following condition: \(\chi^{2}_{exp}<\chi^{2}_{th}(N_{c}-1,\alpha)=293.2478\) (for \(N_{c}=256\) and \(\alpha=0.05\)) [12].  
In Table 7, we reported the experimental values of the chi-square test for the 10 ciphered images. The values of the experimental chi-square obtained confirmed the uniformity of the histograms of the tested encrypted images.  
\begin{table}
\begin{tabular}{l l l} \hline \hline
**Image** & **Size** & **Chi-Square Test** \\ \hline Airplane & \(512\times 512\times 3\) & 256.7715 \\ Black & \(256\times 256\times 1\) & 234.0391 \\ Bridge & \(512\times 512\times 1\) & 256.6113 \\ Cameraman & \(256\times 256\times 1\) & 275.5625 \\ Flowers & \(256\times 256\times 3\) & 236.6458 \\ Goldhill & \(512\times 512\times 3\) & 239.6576 \\ Kiel & \(512\times 512\times 1\) & 243.4629 \\ Lena & \(512\times 512\times 3\) & 249.1270 \\ Sailboat & \(512\times 512\times 3\) & 242.1380 \\ White & \(256\times 256\times 1\) & 273.6641 \\ \hline \hline \end{tabular}
\end{table}
Table 7: Chi-square test.  
Figure 16: Histograms: (**a**) White image, (**b**) histogram of plain White, (**c**) encrypted White, and (**d**) histogram of encrypted White.  
Figure 15: Histograms: (**a**) Sailboat image, (**b**) histogram of plain Sailboat, (**c**) encrypted Sailboat, and (**d**) histogram of encrypted Sailboat.