# A Tweak-Cube Color Image Encryption Scheme Jointly Manipulated by Chaos and Hyper-Chaos
## 5 Performance Analysis
### Differential Attack Analysis  
The sensitivity to the plain image determines the ability of an algorithm to resist differential attacks. The measurement methods are the number of pixels change rate (NPCR) and unified average changing intensity (UACI) [40]. The formulas are as follows:  
\[\mathrm{NPCR_{R,G,B}}=\frac{1}{\mathrm{M}\times\mathrm{N}}\sum_{i=1}^{\mathrm{M} }\sum_{j=1}^{\mathrm{N}}\mathrm{E_{R,G,B}(i,j)}\times 100\% \tag{23}\]  
\[\mathrm{UACI_{R,G,B}}=\frac{1}{\mathrm{M}\times\mathrm{N}}\sum_{i=1}^{\mathrm{ M}}\sum_{j=1}^{\mathrm{N}}\frac{\left|\mathrm{M_{R,G,B}(i,j)-M^{\prime}_{R,G,B}(i,j) }\right|}{255}\times 100\% \tag{24}\]  
Figure 12: (**a**) Cipher images with lost data at different locations; (**b**) decrypted images of (**a**); (**c**) cipher images with different sizes of data loss; (**d**) decrypted images of (**c**).  
where M and M\({}^{\prime}\) are two cipher images whose plain images have only one different pixel. \(\mathrm{E_{R,G,B}(i,j)}\) is utilized to determine the distinction between two cipher images, which can be defined as:  
\[\mathrm{E_{R,G,B}(i,j)}=\left\{\begin{array}{l}0,\mathrm{M_{R,G,B}(i,j)}= \mathrm{M^{\prime}_{R,G,B}(i,j)}\\ 1,\mathrm{M_{R,G,B}(i,j)}\
eq\mathrm{M^{\prime}_{R,G,B}(i,j)}\end{array}\right. \tag{25}\]  
In 2011, [PERSON] et al. proposed more stringent standards of NPCR and UACI [41], which clearly demonstrates how high NPCR/UACI is, such that the encryption algorithm indeed has a high security level. The critical value N\({}_{\alpha}^{*}\) of significance level \(\alpha\) is calculated by  
\[\mathrm{N_{\alpha}^{*}}=(\mathrm{F}-\phi^{-1}(\alpha)\sqrt{\frac{\mathrm{F}}{ \mathrm{MN}}})/(\mathrm{F}+1) \tag{26}\]  
where \(\phi^{-1}(\bullet)\) is the inverse cumulative density function (CDF) of the standard Normal distribution, and F denotes the largest supported pixel value compatible with the ciphertext image format. Assuming that the calculated value is greater than N\({}_{\alpha}^{*}\), then it can be proved to pass the test. The maximum N\({}_{\alpha}^{*-}\) and minimum N\({}_{\alpha}^{*+}\) of UACI can be computed according to Equation (27).  
\[\left\{\begin{array}{l}\mathrm{N_{\alpha}^{*-}}=\mu_{\mathrm{u}}-\phi^{-1}( \alpha/2)\sigma_{\mathrm{u}}\\ \mathrm{N_{\alpha}^{*+}}=\mu_{\mathrm{u}}+\phi^{-1}(\alpha/2)\sigma_{\mathrm{u }}\end{array}\right. \tag{27}\]  
where \(\mu_{\mathrm{u}}=(\mathrm{F}+2)/(3\mathrm{F}+3)\), \(\sigma_{\mathrm{u}}^{2}=(\mathrm{F}+2)(\mathrm{F}^{2}+2\mathrm{F}+3)/18( \mathrm{F}+1)^{2}\mathrm{MNF}\).  
If the results of a scheme are between N\({}_{\alpha}^{*-}\) and N\({}_{\alpha}^{*+}\), it can be considered to pass the test. Table 9 reveals the theoretical values of NPCR and UACI at different significance levels for images of size \(256\times 256\).  
In our experiment, we encrypted plain images with the initial keys. Then, we randomly chose one pixel in each original image and changed them slightly. The modified images were encrypted with the same keys. After reckoning the two types of ciphers, it can be found that all the NPCR values in Table 10 are greater than N\({}_{\alpha}^{*}\), and draw near to the ideal value of 99.6094%. Simultaneously, the UACI results for each image in Table 11 are within the theoretical interval. Thus, the algorithm can effectively resist differential attacks.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \multirow{2}{*}{**Size**} & \multicolumn{3}{c}{**NPCR (\%)**} & \multicolumn{3}{c}{**UACI (\%)**} \\ \cline{2-7}  & \(\mathrm{N_{0.05}^{*}}\) & \(\mathrm{N_{0.01}^{*}}\) & \(\mathrm{N_{0.001}^{*}}\) & \(\mathrm{N_{0.001}^{*}}\) & \((\mathrm{N_{0.05}^{*-}}\mathrm{N_{0.05}^{*+}})\) & \((\mathrm{N_{0.01}^{*-}}\mathrm{N_{0.01}^{*+}})\) & \((\mathrm{N_{0.001}^{*-}}\mathrm{N_{0.001}^{*+}})\) \\ \hline \(256\times 256\) & 99.5693 & 99.5527 & 99.5341 & (33.2824,33.6447) & (33.2255,33.7061) & (33.1594,33.7677) \\ \hline \end{tabular}
\end{table}
Table 9: The theoretical values of number of pixels change rate (NPCR) and unified average changing intensity (UACI).