# The Design and FPGA-Based Implementation of a Stream Cipher Based on a Secure Chaotic Generator
## 4 Performance Analysis of the Proposed SCbSC
### Cryptanalytic Analysis
#### 4.2.2 Statistical Analysis  
In order to analyze the resilience of the proposed SCbSC system against most statistical attacks, we use histogram, chi-square, entropy, and correlation analysis. Histogram and Chi-Square Analysis  
The histogram of an encrypted image is an important feature in evaluating the performance of the encryption process. It illustrates how the gray levels of the pixels in an image are distributed and should be very close to a uniform distribution. In Figures 9-13, we give the results obtained for Lena, Peppers, Baboon, Barbara, and Boats of size 256 \(\times\) 256, in (a) and (c) the plain/cipher images and in (b) and (d) their histograms respectively. \begin{table}
\begin{tabular}{c c c c c c} \hline
**Test** & **Lena** & **Pepper** & **Baboon** & **Barbara** & **Boats** \\ \hline NPCR \% & 99.5483 & 99.5452 & 99.5788 & 99.5513 & 99.5529 \\ UACI \% & 33.7768 & 33.6530 & 33.5595 & 33.7723 & 33.6886 \\ \(H_{D}\) & 0.5015 & 0.4991 & 0.4996 & 0.5009 & 0.4996 \\ \hline \end{tabular}
\end{table} 
Table 6: Number of pixel change rate (NPCR), unified average changing intensity (UACI), and \(H_{D}\) values. Figure 11: Result of Baboon image. (**a**) Baboon image, (**b**) histogram of Baboon image, (**c**) encrypted Baboon, and (**d**) histogram of encrypted Baboon. Figure 12: Result of Barbara image. (**a**) Barbara image, (**b**) histogram of [PERSON] image, (**c**) encrypted [PERSON], and (**d**) histogram of encrypted [PERSON]. Figure 13: Result of Boats image. (**a**) Boats image, (**b**) histogram of Boats image, (**c**) encrypted Boats, and (**d**) histogram of encrypted Boats. Figure 9: Result of [PERSON] image. (**a**) [PERSON] image, (**b**) histogram of [PERSON] image, (**c**) encrypted [PERSON], and (**d**) histogram of encrypted [PERSON]. It was observed that the histograms of the ciphered images are very close to the uniform distribution and are completely different from the plain images. We applied the chi-square test, using Equation (23), on ciphered images to statistically confirm their uniformity. \(N_{c}=2^{8}=256\) is the number of levels, \(O_{i}\) is the calculated occurrence frequency of each gray level \(i\in[0,255]\) in the histogram of the ciphered image, and \(E_{i}\) is the expected occurrence frequency of the uniform distribution, calculated by \(E_{i}=image\)_size in bytes_/\(N_{c}\). The distribution of the histogram tested is uniform if it satisfies the following condition: \(\chi_{ex}^{2}<\chi_{th}^{2}(N_{c}-1,\alpha)=293.24\) (for \(N_{c}=256\) and \(\alpha=0.05\)). The results obtained for the chi-square test, given in Table 7, indicate that the histograms of the ciphered images tested are uniform because their experimental values are smaller than the theoretical values. Entropy Analysis  
The random behavior of the ciphered image can be quantitatively measured by entropy information given by [PERSON] (1954):  
\[H(C)=\ -\sum_{i=0}^{N_{c}-1}P(c_{i})\times log_{2}(P(c_{i})) \tag{29}\]  
where \(H(C)\) is the entropy of the encrypted image, and \(P(c_{i})\) is the probability of each gray level appearance (\(c_{i}=0,1,\ldots,255\)). In the case of equal probability levels, the entropy is maximum (=8). The closer the experimental entropy value is to the maximum value, the more robust the encryption algorithm. We give in Table 8, the results obtained from the entropy test on the plain and encrypted images. It is clear that the obtained entropies of ciphered images are close to the optimal value. Then, from these results, the proposed stream cipher has a high degree level of resilience. Correlation Analysis  
In an original image, each pixel is highly-correlated with adjacent pixels in a horizontal, vertical, and diagonal directions. A good encryption algorithm should produce encrypted images with correlation and redundancy as low as possible (close to zero) between adjacent pixels.