4.3.2. Histogram Analysis

An image histogram can reflect the frequency distribution of pixel values in an image [15]. In this experiment, Figure 9 shows the histograms of the plain and cipher images. The histogram of the cipher image has a balanced pixels distribution. This indicates that it is difficult for the attackers to obtain valid statistical information from the encrypted image. As the pixel values of the encrypted image have no obvious regularity, the attacker cannot obtain the original image through brute force analysis of the cipher. Therefore, the encryption system proposed in this paper has the ability to resist statistical attacks.

#### *4.4. Key Sensitivity Test*

Key sensitivity can be tested by the number of pixel change rate (NPCR) and the unified average changing intensity (UACI) [28]. In this test, we calculated the NPCR and UACI of two encrypted images based on changing a small value, set to 10−<sup>15</sup> for keys. The mathematical formulas for calculating NPCR and UACI are defined as [29]:

$$\begin{cases} \text{ } NPCR = \sum\_{j=1}^{M} \sum\_{j=1}^{N} \frac{D(i,j)}{M \times N} \times 100\%\_{\prime} \\\ \text{ } LACI = \sum\_{j=1}^{M} \sum\_{j=1}^{N} \frac{|C(i,j) - C^{\prime}(i,j)|}{255 \times M \times N} \times 100\%\_{\prime} \end{cases} \tag{17}$$

$$D(i,j) = \begin{cases} \ 0, \ if \ \mathcal{C}(i,j) = \mathcal{C}'(i,j) \\ \ 1, \ if \ otherwise \end{cases} \tag{18}$$

where *C*(*i*, *j*) and *C*'(*i*, *j*) are the cipher image generated by the original key and the changed key in the key sensitivity test, respectively. The ideal values of NPCR and UACI are 99.6094% and 33.4635% for an 8-bit grey scale image, respectively [1]. Table 2 lists the simulation results. The NPCR and UACI of our proposed algorithm are very close to the expected value. The analysis results showed that the algorithm can resist chosen-plain text attacks.

**Figure 9.** Histograms of (**a**,**b**) Lena and the encrypted image and (**c**,**d**) Pepper and the encrypted image.

**Table 2.** The number of pixel change rate (NPCR) and the unified average changing intensity (UACI) of different images for key sensitivity.

