# Hybrid Chaotic-Based PRNG for Secure Cryptography Applications
## 5 Results and Analysis
### Resistance to Differential Attack  
_Number of Pixels Change Rate (NPCR)_  
NPCR is a measure of the robustness of an image encryption algorithm. It is defined as the percentage of pixels in a given encrypted image that change when one bit of the original image changes. NPCR is commonly used to evaluate the strength of an encryption algorithm against chosen-plaintext attacks, where an attacker attempts to determine the encryption key by observing how changes to the plaintext affect the encrypted image. The NPCR is given by Equations (21) and (22):  
\[NPCR=\frac{\sum_{i=1}^{N}[C_{i}\
eq E_{i}]}{N}\times 100 \tag{21}\]  
\[\mathcal{N}_{\alpha}^{*}=\frac{L+\Phi^{-1}(\alpha)\sqrt{L/T}}{L+1} \tag{22}\]  
where \(N\) is the total number of pixels in the encrypted image, \(C_{i}\) and \(E_{i}\) are the \(i\)-th pixel values of the original image and the encrypted image, respectively. The numerator of the equation counts the number of pixels that differ between the original and encrypted images, and the denominator normalizes this count to the total number of pixels in the image. The resulting percentage value gives a measure of the NPCR of the encryption \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & & \multicolumn{3}{c}{**Local Shannon Entropy**} \\ \cline{3-6}
**File Name** & **Size** & & & \(\mathbf{\alpha=0.05}\) & \(\mathbf{\alpha=0.01}\) & \(\mathbf{\alpha=0.001}\) \\  & & & & \(h_{left}^{ls}=\mathbf{7.901901305}\) & \(h_{left}^{ls}=\mathbf{7.901722822}\) & \(h_{left}^{ls}=\mathbf{7.901515698}\) \\  & & **Original Image** & **Encrypted Image** & \(h_{right}^{ls}=\mathbf{7.903037329}\) & \(h_{right}^{ls}=\mathbf{7.903215812}\) & \(h_{right}^{ls}=\mathbf{7.903422936}\) \\ \hline bird & \(2625\times 2250\) & 7.559383165 & 7.999966812 & 7.902673265 & 7.902100541 & 7.902336555 \\ lion & \(2362\times 3047\) & 4.868976964 & 7.999975018 & 7.902084826 & 7.902600108 & 7.902215068 \\ pyramids & \(4755\times 3090\) & 6.840163701 & 7.999988669 & 7.902317244 & 7.90294224 & 7.902561135 \\ sphinv & \(1704\times 2272\) & 6.951101185 & 7.999956064 & 7.902838446 & 7.901851957 & 7.902802677 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Global and local Shannon entropy of the proposed algorithm. algorithm. The higher the NPCR value, the more robust the algorithm will be against chosen plain-text attacks. _Unified Average Changing Intensity (UACI)_  
UACI is a metric used to calculate the difference in the average intensity between two encrypted images, denoted as \(C\) and \(C^{\prime}\). The difference is calculated using Equation (23):  
\[UACI(C,C^{\prime})=\sum_{i,j}\frac{|C(i,j)-C(i,j)|}{T\times L} \tag{23}\]  
where \(L\) is the maximum level of color intensity and \(T\) is the total number of pixels in the image. The result of UACI is declared as a \"Pass\" if it falls within the interval \([\mathcal{U}_{\alpha}^{*-},\mathcal{U}_{\alpha}^{*+}]\). \[ \begin{cases}\mathcal{U}_{\alpha}^{*-}=\mu_{\mathcal{U}}-\Phi^{-1}(\alpha/2) \sigma_{\mathcal{U}}\\ \mathcal{U}_{\alpha}^{*+}=\mu_{\mathcal{U}}+\Phi^{-1}(\alpha/2)\sigma_{ \mathcal{U}}\end{cases}  \tag{24}\]  
where \(\mu_{\mathcal{U}}\) and \(\sigma_{\mathcal{U}}\) are given by Equations (25) and (26):  
\[\mu_{\mathcal{U}} =\frac{L+2}{3L+3} \tag{25}\] \[\sigma_{\mathcal{U}} =\frac{(L+2)(L^{2}+2L+3)}{18(L+1)^{2}LT} \tag{26}\]  
In this study, 28 grayscale images of different sizes and intensities were subjected to both the NPCR and UACI tests with \(\alpha\) = 0.05. The results in Table 4 show that all scores represent pass grades, indicating that the proposed system has good confusion and diffusion properties, enabling it to withstand differential attacks while ensuring data security.