# A Novel Adaptive Image Data Hiding and Encryption Scheme Using Constructive Image Abstraction
## 2 Our Proposed Methods
### Image Encryption
\begin{array}{l}\mathrm{C}_{i+1,R^{\prime}}=R_{2,Ai}\oplus P_{i+1,R^ {\prime}}\oplus P_{i,R^{\prime}}\oplus C_{i,E^{\prime}}\\ \mathrm{C}_{i+1,G^{\prime}}=R_{2,Ai+1}\oplus P_{i+1,G^{\prime}}\oplus P_{i,G^ {\prime}}\oplus C_{i+1,R^{\prime}}\\ \mathrm{C}_{i+1,R^{\prime}}=R_{2,Ai+2}\oplus P_{i+1,B^{\prime}}\oplus P_{i,B^ {\prime}}\oplus C_{i+1,G^{\prime}}\\ \mathrm{C}_{i+1,E^{\prime}}=R_{2,Ai+3}\oplus P_{i+1,E^{\prime}}\oplus P_{i,E^ {\prime}}\oplus C_{i+1,B^{\prime}}\\ \mathrm{C}_{i+1,R^{\prime}}=R_{2,Ai}\oplus P_{i+1,R^{\prime}}\oplus P_{i,R^ {\prime}}\oplus C_{i,B^{\prime}}\\ \mathrm{C}_{i+1,G^{\prime}}=R_{2,Ai+1}\oplus P_{i+1,G^{\prime}}\oplus P_{i,G^ {\prime}}\oplus C_{i+1,R^{\prime}}\\ \mathrm{C}_{i+1,B^{\prime}}=R_{2,Ai+2}\oplus P_{i+1,B^{\prime}}\oplus P_{i,B^ {\prime}}\oplus C_{i+1,G^{\prime}}\\ \end{array} \right., \tag{6}\] \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \(i\) & \(k\) & **Swap** & **1 st** & **2 nd** & **3 rd** & **4 th** & **5 th** & **6 th** & **7 th** & **8 th** \\ \hline \multicolumn{8}{c}{Original index \(\{\mathrm{X}\}\)} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\ \(1\) & \(5_{8}\) & (5 th, 8 th) & 1 & 2 & 3 & 4 & 8 & 6 & 7 & 5 \\ \(2\) & \(3_{7}\) & (3 rd, 7 th) & 1 & 2 & 7 & 4 & 8 & 6 & 3 & 5 \\ \(3\) & \(4_{6}\) & (4 th, 6 th) & 1 & 2 & 7 & 6 & 8 & 4 & 3 & 5 \\ \(4\) & \(2_{5}\) & (2 nd, 5 th) & 1 & 8 & 7 & 6 & **2** & 4 & 3 & 5 \\ \(5\) & \(3_{4}\) & (3 rd, 4 th) & 1 & 8 & 6 & 7 & 2 & 4 & 3 & 5 \\ \(6\) & \(0_{3}\) & No change & 1 & 8 & 6 & 7 & 2 & 4 & 3 & 5 \\ \(7\) & \(1_{2}\) & (1 st, 2 nd) & 8 & **1** & 6 & 7 & 2 & 4 & 3 & 5 \\ \multicolumn{8}{c}{Permuted index \(\{\mathrm{X}^{\prime}\}\)} & 8 & **1** & 6 & 7 & 2 & 4 & 3 & 5 \\ \hline \end{tabular}
\end{table} 
Table 1: An illustration of random index permutation for an image with 8 bits, where \(\{\mathrm{X}\}=\{1,2,3,4,5,6,7,8\}\) denotes the original order of the bit indices. Let us consider a permutated LDR image and take the first pixel as an example. This pixel is represented by the RGB values \(\mathbf{P}_{1}^{\prime}=\left(P_{1,R^{\prime}},P_{1,C^{\prime}},P_{1,B^{\prime}} \right)=(150,66,23)\). We use a pseudo-random sequence \(\mathbf{R}_{2}=\left\{10,153,117,...\right\}\) and four initial values \(\left(P_{0,R^{\prime}},P_{0,G^{\prime}},P_{0,B^{\prime}},C_{0,B^{\prime}} \right)=(79,51,114,99)\) to diffuse the bytes using Equation (6) with \(i=0\). Applying this equation, we get \(C_{1,R^{\prime}}=10\oplus 150\oplus 79\oplus 99=176\). We then use this value to diffuse \(C_{1,G^{\prime}}\) to obtain \(C_{1,G^{\prime}}=153\oplus 66\oplus 51\oplus 176=88\). Similarly, we diffuse \(C_{1,B^{\prime}}=72\) using \(C_{1,G^{\prime}}\). Finally, the stego pixel \(\mathbf{P}_{1}^{\prime}\) is diffused to become \(\mathbf{C}_{1}^{\prime}=(176,88,72)\). One advantage of our scheme is the avalanche effect [34; 35]. This effect means that if an error occurs in one pixel during encryption, it will trigger a chain reaction that spreads the error to all subsequent pixels. The error spreading causes a significant change in the encrypted image, making it difficult to analyze using differential attack methods.