# A Novel Adaptive Image Data Hiding and Encryption Scheme Using Constructive Image Abstraction
## 2 Our Proposed Methods
### Image Encryption
Figure 2: Trajectory of two-dimensional logistic tent modular map using the initial values \((x_{0},y_{0})=(0.31416,0.27183)\) and the control parameters \((a,b)=(100,100)\). Considering an image with \(n_{1}\) bits, let \(\{\mathrm{X}\}=\{1,2,\ldots,n_{1}\}\) indicate the indices of bits in the image. During the \(i\)-th iteration, we generate an \((n_{1}+1-i)\)-ary random integer by computing \(k=R_{1,i}\ mod\ (n_{1}+1-i)\), where \(R_{1,i}\) is the \(i\)-th pseudo-random integer in sequence \(\boldsymbol{R_{1}}\). Following this, we swap the \((n_{1}+1-i)\)-th index with the \(k\)-th index. The procedure repeats \((n_{1}-1)\) times to rearrange the indices recorded in \(\{\mathrm{X}\}\). We now use an image with only 8 bits \((n_{1}=8)\) as an instance. \(\{\mathrm{X}\}=\{1,2,3,4,5,6,7,8\}\) indicates the indices of the bits in the image, and \(\{\mathrm{B}\}=\{1,0,1,0,0,1,0,0\}\) denotes the corresponding bits. With this representation, we can refer to the first three bits as \(\mathrm{X}[1]=1\), \(\mathrm{X}[2]=0\), and \(\mathrm{X}[3]=1\). Table 1 illustrates the permutation process, where the gray color represents the shuffled indices. At the initial round (\(i=1\)), an 8-ary random number \(k=5_{8}\) is generated from the sequence \(\boldsymbol{R_{1}}\), then the 5 th index, 5, is swapped with the 8 th index, 8, resulting in shuffled indices \(\{1,2,3,4,8,6,7,\$\}\). During the next iteration (\(i=2\)), \(k=3_{7}\) is generated and the 3 rd index, 3, is exchanged with the 7 th index, 7, resulting in the indices \(\{1,2,7,4,8,6,3,\$\}\). The final permuted indices \(\{\mathrm{X}^{\prime}\}\) are \(\{8,1,6,7,2,4,3,5\}\), which yields a bit-level permutation of \(\{\mathrm{B}^{\prime}\}=\{0,1,1,0,0,0,1,0\}\). Our implementation involves first aligning \(n_{1}\) bits in the image and then applying a bit-level random permutation. It is worth noting that the indices are swapped in place instead of producing a separate copy. As a result, the time complexity is \(O(N)\) for the random permutation, and the space complexity is \(O(1)\). Furthermore, every element chosen in the array \(\{\mathrm{X}\}\) has an equal probability \((1/n_{1})\). The output permutation has a probability of \(\frac{1}{n_{1}}\times\frac{1}{n_{1}-1}\times\ldots\times\frac{1}{2}\times \frac{1}{1}=\frac{1}{n_{1}! }\) when applying this analysis recursively. This implies that every permutation is equally likely to occur. 4. Byte-level diffusion. The last stage involves diffusing the permutated image using the exclusive-OR operator, \(\oplus\), in combination with the pseudo-random sequence, \(\boldsymbol{R_{2}}\). The shuffled byte set of the permutated image is denoted as \(I_{\mathrm{S}}=\left\{P_{1,R^{\prime}},P_{1,G^{\prime}},P_{1,B^{\prime\prime }},\left(P_{1,E^{\prime}}\right),\ldots,P_{W\times H,R^{\prime}},P_{W\times H, G^{\prime}},P_{W\times H,B^{\prime}},\left(P_{W\times H,E^{\prime}}\right)\right\}\). Note that an HDR image contains \(P_{i,E^{\prime}}\) elements as it has four channels, including the exponent one. The byte diffusion process comprises of two sub-steps. Firstly, we extract the initial values, \(\left(P_{0,R^{\prime}},P_{0,G^{\prime}},P_{0,B^{\prime}},P_{0,E^{\prime}},C_{0,E^{\prime}}\right)\) for RGBE and \(\left(P_{0,R^{\prime}},P_{0,G^{\prime}},P_{0,B^{\prime}},C_{0,B^{\prime}}\right)\) for LDR images, from the secret key. Next, we apply Equation (6) to diffuse the bytes of each channel. It is worth noting that as four initial values are provided, the range of index, \(i\), is from 0 to \(W\times H-1\). \[\left\{