# Color Image Encryption Based on Deep Learning and Block Embedding

Authors: Yi Liu; Gang Cen; Bijun Xu; Xiaogang Wang
Journal: Security and Communication Networks
 (2022)

---

## Abstract

Because of the advent of the information age, digital multimedia data are mainly transmitted through the Internet. Image is one of the most popular digital multimedia data. Therefore, this paper proposes a block-based key embedding method and a color image encryption scheme based on deep learning with this method. By using a neural network model to predict the initial chaotic sequence, the key data generated by prediction are encrypted to the color image in layers and blocks. This paper proposed the color image encryption scheme time complexityOn2, which is simple and effective. Simulation results show that the proposed scheme exhibits good statistical properties with information entropy mean close to eight and correlation coefficient close to zero. Good robustness to common image attacks like noise addition and cropping. Excellent encryption performance includes enormous key space and low PSNR.


---

## Body

## 1. Introduction

With the birth and development of fifth-generation mobile communication technology, people can obtain all kinds of data they need through the Internet anytime and anywhere and realize resource sharing and information interaction. Therefore, information security has consistently commanded much attention. Image encryption represents the process of hiding images with keys to prevent unauthorized access. Considering the characteristics of image data, many existing image encryption algorithms are proposed based on different technologies, including vector quantization, fractional wavelet transformation, and chaos [1].In recent years, deep learning models have been widely used in the field of information security. Especially in image processing, deep learning shows vast advantages (see Figure1). For instance, Li et al. used convolution neural networks (CNN) to optically encrypt iris images [2]. Chen et al. proposed a method to improve the robustness of 2D/3D optical image encryption by using extended deep CNN [3]. Ni et al. tried to apply the compressed sensing (CS) reconstruction algorithm based on deep learning to image encryption [4]. Zhang and Li encrypted images using optics combined with deep learning models [5] and so on.Figure 1
Color image encryption problems and possible solutions for real-world situations.Combining the contents of the above (see Table1), it is unproblematic to find most of the current encryption schemes based on deep learning which still stay at the stage of encrypting gray image. Based on the research done by Zhao et al. [6], this paper proposes a method of embedding keys in blocks and a color image encryption scheme, depending on a deep learning model to expand the research content in this direction. The deep learning model is principally used to predict the initial sequences generated by chaotic systems by embedding the predicted data into the upper left, lower right, and middle regions of the three components of the color image. The final encrypted image is obtaines by using scrambling and diffusion algorithms.Table 1
Some image encryption methods based on deep learning.
MethodProposedRef. [2]Ref. [3]Ref. [4]Ref. [6]Ref. [5]Image typeColorGrayGrayGrayGrayGrayModelBiLSTMCNNCNNCNNLSTMU-netThe main contributions of this paper are as follows:(1)
This is a recent attempt to combine deep learning models with color image encryption(2)
The implementation is simple and effective and improves the practical use efficiency of encryption algorithms(3)
It has excellent encryption performance, good statistical characteristics, and strong robustness to common image attacks


## 2. Preparatory Knowledge

### 2.1. Chen’s Chaotic System

A chaotic system means there are seemingly erratic irregular movements in a certain way which are nonrepeatable, unpredictable, and uncertain. Common three-dimensional chaotic systems include Lorenz and Chen.In 1999, Professor Chen and Ueta of Houston University put forward the chaotic system [7]. Its equations are defined is given in formula (1).When the parameters are givena=35,b=3,c∈20,28.4, Chen’s chaotic model presents a chaotic state. It is similar to the Lorenz chaotic model but has a more complex topological structure than the Lorenz chaotic model. Therefore, Chen’s chaotic model is widely used in the encryption field. This paper chooses Chen’s chaos to generate the initial key sequence:(1)x˙=ay−x,y˙=c−ax−xz+cy,z˙=xy−bz.


### 2.2. BiLSTM Neural Network

The encryption scheme proposed in this paper can predict the initial sequence generated by a chaotic system based on an arbitrary recurrent neural network. At this place, we choose bidirectional long-short term memory (BiLSTM). BiLSTM is a deep learning model developed based on long-short term memory (LSTM), which realizes more training by traversing the input data twice [8]. It is principally composed of forwarding and backward LSTM. Each time point contains an LSTM unit for selective memory, and forgetting and output information. The LSTM cell formula can be represented as follows:(2)It=σWi⋅ht−1,xt+bi,Ft=σWf⋅ht−1,xt+bf,Ot=σWo⋅ht−1,xt+bo,Ht=Ot∗tanhCt,Ct=Ft∗Ct−1+It∗C˜t,C˜t=tanhWc⋅ht−1,xt+bc.BiLSTM splices the output of forwarding LSTM and backward LSTM at timest−1, t, t + 1, etc. Because it can use past time and subsequent time to forecast at the same time, it can provide a better prediction effect than LSTM.


### 2.3. Arnold Transformation

Arnold transformation, also known as cat mapping, was first introduced by Russian mathematician Vladimir Arnold in the study of ergodic theory. This transformation involves recutting and splicing the matrix of digital images [9].The two-dimensional Arnold transformation of a digital image withM = N (equal length and width) is defined as(3)xn+1yn+1=1baab+1xnynmodN.In formula (3), xn,yn represents the position of pixels in the digital image before the transformation. xn+1,yn+1 indicates the position of the transformed pixels. a,b are parameters. n represents the number of current transformations. N is the length or width of the image. Mod− represents modular operations.


### 2.4. The Proposed Block Embedding Algorithm

#### 2.4.1. Theoretical Derivation

A good image encryption algorithm should have statistical characteristics like low correlation and high entropy. Hosny et al. obtained encrypted images with negative correlation and high entropy by chunking and scrambling the three-color subimages of color images and mapping them with one-dimensional chaotic logic maps [10]. Wang et al. employed the improved zigzag method to scramble the subimages after the color image was chunked, and the combination with the chaotic system made the encrypted image more difficult to crack [11]. Younes and Aman experimentally demonstrated that this method can effectively reduce the correlation between the pixels of the encrypted image by dividing the original image into an arbitrary number of blocks [12].After summarizing the above research results, we can infer that according to the characteristics of the three-color channel of the color image, the channel split of the color image and the chaos of the split subgraph can theoretically and effectively reduce the correlation of adjacent pixels of the image and weaken the structure of the initial image, thereby improving the security of the encryption scheme. As a result, we designed a key embedding method, which mainly embeds the generated key matrix into various regions of different color channels in blocks. The specific embedding idea is shown in Figure2.Figure 2
Schematic diagram of three-color channel block embedding key.To simplify the explanation, we used the 7∗ 7 matrix as an example in Figure 1. After splitting the color image with uniform length and width into R, G, and B color matrices, the key sequences xPred,yPred,zPred with a length is M=NM−modM,10 predicted by the deep learning model. The key sequences and the R matrix, G matrix, and B matrix of M ∗ N start from the elements in the upper left corner, lower right corner, and intermediate position, respectively and carry out XOR operation one by one according to the direction sequences marked in the figure. At the last moment, the matrix data are obtained after embedding the key (Algorithm 1).


#### 2.4.2. Pseudocode for the Proposed Block Embedding Algorithm

Algorithm 1: Pseudocode of the proposed block embedding algorithm.
Input: R, G, B channels of image F and keysxPred,yPred,zPredOutput: matrix e_Im.Step 1: the R channel is embedded usingxPred.Fori=1:lenForj=1:lenTemp=Ri,jRi,j=Temp⊕xPredjEndEndStep 2: the G channel is embedded usingyPred.Fori=1:lenForj=1:lenTemp=GG_Size1−i+1,G_Size1−j+1GG_Size1−i+1,G_Size1−j+1=Temp⊕yPredjEndEndStep 3: the B channel is embedded usingzPred.M=modB_Size1,10Mcoord=M/2Fori=1:lenForj=1:lenTemp=Bi+Mcoord,j+McoordBi+Mcoord,j+Mcoord=Temp⊕zPredjEndEndStep 4: the matrix e_Im is obtained by concatenating the three-color channelsStep 5: encapsulate it as an embedding method and name itembedKey


### 2.5. The proposed encryption schemes

#### 2.5.1. Theory and Steps

Deep learning refers to artificial neural networks (ANNs) with complex multilayers [13]. LSTM is a specific recurrent neural network (RNN) that solves the long-term dependency problem on RNN [14] so that it can achieve good predictive performance at large time intervals. There have been studies to apply LSTM to the prediction of chaotic time series. Sangiorgio and Dercole have experimentally checked that LSTM networks are superior to feed-forward competitors in predicting chaotic time series and have good robustness [15]. BiLSTM is formed by a combination of LSTMs in the forward and backward directions, which can be seen as a two-layer neural network.From the above research results, it can be perceived that is theoretically effective to generate robust chaotic sequences using BiLSTM. In the actual application scenario, even if the chaotic system that generates the initial key is cracked by the attacker. The attacker cannot get the final encryption key by reverse inference of the deep learning model. It improves the security of the encryption scheme to a certain extent and can resist some common image attacks.In the process of using deep learning for color image encryption research, we found there is a certain contradiction between the two aspects of reducing the difficulty of use in actual scenes while being both secure and at the same time. To this end, we have introduced our design of the block embedding method to reduce complex calculations while ensuring the safety and robustness of the algorithm.The encryption scheme proposed in this paper represents a process of splitting the color image into R, G, and B color matrices, predicting and generating three new chaotic key sequences by BiLSTM, embedding the key sequences into the three-color matrices in blocks, and generating the final encrypted image by scrambling and diffusion. The main encryption process (see Figure3) and the specific encryption steps are as follows (Algorithm 2):(1)
CauseThe original imageF and its size be M∗NM=N. Given the initial value x0,y0,z0 of the Chen chaotic system, the initial chaotic sequences x,y,z are obtained.(2)
The initial chaotic sequencesX,Y,Z with length s are intercepted as the dataset of BiLSTM, and the parameters of the deep learning model are set to generate the predicted sequences xPred,yPred,zPred.(3)
The imageF is divided into three-color matrices R, G, and B. The sequences xPred,yPred,zPred are embedded into the three-color matrices by using the block embedding algorithm (see the section Block Embedding). The embedded matrix EIm is obtained.(4)
Given two pseudo-random integersn1,n2 with the range of values 0,255, the EIm is transformed by n1 Arnold transformation to obtain the color matrices SR,SG,SB after the first scrambling.(5)
After splicing the initial chaotic sequencesx,y,z and the predicted sequences xPred,yPred,zPred, the new sequences x′,y′,z′ are gained awarding to(4)x′,y′,z′=modfloorx+xPred,y+yPred,z+zPred∗216,256.The sequencesx′,y′,z′ are used for forwarding diffusion and reverse diffusion of the three-color matrices SR,SG,SB according to formula (5). On that occasion, the diffused matrices R′,G′,B′ are obtained as(5)R′=RFi=RFi−1⊕xi′⊕SRiRBi=RBi+1⊕yi′⊕RFi,G′=GFi=GFi−1⊕xi′⊕SGiGBi=GBi+1⊕zi′⊕GFi,B′=BFi=BFi−1⊕yi′⊕SBiBBi=BBi+1⊕zi′⊕BFi.(6)
n2 Arnold transformations are carried out on the matrices R′,G′,B′, and the final encrypted image E is obtained by splicing the transformed three matrices.Figure 3
Flow chart of the encryption scheme.


#### 2.5.2. Pseudocode for the Proposed Image Encryption Algorithm

Algorithm 2: Pseudocode of the proposed image encryption algorithm.
Input: original image FOutput: encrypted image E and keysxPred,yPred,zPred,x′,y′,z′Step 1:x,y,z=Chenx0,y0,z0Step 2:X,Y,Z=x,y,z1:sxPred,yPred,zPred=BiLSTMX,Y,ZStep 3: getEIm using the custom embedding method embedKeyEIm=embedKeyF,xPred,yPred,zPredStep 4:SR,SG,SB=ARTEIM1,2,3,n1Step 5: the matrixR′,G′,B′ after diffusion is obtained by using x′,y′,z′ to diffuse SR,SG,SB in the forward and backward direction asx′,y′,z′=modfloorx+xPred,y+yPred,z+zPred∗216,256RF1=0⊕x1′⊕SR1Fori=2:M∗NRFi=RFi−1⊕xi′⊕SRiEndRBM∗N=0⊕yM∗N'⊕RFM∗NFori=M∗N−1:−1:1RBi=RBi+1⊕yi′⊕RFiEndR′=reshapeRB,M,N……Step 6:E=ARTR′,G′,B′,n2


### 2.6. Decryption Scheme

The decryption scheme in this paper represents the reverse process of an encryption scheme. The detailed steps of the decryption scheme remain as follows (Algorithm3):(1)
Performingn2 inverse Arnold transforms an encrypted image E to obtain a diffusion image(2)
After antidiffusion of the diffusion image, then1 inverse Arnold transform is carried out to obtain the embedded image reEIm(3)
After the inverse operation of the embedded image, the restored imagereF is obtained


#### 2.6.1. Pseudocode for the Image Decryption Algorithm

Algorithm 3: Pseudocode of the image decryption algorithm.
Input: encrypted image E and keysxPred,yPred,zPred,x′,y′,z′Output: restored imagereFStep 1:reR′,reB′,reG′=reARTE1,2,3,n2Step 2: perform diffusion recovery.RDM∗N=0⊕yM∗N'⊕reRM∗N'Fori=M∗N−1:−1:1RDi=reRi+1'⊕yi′⊕reRi′EndRE1=0⊕x1′⊕RD1Fori=2:M∗NREi=RDi−1⊕xi′⊕RDiEndRE=reshapeRE,M,N……Step 3:reEIm=reARTRE,RG,RB,n1Step 4:reF=embedKeyreEIm,xPred,yPred,zPred


## 2.1. Chen’s Chaotic System

A chaotic system means there are seemingly erratic irregular movements in a certain way which are nonrepeatable, unpredictable, and uncertain. Common three-dimensional chaotic systems include Lorenz and Chen.In 1999, Professor Chen and Ueta of Houston University put forward the chaotic system [7]. Its equations are defined is given in formula (1).When the parameters are givena=35,b=3,c∈20,28.4, Chen’s chaotic model presents a chaotic state. It is similar to the Lorenz chaotic model but has a more complex topological structure than the Lorenz chaotic model. Therefore, Chen’s chaotic model is widely used in the encryption field. This paper chooses Chen’s chaos to generate the initial key sequence:(1)x˙=ay−x,y˙=c−ax−xz+cy,z˙=xy−bz.


## 2.2. BiLSTM Neural Network

The encryption scheme proposed in this paper can predict the initial sequence generated by a chaotic system based on an arbitrary recurrent neural network. At this place, we choose bidirectional long-short term memory (BiLSTM). BiLSTM is a deep learning model developed based on long-short term memory (LSTM), which realizes more training by traversing the input data twice [8]. It is principally composed of forwarding and backward LSTM. Each time point contains an LSTM unit for selective memory, and forgetting and output information. The LSTM cell formula can be represented as follows:(2)It=σWi⋅ht−1,xt+bi,Ft=σWf⋅ht−1,xt+bf,Ot=σWo⋅ht−1,xt+bo,Ht=Ot∗tanhCt,Ct=Ft∗Ct−1+It∗C˜t,C˜t=tanhWc⋅ht−1,xt+bc.BiLSTM splices the output of forwarding LSTM and backward LSTM at timest−1, t, t + 1, etc. Because it can use past time and subsequent time to forecast at the same time, it can provide a better prediction effect than LSTM.


## 2.3. Arnold Transformation

Arnold transformation, also known as cat mapping, was first introduced by Russian mathematician Vladimir Arnold in the study of ergodic theory. This transformation involves recutting and splicing the matrix of digital images [9].The two-dimensional Arnold transformation of a digital image withM = N (equal length and width) is defined as(3)xn+1yn+1=1baab+1xnynmodN.In formula (3), xn,yn represents the position of pixels in the digital image before the transformation. xn+1,yn+1 indicates the position of the transformed pixels. a,b are parameters. n represents the number of current transformations. N is the length or width of the image. Mod− represents modular operations.


## 2.4. The Proposed Block Embedding Algorithm

### 2.4.1. Theoretical Derivation

A good image encryption algorithm should have statistical characteristics like low correlation and high entropy. Hosny et al. obtained encrypted images with negative correlation and high entropy by chunking and scrambling the three-color subimages of color images and mapping them with one-dimensional chaotic logic maps [10]. Wang et al. employed the improved zigzag method to scramble the subimages after the color image was chunked, and the combination with the chaotic system made the encrypted image more difficult to crack [11]. Younes and Aman experimentally demonstrated that this method can effectively reduce the correlation between the pixels of the encrypted image by dividing the original image into an arbitrary number of blocks [12].After summarizing the above research results, we can infer that according to the characteristics of the three-color channel of the color image, the channel split of the color image and the chaos of the split subgraph can theoretically and effectively reduce the correlation of adjacent pixels of the image and weaken the structure of the initial image, thereby improving the security of the encryption scheme. As a result, we designed a key embedding method, which mainly embeds the generated key matrix into various regions of different color channels in blocks. The specific embedding idea is shown in Figure2.Figure 2
Schematic diagram of three-color channel block embedding key.To simplify the explanation, we used the 7∗ 7 matrix as an example in Figure 1. After splitting the color image with uniform length and width into R, G, and B color matrices, the key sequences xPred,yPred,zPred with a length is M=NM−modM,10 predicted by the deep learning model. The key sequences and the R matrix, G matrix, and B matrix of M ∗ N start from the elements in the upper left corner, lower right corner, and intermediate position, respectively and carry out XOR operation one by one according to the direction sequences marked in the figure. At the last moment, the matrix data are obtained after embedding the key (Algorithm 1).


### 2.4.2. Pseudocode for the Proposed Block Embedding Algorithm

Algorithm 1: Pseudocode of the proposed block embedding algorithm.
Input: R, G, B channels of image F and keysxPred,yPred,zPredOutput: matrix e_Im.Step 1: the R channel is embedded usingxPred.Fori=1:lenForj=1:lenTemp=Ri,jRi,j=Temp⊕xPredjEndEndStep 2: the G channel is embedded usingyPred.Fori=1:lenForj=1:lenTemp=GG_Size1−i+1,G_Size1−j+1GG_Size1−i+1,G_Size1−j+1=Temp⊕yPredjEndEndStep 3: the B channel is embedded usingzPred.M=modB_Size1,10Mcoord=M/2Fori=1:lenForj=1:lenTemp=Bi+Mcoord,j+McoordBi+Mcoord,j+Mcoord=Temp⊕zPredjEndEndStep 4: the matrix e_Im is obtained by concatenating the three-color channelsStep 5: encapsulate it as an embedding method and name itembedKey


## 2.4.1. Theoretical Derivation

A good image encryption algorithm should have statistical characteristics like low correlation and high entropy. Hosny et al. obtained encrypted images with negative correlation and high entropy by chunking and scrambling the three-color subimages of color images and mapping them with one-dimensional chaotic logic maps [10]. Wang et al. employed the improved zigzag method to scramble the subimages after the color image was chunked, and the combination with the chaotic system made the encrypted image more difficult to crack [11]. Younes and Aman experimentally demonstrated that this method can effectively reduce the correlation between the pixels of the encrypted image by dividing the original image into an arbitrary number of blocks [12].After summarizing the above research results, we can infer that according to the characteristics of the three-color channel of the color image, the channel split of the color image and the chaos of the split subgraph can theoretically and effectively reduce the correlation of adjacent pixels of the image and weaken the structure of the initial image, thereby improving the security of the encryption scheme. As a result, we designed a key embedding method, which mainly embeds the generated key matrix into various regions of different color channels in blocks. The specific embedding idea is shown in Figure2.Figure 2
Schematic diagram of three-color channel block embedding key.To simplify the explanation, we used the 7∗ 7 matrix as an example in Figure 1. After splitting the color image with uniform length and width into R, G, and B color matrices, the key sequences xPred,yPred,zPred with a length is M=NM−modM,10 predicted by the deep learning model. The key sequences and the R matrix, G matrix, and B matrix of M ∗ N start from the elements in the upper left corner, lower right corner, and intermediate position, respectively and carry out XOR operation one by one according to the direction sequences marked in the figure. At the last moment, the matrix data are obtained after embedding the key (Algorithm 1).


## 2.4.2. Pseudocode for the Proposed Block Embedding Algorithm

Algorithm 1: Pseudocode of the proposed block embedding algorithm.
Input: R, G, B channels of image F and keysxPred,yPred,zPredOutput: matrix e_Im.Step 1: the R channel is embedded usingxPred.Fori=1:lenForj=1:lenTemp=Ri,jRi,j=Temp⊕xPredjEndEndStep 2: the G channel is embedded usingyPred.Fori=1:lenForj=1:lenTemp=GG_Size1−i+1,G_Size1−j+1GG_Size1−i+1,G_Size1−j+1=Temp⊕yPredjEndEndStep 3: the B channel is embedded usingzPred.M=modB_Size1,10Mcoord=M/2Fori=1:lenForj=1:lenTemp=Bi+Mcoord,j+McoordBi+Mcoord,j+Mcoord=Temp⊕zPredjEndEndStep 4: the matrix e_Im is obtained by concatenating the three-color channelsStep 5: encapsulate it as an embedding method and name itembedKey


## 2.5. The proposed encryption schemes

### 2.5.1. Theory and Steps

Deep learning refers to artificial neural networks (ANNs) with complex multilayers [13]. LSTM is a specific recurrent neural network (RNN) that solves the long-term dependency problem on RNN [14] so that it can achieve good predictive performance at large time intervals. There have been studies to apply LSTM to the prediction of chaotic time series. Sangiorgio and Dercole have experimentally checked that LSTM networks are superior to feed-forward competitors in predicting chaotic time series and have good robustness [15]. BiLSTM is formed by a combination of LSTMs in the forward and backward directions, which can be seen as a two-layer neural network.From the above research results, it can be perceived that is theoretically effective to generate robust chaotic sequences using BiLSTM. In the actual application scenario, even if the chaotic system that generates the initial key is cracked by the attacker. The attacker cannot get the final encryption key by reverse inference of the deep learning model. It improves the security of the encryption scheme to a certain extent and can resist some common image attacks.In the process of using deep learning for color image encryption research, we found there is a certain contradiction between the two aspects of reducing the difficulty of use in actual scenes while being both secure and at the same time. To this end, we have introduced our design of the block embedding method to reduce complex calculations while ensuring the safety and robustness of the algorithm.The encryption scheme proposed in this paper represents a process of splitting the color image into R, G, and B color matrices, predicting and generating three new chaotic key sequences by BiLSTM, embedding the key sequences into the three-color matrices in blocks, and generating the final encrypted image by scrambling and diffusion. The main encryption process (see Figure3) and the specific encryption steps are as follows (Algorithm 2):(1)
CauseThe original imageF and its size be M∗NM=N. Given the initial value x0,y0,z0 of the Chen chaotic system, the initial chaotic sequences x,y,z are obtained.(2)
The initial chaotic sequencesX,Y,Z with length s are intercepted as the dataset of BiLSTM, and the parameters of the deep learning model are set to generate the predicted sequences xPred,yPred,zPred.(3)
The imageF is divided into three-color matrices R, G, and B. The sequences xPred,yPred,zPred are embedded into the three-color matrices by using the block embedding algorithm (see the section Block Embedding). The embedded matrix EIm is obtained.(4)
Given two pseudo-random integersn1,n2 with the range of values 0,255, the EIm is transformed by n1 Arnold transformation to obtain the color matrices SR,SG,SB after the first scrambling.(5)
After splicing the initial chaotic sequencesx,y,z and the predicted sequences xPred,yPred,zPred, the new sequences x′,y′,z′ are gained awarding to(4)x′,y′,z′=modfloorx+xPred,y+yPred,z+zPred∗216,256.The sequencesx′,y′,z′ are used for forwarding diffusion and reverse diffusion of the three-color matrices SR,SG,SB according to formula (5). On that occasion, the diffused matrices R′,G′,B′ are obtained as(5)R′=RFi=RFi−1⊕xi′⊕SRiRBi=RBi+1⊕yi′⊕RFi,G′=GFi=GFi−1⊕xi′⊕SGiGBi=GBi+1⊕zi′⊕GFi,B′=BFi=BFi−1⊕yi′⊕SBiBBi=BBi+1⊕zi′⊕BFi.(6)
n2 Arnold transformations are carried out on the matrices R′,G′,B′, and the final encrypted image E is obtained by splicing the transformed three matrices.Figure 3
Flow chart of the encryption scheme.


### 2.5.2. Pseudocode for the Proposed Image Encryption Algorithm

Algorithm 2: Pseudocode of the proposed image encryption algorithm.
Input: original image FOutput: encrypted image E and keysxPred,yPred,zPred,x′,y′,z′Step 1:x,y,z=Chenx0,y0,z0Step 2:X,Y,Z=x,y,z1:sxPred,yPred,zPred=BiLSTMX,Y,ZStep 3: getEIm using the custom embedding method embedKeyEIm=embedKeyF,xPred,yPred,zPredStep 4:SR,SG,SB=ARTEIM1,2,3,n1Step 5: the matrixR′,G′,B′ after diffusion is obtained by using x′,y′,z′ to diffuse SR,SG,SB in the forward and backward direction asx′,y′,z′=modfloorx+xPred,y+yPred,z+zPred∗216,256RF1=0⊕x1′⊕SR1Fori=2:M∗NRFi=RFi−1⊕xi′⊕SRiEndRBM∗N=0⊕yM∗N'⊕RFM∗NFori=M∗N−1:−1:1RBi=RBi+1⊕yi′⊕RFiEndR′=reshapeRB,M,N……Step 6:E=ARTR′,G′,B′,n2


## 2.5.1. Theory and Steps

Deep learning refers to artificial neural networks (ANNs) with complex multilayers [13]. LSTM is a specific recurrent neural network (RNN) that solves the long-term dependency problem on RNN [14] so that it can achieve good predictive performance at large time intervals. There have been studies to apply LSTM to the prediction of chaotic time series. Sangiorgio and Dercole have experimentally checked that LSTM networks are superior to feed-forward competitors in predicting chaotic time series and have good robustness [15]. BiLSTM is formed by a combination of LSTMs in the forward and backward directions, which can be seen as a two-layer neural network.From the above research results, it can be perceived that is theoretically effective to generate robust chaotic sequences using BiLSTM. In the actual application scenario, even if the chaotic system that generates the initial key is cracked by the attacker. The attacker cannot get the final encryption key by reverse inference of the deep learning model. It improves the security of the encryption scheme to a certain extent and can resist some common image attacks.In the process of using deep learning for color image encryption research, we found there is a certain contradiction between the two aspects of reducing the difficulty of use in actual scenes while being both secure and at the same time. To this end, we have introduced our design of the block embedding method to reduce complex calculations while ensuring the safety and robustness of the algorithm.The encryption scheme proposed in this paper represents a process of splitting the color image into R, G, and B color matrices, predicting and generating three new chaotic key sequences by BiLSTM, embedding the key sequences into the three-color matrices in blocks, and generating the final encrypted image by scrambling and diffusion. The main encryption process (see Figure3) and the specific encryption steps are as follows (Algorithm 2):(1)
CauseThe original imageF and its size be M∗NM=N. Given the initial value x0,y0,z0 of the Chen chaotic system, the initial chaotic sequences x,y,z are obtained.(2)
The initial chaotic sequencesX,Y,Z with length s are intercepted as the dataset of BiLSTM, and the parameters of the deep learning model are set to generate the predicted sequences xPred,yPred,zPred.(3)
The imageF is divided into three-color matrices R, G, and B. The sequences xPred,yPred,zPred are embedded into the three-color matrices by using the block embedding algorithm (see the section Block Embedding). The embedded matrix EIm is obtained.(4)
Given two pseudo-random integersn1,n2 with the range of values 0,255, the EIm is transformed by n1 Arnold transformation to obtain the color matrices SR,SG,SB after the first scrambling.(5)
After splicing the initial chaotic sequencesx,y,z and the predicted sequences xPred,yPred,zPred, the new sequences x′,y′,z′ are gained awarding to(4)x′,y′,z′=modfloorx+xPred,y+yPred,z+zPred∗216,256.The sequencesx′,y′,z′ are used for forwarding diffusion and reverse diffusion of the three-color matrices SR,SG,SB according to formula (5). On that occasion, the diffused matrices R′,G′,B′ are obtained as(5)R′=RFi=RFi−1⊕xi′⊕SRiRBi=RBi+1⊕yi′⊕RFi,G′=GFi=GFi−1⊕xi′⊕SGiGBi=GBi+1⊕zi′⊕GFi,B′=BFi=BFi−1⊕yi′⊕SBiBBi=BBi+1⊕zi′⊕BFi.(6)
n2 Arnold transformations are carried out on the matrices R′,G′,B′, and the final encrypted image E is obtained by splicing the transformed three matrices.Figure 3
Flow chart of the encryption scheme.


## 2.5.2. Pseudocode for the Proposed Image Encryption Algorithm

Algorithm 2: Pseudocode of the proposed image encryption algorithm.
Input: original image FOutput: encrypted image E and keysxPred,yPred,zPred,x′,y′,z′Step 1:x,y,z=Chenx0,y0,z0Step 2:X,Y,Z=x,y,z1:sxPred,yPred,zPred=BiLSTMX,Y,ZStep 3: getEIm using the custom embedding method embedKeyEIm=embedKeyF,xPred,yPred,zPredStep 4:SR,SG,SB=ARTEIM1,2,3,n1Step 5: the matrixR′,G′,B′ after diffusion is obtained by using x′,y′,z′ to diffuse SR,SG,SB in the forward and backward direction asx′,y′,z′=modfloorx+xPred,y+yPred,z+zPred∗216,256RF1=0⊕x1′⊕SR1Fori=2:M∗NRFi=RFi−1⊕xi′⊕SRiEndRBM∗N=0⊕yM∗N'⊕RFM∗NFori=M∗N−1:−1:1RBi=RBi+1⊕yi′⊕RFiEndR′=reshapeRB,M,N……Step 6:E=ARTR′,G′,B′,n2


## 2.6. Decryption Scheme

The decryption scheme in this paper represents the reverse process of an encryption scheme. The detailed steps of the decryption scheme remain as follows (Algorithm3):(1)
Performingn2 inverse Arnold transforms an encrypted image E to obtain a diffusion image(2)
After antidiffusion of the diffusion image, then1 inverse Arnold transform is carried out to obtain the embedded image reEIm(3)
After the inverse operation of the embedded image, the restored imagereF is obtained


### 2.6.1. Pseudocode for the Image Decryption Algorithm

Algorithm 3: Pseudocode of the image decryption algorithm.
Input: encrypted image E and keysxPred,yPred,zPred,x′,y′,z′Output: restored imagereFStep 1:reR′,reB′,reG′=reARTE1,2,3,n2Step 2: perform diffusion recovery.RDM∗N=0⊕yM∗N'⊕reRM∗N'Fori=M∗N−1:−1:1RDi=reRi+1'⊕yi′⊕reRi′EndRE1=0⊕x1′⊕RD1Fori=2:M∗NREi=RDi−1⊕xi′⊕RDiEndRE=reshapeRE,M,N……Step 3:reEIm=reARTRE,RG,RB,n1Step 4:reF=embedKeyreEIm,xPred,yPred,zPred


## 2.6.1. Pseudocode for the Image Decryption Algorithm

Algorithm 3: Pseudocode of the image decryption algorithm.
Input: encrypted image E and keysxPred,yPred,zPred,x′,y′,z′Output: restored imagereFStep 1:reR′,reB′,reG′=reARTE1,2,3,n2Step 2: perform diffusion recovery.RDM∗N=0⊕yM∗N'⊕reRM∗N'Fori=M∗N−1:−1:1RDi=reRi+1'⊕yi′⊕reRi′EndRE1=0⊕x1′⊕RD1Fori=2:M∗NREi=RDi−1⊕xi′⊕RDiEndRE=reshapeRE,M,N……Step 3:reEIm=reARTRE,RG,RB,n1Step 4:reF=embedKeyreEIm,xPred,yPred,zPred


## 3. Simulation Experiment Results and Analysis

A good encryption scheme should consider good statistical characteristics of digital images, good robustness against common image attacks, and an enormous key space. In this paper, MATLAB is used to simulate the proposed encryption scheme. Through the analysis and discussion of the experimental results, it has been proved that the scheme can effectively encrypt and decrypt color images.The main pictures used in this section come from the open-source website (https://sipi.usc.edu/database/). The image sizes are 256 ∗ 256, 512 ∗ 512, and 1024 ∗ 1024, respectively. The encryption and decryption effects of the three groups of experimental color images (see Figure 4).Figure 4
Experimental results of color image encryption and decryption. Image (a) is a color house original of 256∗ 256, (b) is an encrypted image of (a), and (c) is a decrypted image of (b). Image (d) is the original color monkey image of 512 ∗ 512, (e) is the encrypted image of (d), and (f) is the decrypted image of (e). Image (g) is an original color map of 1024 ∗ 1024, (h) is an encrypted image of (g), and (i) is a decrypted image of (h).


### 3.1. Statistical Characteristic Analysis

#### 3.1.1. Histogram

An image histogram obtains a graphical expression to reflect the intensity distribution of pixels in the image. Putting differently, it is to count the number of each pixel block in the image, which reflects the most essential statistical characteristics of the image [16]. The flatter the histogram drawn by encrypting the image, the more uniform the pixel value distribution in the image, the smaller the analysis space left for attackers and the better the encryption performance of the image.In this paper, three groups of experimental objects are encrypted, and the encrypted images are tested by histogram. The results are shown in Figure5. From the histogram test results, we can observe the encryption scheme proposed in this paper, make the pixel distribution in the encrypted image become uniform, and effectively reduce the analysis space of attackers.Figure 5
Color image encryption and decryption histogram. Image (a) is displayed as a color house image, image (b) is a histogram of (a), image (c) is an encrypted image of (a), and image (d) is a histogram of (c). Image (e) is displayed as a color monkey image, image (f) is a histogram of (e), image (g) is an encrypted image of (e), and image (h) is a histogram of (g). Image (i) is a color map image, image (j) is a histogram of (i), image (k) is an encrypted graph of (i), and image (l) is a histogram of (k).


#### 3.1.2. Adjacent Pixel Correlation

Adjacent pixel correlation refers to the relationship diagram between adjacent pixels drawn by randomly selecting N pixels in an image and using the pixel values of two adjacent pixels as horizontal and vertical coordinates, respectively. The more the points in the graph are that remain concentrated near the diagonal of the coordinate axis, the stronger the correlation between the adjacent pixels of the image is. On the contrary, the more the points in the graph are dispersed in the whole graph, the weaker the correlation between adjacent pixels of the image. A good encryption scheme should be able to effectively reduce the correlation between the adjacent pixels of the image [17]. In the field of image encryption, the correlation analysis of adjacent pixels of encryption schemes is usually carried out from three directions horizontal, vertical, and diagonal.The correlation analysis of adjacent pixels of this encryption scheme is shown in Figure6. Observing the analysis chart, we can see that the correlation between adjacent pixels of the image encrypted by the encryption scheme proposed in this paper is surely reduced after measuring the three directions, i.e., horizontal, vertical and diagonal. We can find that the drawing points are evenly distributed in the whole analysis map, which can effectively resist statistical attacks.Figure 6
Correlation analysis of related pixels of three groups of experimental diagrams. Image (a) is a color house image, and the correlation analysis diagram of “horizontal, vertical and diagonal” adjacent pixels of (a) from left to right. The image (b) is an encrypted image of (a), and the correlation analysis images of adjacent pixels in three directions of (b) are sequentially from left to right. Image (c) is a color monkey image, and the correlation analysis diagram of adjacent pixels in three directions from left to right is (c). The image (d) is an encrypted image of (c), and the correlation analysis images of adjacent pixels in three directions of (d) are sequentially from left to right. The image (e) is a color map image, and the correlation analysis graphs of adjacent pixels in three directions of (e) are arranged from left to right. Image (f) is the encrypted graph of (e) and is the correlation analysis graph of adjacent pixels in the three directions of (f) from left to right.


#### 3.1.3. Correlation Coefficients

To better measure the correlation of adjacent pixels of an encrypted image, the correlation is frequently used to quantitatively describe its size. The specific definitions are as follows:(6)rpq=covp,qDpDq.In Formula (6),(7)Ep=1N∑i=1Npi,Eq=1N∑i=1Nqi,Dp=1N∑i=1Npi−Ep2,Dq=1N∑i=1Nqi−Ep2,covp,q=1N∑i=1Npi−Eppi−Ep,where p and q represent two vectors of adjacent pixels, and rpq show the relational value. The lower the correlation of adjacent pixels, the closer their correlation is to 0.Through simulation experiments (see Table2), the correlation in all three directions is close to zero, indicating that the cryptographic algorithm proposed in this paper has almost no correlation.Table 2
Correlation coefficients of the encrypted Lena image for different methods.
MethodDirectionComponentsHorizontalVerticalDiagonalPlain imageR0.97240.94290.9241G0.97270.94680.9250B0.94630.90120.8638ProposedR−0.00460.00720.0009G−0.00150.0056−0.0125B−0.0091−0.0076−0.0145Ref. [10]R0.00640.0160−0.0026G0.00090.00340.0125B0.0091−0.0045−0.0090Ref. [18]R−0.0112−0.00260.0052G0.00500.0199−0.0064B−0.01790.0120−0.0161Ref. [19]R0.00140.00480.0002G0.0033−0.00060.0048B0.00210.0002−0.0040Ref. [20]R−0.00700.0049−0.0083G−0.00760.00620.0032B0.0047−0.0025−0.0058


#### 3.1.4. Information Entropy

Information entropy is mainly used in the field of image processing to describe the information contained in an image, that is, the distribution of grayscale values in an image. Its formula is defined as(8)Hx=−∑i=1npxlog2pxi,where pxi represents the frequency with which grayscale x occurs.The closer the value of the information entropy is to eight, the more uniform the distribution is. By comparing with other studies (see Table3), it can be discovered that after employing the scheme proposed here, the encrypted image possesses a marked degree of randomness.Table 3
Information entropy of the encrypted Lena image for different methods.
MethodRedGreenBlueAverageProposed7.99167.99137.99197.9916Ref. [10]7.99747.99767.99747.9975Ref. [18]7.98957.98947.98947.9894Ref. [19]7.99177.99127.99187.9916Ref. [20]7.99917.99937.99937.9992


### 3.2. Robustness Analysis

As we all know, there may be various situations like information loss and attack in the process of image transmission [21]. A robust encryption scheme should be able to resist various common image attacks to a certain extent and should ensure the information missing or contaminated encrypted images can still obtain the main information of the original image through decryption.


#### 3.2.1. Cropping Attack

Cropping attack refers to dividing the image, which causes the image yield some information. In image encryption, part of the encrypted image is cut and then decrypted, and the decrypted reconstructed image is compared with the original plaintext image [22].We tested 25% and 50% cut attacks on three groups of experimental pictures with different resolutions and the test results (see Figure7). From the experimental results, we can see that the encryption scheme can still display the main image information after the clipping attack which proves that the encryption scheme possesses good resistance to the clipping attack.Figure 7
Cropping attack analysis diagram. Image (a) is color house image, (b) is a result map of 25% clipping of the encrypted map (a), (c) is a decryption map of (b), (d) is a result map of 50% clipping of the encrypted map (a), and (e) is a decryption map of (d). Image (f) is color monkey original image, (g) is a result image of 25% cutting of the encrypted image (f), (h) is a decryption image of (g), (i) is a result image of 50% cutting of the encrypted image (f), and (j) is a decryption image of (i). The image (k) is color map image, (l) is a result map of 25% cropping of the encrypted map (k), (m) is a decryption map of (l), (n) is a result map of 50% cropping of the encrypted map (k), and (o) is a decryption map of (n).


#### 3.2.2. Gaussian Noise Attack

Images are always degraded by some senseless error, which is called noise. The ideal noise is considered as white noise, which appears at the same intensity at all frequencies. As a particular case of white noise, Gaussian noise can be used to approximate the noise in many real scenes.In this paper, three groups of experimental images are decrypted by adding 0.08 and 0.2 Gaussian white noise, respectively. The experimental results are shown in Figure8. It can be noted from the diagram that the resulting diagram encrypted by this encryption scheme can obtain the main information of the original image through decryption even if it is polluted by noise, which has good robustness to noise attack.Figure 8
Gaussian noise attack analysis diagram. Image (a) is color house image, (b) is a result image of adding density 0.08 Gaussian noise to the encrypted image (a), (c) is a decryption image of (b), (d) is a result image of adding density 0.2 Gaussian noise to the encrypted image (a), and (e) is a decryption image of (d). Image (f) is color monkey image, (g) is a result image of adding density 0.08 Gaussian noise to (f), (h) is a decryption image of (g), (i) is a result image of adding density 0.2 Gaussian noise to (f), and (j) is a decryption image of (i). The image (k) is color map image, (l) is a result image of adding a density of 0.08 Gaussian noise to the encrypted image (k), (m) is a decryption image of (l), (n) is a result image of adding a density of 0.2 Gaussian noise to the encrypted image (k), and (o) is a decryption image of (n).


### 3.3. Encryption Performance Analysis

#### 3.3.1. Peak Signal-to-Noise Ratio

The peak signal-to-noise ratio (PSNR) measures the maximum signal-to-noise ratio on a signal and is typically used for image and video signals. PSNR is calculated using the following formula:(9)PSNRdB=N×MAX2∑n=1NXn−Yn2,where N is the total number of samples in the signal, MAX is the maximum possible value of the sample, Xn corresponds to the nth sample of the original signal X, and Yn represents the nth sample of the encrypted signal Y.PSNR is a measure of the difference in peak error between two images. For ideally similar images, PSNR is infinite, and for completely different images, its value is zero. The PSNR of the images was encrypted implementing the algorithm proposed in this paper and is calculated together with the original images (see Table4), and it is found that their values are lower than the PSNR values calculated by other research schemes, which proves that the images encrypted by the algorithm in this paper are quite different from the original images, and the algorithm has good encryption performance.Table 4
PSNR of the Lena image for different methods.
MethodProposedRef. [23]Ref. [24]Ref. [25]PSNR7.19547.63248.62587.6714


#### 3.3.2. Key Space Analysis

The space size of the encryption key affects the encryption performance of the encryption scheme. A robust image encryption scheme has a requirement of a sufficiently large key space [26]. It can be seen from the above that in the encryption scheme of this paper, we got six encryption keys. When M = N, we obtain the length of xPred,yPred,zPred, respectively:(10)lenxPred,yPred,zPred=M−modM,10.Meanwhile, the key length ofx′,y′,z′ can be expressed as(11)lenx′,y′,z′=ceilM∗N1000∗1000+1.From what has been mentioned above, we can conclude that the key space size is(12)M−modM,103∗ceilM∗N1000∗1000+13.According to formula (12), we calculate the key space of three groups of experimental graphs, and the results are 4.4923∗1021,2.4131∗1024,1.225∗1027 that are all greater than 270. Experimental results show that this encryption scheme has large key space and high security.


#### 3.3.3. Time Complexity

Time complexity, as a function, is consumed to qualitatively describe the running time of the algorithm and is an important indicator to measure the quality of the algorithm. The common letter O is employed to denote and does not include the low-order term and the first-term coefficient of the function.The algorithm proposed in this paper mainly encrypts images with equal lengths and widths, assuming the length and width of the images representn. The chaotic system is operated to generate the initial key sequence as needed 1/1000n2. At the same moment, we estimate the time complexity of the deep learning model as 1 based on its training theory. The proposed embedding key method in this paper requiresn2. Scrambling and diffusion algorithms are required in the schemes 3xn2x∈0,255 and 6n2, respectively.Composing the previous estimates, we can conclude that the time complexity function formula for the cryptographic algorithm proposed in this article is(13)10017+3x1000n2+1.Formula (13) is simplified by order of magnitude to give the time complexity of the cryptographic algorithm presented On2 herein.


## 3.1. Statistical Characteristic Analysis

### 3.1.1. Histogram

An image histogram obtains a graphical expression to reflect the intensity distribution of pixels in the image. Putting differently, it is to count the number of each pixel block in the image, which reflects the most essential statistical characteristics of the image [16]. The flatter the histogram drawn by encrypting the image, the more uniform the pixel value distribution in the image, the smaller the analysis space left for attackers and the better the encryption performance of the image.In this paper, three groups of experimental objects are encrypted, and the encrypted images are tested by histogram. The results are shown in Figure5. From the histogram test results, we can observe the encryption scheme proposed in this paper, make the pixel distribution in the encrypted image become uniform, and effectively reduce the analysis space of attackers.Figure 5
Color image encryption and decryption histogram. Image (a) is displayed as a color house image, image (b) is a histogram of (a), image (c) is an encrypted image of (a), and image (d) is a histogram of (c). Image (e) is displayed as a color monkey image, image (f) is a histogram of (e), image (g) is an encrypted image of (e), and image (h) is a histogram of (g). Image (i) is a color map image, image (j) is a histogram of (i), image (k) is an encrypted graph of (i), and image (l) is a histogram of (k).


### 3.1.2. Adjacent Pixel Correlation

Adjacent pixel correlation refers to the relationship diagram between adjacent pixels drawn by randomly selecting N pixels in an image and using the pixel values of two adjacent pixels as horizontal and vertical coordinates, respectively. The more the points in the graph are that remain concentrated near the diagonal of the coordinate axis, the stronger the correlation between the adjacent pixels of the image is. On the contrary, the more the points in the graph are dispersed in the whole graph, the weaker the correlation between adjacent pixels of the image. A good encryption scheme should be able to effectively reduce the correlation between the adjacent pixels of the image [17]. In the field of image encryption, the correlation analysis of adjacent pixels of encryption schemes is usually carried out from three directions horizontal, vertical, and diagonal.The correlation analysis of adjacent pixels of this encryption scheme is shown in Figure6. Observing the analysis chart, we can see that the correlation between adjacent pixels of the image encrypted by the encryption scheme proposed in this paper is surely reduced after measuring the three directions, i.e., horizontal, vertical and diagonal. We can find that the drawing points are evenly distributed in the whole analysis map, which can effectively resist statistical attacks.Figure 6
Correlation analysis of related pixels of three groups of experimental diagrams. Image (a) is a color house image, and the correlation analysis diagram of “horizontal, vertical and diagonal” adjacent pixels of (a) from left to right. The image (b) is an encrypted image of (a), and the correlation analysis images of adjacent pixels in three directions of (b) are sequentially from left to right. Image (c) is a color monkey image, and the correlation analysis diagram of adjacent pixels in three directions from left to right is (c). The image (d) is an encrypted image of (c), and the correlation analysis images of adjacent pixels in three directions of (d) are sequentially from left to right. The image (e) is a color map image, and the correlation analysis graphs of adjacent pixels in three directions of (e) are arranged from left to right. Image (f) is the encrypted graph of (e) and is the correlation analysis graph of adjacent pixels in the three directions of (f) from left to right.


### 3.1.3. Correlation Coefficients

To better measure the correlation of adjacent pixels of an encrypted image, the correlation is frequently used to quantitatively describe its size. The specific definitions are as follows:(6)rpq=covp,qDpDq.In Formula (6),(7)Ep=1N∑i=1Npi,Eq=1N∑i=1Nqi,Dp=1N∑i=1Npi−Ep2,Dq=1N∑i=1Nqi−Ep2,covp,q=1N∑i=1Npi−Eppi−Ep,where p and q represent two vectors of adjacent pixels, and rpq show the relational value. The lower the correlation of adjacent pixels, the closer their correlation is to 0.Through simulation experiments (see Table2), the correlation in all three directions is close to zero, indicating that the cryptographic algorithm proposed in this paper has almost no correlation.Table 2
Correlation coefficients of the encrypted Lena image for different methods.
MethodDirectionComponentsHorizontalVerticalDiagonalPlain imageR0.97240.94290.9241G0.97270.94680.9250B0.94630.90120.8638ProposedR−0.00460.00720.0009G−0.00150.0056−0.0125B−0.0091−0.0076−0.0145Ref. [10]R0.00640.0160−0.0026G0.00090.00340.0125B0.0091−0.0045−0.0090Ref. [18]R−0.0112−0.00260.0052G0.00500.0199−0.0064B−0.01790.0120−0.0161Ref. [19]R0.00140.00480.0002G0.0033−0.00060.0048B0.00210.0002−0.0040Ref. [20]R−0.00700.0049−0.0083G−0.00760.00620.0032B0.0047−0.0025−0.0058


### 3.1.4. Information Entropy

Information entropy is mainly used in the field of image processing to describe the information contained in an image, that is, the distribution of grayscale values in an image. Its formula is defined as(8)Hx=−∑i=1npxlog2pxi,where pxi represents the frequency with which grayscale x occurs.The closer the value of the information entropy is to eight, the more uniform the distribution is. By comparing with other studies (see Table3), it can be discovered that after employing the scheme proposed here, the encrypted image possesses a marked degree of randomness.Table 3
Information entropy of the encrypted Lena image for different methods.
MethodRedGreenBlueAverageProposed7.99167.99137.99197.9916Ref. [10]7.99747.99767.99747.9975Ref. [18]7.98957.98947.98947.9894Ref. [19]7.99177.99127.99187.9916Ref. [20]7.99917.99937.99937.9992


## 3.1.1. Histogram

An image histogram obtains a graphical expression to reflect the intensity distribution of pixels in the image. Putting differently, it is to count the number of each pixel block in the image, which reflects the most essential statistical characteristics of the image [16]. The flatter the histogram drawn by encrypting the image, the more uniform the pixel value distribution in the image, the smaller the analysis space left for attackers and the better the encryption performance of the image.In this paper, three groups of experimental objects are encrypted, and the encrypted images are tested by histogram. The results are shown in Figure5. From the histogram test results, we can observe the encryption scheme proposed in this paper, make the pixel distribution in the encrypted image become uniform, and effectively reduce the analysis space of attackers.Figure 5
Color image encryption and decryption histogram. Image (a) is displayed as a color house image, image (b) is a histogram of (a), image (c) is an encrypted image of (a), and image (d) is a histogram of (c). Image (e) is displayed as a color monkey image, image (f) is a histogram of (e), image (g) is an encrypted image of (e), and image (h) is a histogram of (g). Image (i) is a color map image, image (j) is a histogram of (i), image (k) is an encrypted graph of (i), and image (l) is a histogram of (k).


## 3.1.2. Adjacent Pixel Correlation

Adjacent pixel correlation refers to the relationship diagram between adjacent pixels drawn by randomly selecting N pixels in an image and using the pixel values of two adjacent pixels as horizontal and vertical coordinates, respectively. The more the points in the graph are that remain concentrated near the diagonal of the coordinate axis, the stronger the correlation between the adjacent pixels of the image is. On the contrary, the more the points in the graph are dispersed in the whole graph, the weaker the correlation between adjacent pixels of the image. A good encryption scheme should be able to effectively reduce the correlation between the adjacent pixels of the image [17]. In the field of image encryption, the correlation analysis of adjacent pixels of encryption schemes is usually carried out from three directions horizontal, vertical, and diagonal.The correlation analysis of adjacent pixels of this encryption scheme is shown in Figure6. Observing the analysis chart, we can see that the correlation between adjacent pixels of the image encrypted by the encryption scheme proposed in this paper is surely reduced after measuring the three directions, i.e., horizontal, vertical and diagonal. We can find that the drawing points are evenly distributed in the whole analysis map, which can effectively resist statistical attacks.Figure 6
Correlation analysis of related pixels of three groups of experimental diagrams. Image (a) is a color house image, and the correlation analysis diagram of “horizontal, vertical and diagonal” adjacent pixels of (a) from left to right. The image (b) is an encrypted image of (a), and the correlation analysis images of adjacent pixels in three directions of (b) are sequentially from left to right. Image (c) is a color monkey image, and the correlation analysis diagram of adjacent pixels in three directions from left to right is (c). The image (d) is an encrypted image of (c), and the correlation analysis images of adjacent pixels in three directions of (d) are sequentially from left to right. The image (e) is a color map image, and the correlation analysis graphs of adjacent pixels in three directions of (e) are arranged from left to right. Image (f) is the encrypted graph of (e) and is the correlation analysis graph of adjacent pixels in the three directions of (f) from left to right.


## 3.1.3. Correlation Coefficients

To better measure the correlation of adjacent pixels of an encrypted image, the correlation is frequently used to quantitatively describe its size. The specific definitions are as follows:(6)rpq=covp,qDpDq.In Formula (6),(7)Ep=1N∑i=1Npi,Eq=1N∑i=1Nqi,Dp=1N∑i=1Npi−Ep2,Dq=1N∑i=1Nqi−Ep2,covp,q=1N∑i=1Npi−Eppi−Ep,where p and q represent two vectors of adjacent pixels, and rpq show the relational value. The lower the correlation of adjacent pixels, the closer their correlation is to 0.Through simulation experiments (see Table2), the correlation in all three directions is close to zero, indicating that the cryptographic algorithm proposed in this paper has almost no correlation.Table 2
Correlation coefficients of the encrypted Lena image for different methods.
MethodDirectionComponentsHorizontalVerticalDiagonalPlain imageR0.97240.94290.9241G0.97270.94680.9250B0.94630.90120.8638ProposedR−0.00460.00720.0009G−0.00150.0056−0.0125B−0.0091−0.0076−0.0145Ref. [10]R0.00640.0160−0.0026G0.00090.00340.0125B0.0091−0.0045−0.0090Ref. [18]R−0.0112−0.00260.0052G0.00500.0199−0.0064B−0.01790.0120−0.0161Ref. [19]R0.00140.00480.0002G0.0033−0.00060.0048B0.00210.0002−0.0040Ref. [20]R−0.00700.0049−0.0083G−0.00760.00620.0032B0.0047−0.0025−0.0058


## 3.1.4. Information Entropy

Information entropy is mainly used in the field of image processing to describe the information contained in an image, that is, the distribution of grayscale values in an image. Its formula is defined as(8)Hx=−∑i=1npxlog2pxi,where pxi represents the frequency with which grayscale x occurs.The closer the value of the information entropy is to eight, the more uniform the distribution is. By comparing with other studies (see Table3), it can be discovered that after employing the scheme proposed here, the encrypted image possesses a marked degree of randomness.Table 3
Information entropy of the encrypted Lena image for different methods.
MethodRedGreenBlueAverageProposed7.99167.99137.99197.9916Ref. [10]7.99747.99767.99747.9975Ref. [18]7.98957.98947.98947.9894Ref. [19]7.99177.99127.99187.9916Ref. [20]7.99917.99937.99937.9992


## 3.2. Robustness Analysis

As we all know, there may be various situations like information loss and attack in the process of image transmission [21]. A robust encryption scheme should be able to resist various common image attacks to a certain extent and should ensure the information missing or contaminated encrypted images can still obtain the main information of the original image through decryption.


### 3.2.1. Cropping Attack

Cropping attack refers to dividing the image, which causes the image yield some information. In image encryption, part of the encrypted image is cut and then decrypted, and the decrypted reconstructed image is compared with the original plaintext image [22].We tested 25% and 50% cut attacks on three groups of experimental pictures with different resolutions and the test results (see Figure7). From the experimental results, we can see that the encryption scheme can still display the main image information after the clipping attack which proves that the encryption scheme possesses good resistance to the clipping attack.Figure 7
Cropping attack analysis diagram. Image (a) is color house image, (b) is a result map of 25% clipping of the encrypted map (a), (c) is a decryption map of (b), (d) is a result map of 50% clipping of the encrypted map (a), and (e) is a decryption map of (d). Image (f) is color monkey original image, (g) is a result image of 25% cutting of the encrypted image (f), (h) is a decryption image of (g), (i) is a result image of 50% cutting of the encrypted image (f), and (j) is a decryption image of (i). The image (k) is color map image, (l) is a result map of 25% cropping of the encrypted map (k), (m) is a decryption map of (l), (n) is a result map of 50% cropping of the encrypted map (k), and (o) is a decryption map of (n).


### 3.2.2. Gaussian Noise Attack

Images are always degraded by some senseless error, which is called noise. The ideal noise is considered as white noise, which appears at the same intensity at all frequencies. As a particular case of white noise, Gaussian noise can be used to approximate the noise in many real scenes.In this paper, three groups of experimental images are decrypted by adding 0.08 and 0.2 Gaussian white noise, respectively. The experimental results are shown in Figure8. It can be noted from the diagram that the resulting diagram encrypted by this encryption scheme can obtain the main information of the original image through decryption even if it is polluted by noise, which has good robustness to noise attack.Figure 8
Gaussian noise attack analysis diagram. Image (a) is color house image, (b) is a result image of adding density 0.08 Gaussian noise to the encrypted image (a), (c) is a decryption image of (b), (d) is a result image of adding density 0.2 Gaussian noise to the encrypted image (a), and (e) is a decryption image of (d). Image (f) is color monkey image, (g) is a result image of adding density 0.08 Gaussian noise to (f), (h) is a decryption image of (g), (i) is a result image of adding density 0.2 Gaussian noise to (f), and (j) is a decryption image of (i). The image (k) is color map image, (l) is a result image of adding a density of 0.08 Gaussian noise to the encrypted image (k), (m) is a decryption image of (l), (n) is a result image of adding a density of 0.2 Gaussian noise to the encrypted image (k), and (o) is a decryption image of (n).


## 3.2.1. Cropping Attack

Cropping attack refers to dividing the image, which causes the image yield some information. In image encryption, part of the encrypted image is cut and then decrypted, and the decrypted reconstructed image is compared with the original plaintext image [22].We tested 25% and 50% cut attacks on three groups of experimental pictures with different resolutions and the test results (see Figure7). From the experimental results, we can see that the encryption scheme can still display the main image information after the clipping attack which proves that the encryption scheme possesses good resistance to the clipping attack.Figure 7
Cropping attack analysis diagram. Image (a) is color house image, (b) is a result map of 25% clipping of the encrypted map (a), (c) is a decryption map of (b), (d) is a result map of 50% clipping of the encrypted map (a), and (e) is a decryption map of (d). Image (f) is color monkey original image, (g) is a result image of 25% cutting of the encrypted image (f), (h) is a decryption image of (g), (i) is a result image of 50% cutting of the encrypted image (f), and (j) is a decryption image of (i). The image (k) is color map image, (l) is a result map of 25% cropping of the encrypted map (k), (m) is a decryption map of (l), (n) is a result map of 50% cropping of the encrypted map (k), and (o) is a decryption map of (n).


## 3.2.2. Gaussian Noise Attack

Images are always degraded by some senseless error, which is called noise. The ideal noise is considered as white noise, which appears at the same intensity at all frequencies. As a particular case of white noise, Gaussian noise can be used to approximate the noise in many real scenes.In this paper, three groups of experimental images are decrypted by adding 0.08 and 0.2 Gaussian white noise, respectively. The experimental results are shown in Figure8. It can be noted from the diagram that the resulting diagram encrypted by this encryption scheme can obtain the main information of the original image through decryption even if it is polluted by noise, which has good robustness to noise attack.Figure 8
Gaussian noise attack analysis diagram. Image (a) is color house image, (b) is a result image of adding density 0.08 Gaussian noise to the encrypted image (a), (c) is a decryption image of (b), (d) is a result image of adding density 0.2 Gaussian noise to the encrypted image (a), and (e) is a decryption image of (d). Image (f) is color monkey image, (g) is a result image of adding density 0.08 Gaussian noise to (f), (h) is a decryption image of (g), (i) is a result image of adding density 0.2 Gaussian noise to (f), and (j) is a decryption image of (i). The image (k) is color map image, (l) is a result image of adding a density of 0.08 Gaussian noise to the encrypted image (k), (m) is a decryption image of (l), (n) is a result image of adding a density of 0.2 Gaussian noise to the encrypted image (k), and (o) is a decryption image of (n).


## 3.3. Encryption Performance Analysis

### 3.3.1. Peak Signal-to-Noise Ratio

The peak signal-to-noise ratio (PSNR) measures the maximum signal-to-noise ratio on a signal and is typically used for image and video signals. PSNR is calculated using the following formula:(9)PSNRdB=N×MAX2∑n=1NXn−Yn2,where N is the total number of samples in the signal, MAX is the maximum possible value of the sample, Xn corresponds to the nth sample of the original signal X, and Yn represents the nth sample of the encrypted signal Y.PSNR is a measure of the difference in peak error between two images. For ideally similar images, PSNR is infinite, and for completely different images, its value is zero. The PSNR of the images was encrypted implementing the algorithm proposed in this paper and is calculated together with the original images (see Table4), and it is found that their values are lower than the PSNR values calculated by other research schemes, which proves that the images encrypted by the algorithm in this paper are quite different from the original images, and the algorithm has good encryption performance.Table 4
PSNR of the Lena image for different methods.
MethodProposedRef. [23]Ref. [24]Ref. [25]PSNR7.19547.63248.62587.6714


### 3.3.2. Key Space Analysis

The space size of the encryption key affects the encryption performance of the encryption scheme. A robust image encryption scheme has a requirement of a sufficiently large key space [26]. It can be seen from the above that in the encryption scheme of this paper, we got six encryption keys. When M = N, we obtain the length of xPred,yPred,zPred, respectively:(10)lenxPred,yPred,zPred=M−modM,10.Meanwhile, the key length ofx′,y′,z′ can be expressed as(11)lenx′,y′,z′=ceilM∗N1000∗1000+1.From what has been mentioned above, we can conclude that the key space size is(12)M−modM,103∗ceilM∗N1000∗1000+13.According to formula (12), we calculate the key space of three groups of experimental graphs, and the results are 4.4923∗1021,2.4131∗1024,1.225∗1027 that are all greater than 270. Experimental results show that this encryption scheme has large key space and high security.


### 3.3.3. Time Complexity

Time complexity, as a function, is consumed to qualitatively describe the running time of the algorithm and is an important indicator to measure the quality of the algorithm. The common letter O is employed to denote and does not include the low-order term and the first-term coefficient of the function.The algorithm proposed in this paper mainly encrypts images with equal lengths and widths, assuming the length and width of the images representn. The chaotic system is operated to generate the initial key sequence as needed 1/1000n2. At the same moment, we estimate the time complexity of the deep learning model as 1 based on its training theory. The proposed embedding key method in this paper requiresn2. Scrambling and diffusion algorithms are required in the schemes 3xn2x∈0,255 and 6n2, respectively.Composing the previous estimates, we can conclude that the time complexity function formula for the cryptographic algorithm proposed in this article is(13)10017+3x1000n2+1.Formula (13) is simplified by order of magnitude to give the time complexity of the cryptographic algorithm presented On2 herein.


## 3.3.1. Peak Signal-to-Noise Ratio

The peak signal-to-noise ratio (PSNR) measures the maximum signal-to-noise ratio on a signal and is typically used for image and video signals. PSNR is calculated using the following formula:(9)PSNRdB=N×MAX2∑n=1NXn−Yn2,where N is the total number of samples in the signal, MAX is the maximum possible value of the sample, Xn corresponds to the nth sample of the original signal X, and Yn represents the nth sample of the encrypted signal Y.PSNR is a measure of the difference in peak error between two images. For ideally similar images, PSNR is infinite, and for completely different images, its value is zero. The PSNR of the images was encrypted implementing the algorithm proposed in this paper and is calculated together with the original images (see Table4), and it is found that their values are lower than the PSNR values calculated by other research schemes, which proves that the images encrypted by the algorithm in this paper are quite different from the original images, and the algorithm has good encryption performance.Table 4
PSNR of the Lena image for different methods.
MethodProposedRef. [23]Ref. [24]Ref. [25]PSNR7.19547.63248.62587.6714


## 3.3.2. Key Space Analysis

The space size of the encryption key affects the encryption performance of the encryption scheme. A robust image encryption scheme has a requirement of a sufficiently large key space [26]. It can be seen from the above that in the encryption scheme of this paper, we got six encryption keys. When M = N, we obtain the length of xPred,yPred,zPred, respectively:(10)lenxPred,yPred,zPred=M−modM,10.Meanwhile, the key length ofx′,y′,z′ can be expressed as(11)lenx′,y′,z′=ceilM∗N1000∗1000+1.From what has been mentioned above, we can conclude that the key space size is(12)M−modM,103∗ceilM∗N1000∗1000+13.According to formula (12), we calculate the key space of three groups of experimental graphs, and the results are 4.4923∗1021,2.4131∗1024,1.225∗1027 that are all greater than 270. Experimental results show that this encryption scheme has large key space and high security.


## 3.3.3. Time Complexity

Time complexity, as a function, is consumed to qualitatively describe the running time of the algorithm and is an important indicator to measure the quality of the algorithm. The common letter O is employed to denote and does not include the low-order term and the first-term coefficient of the function.The algorithm proposed in this paper mainly encrypts images with equal lengths and widths, assuming the length and width of the images representn. The chaotic system is operated to generate the initial key sequence as needed 1/1000n2. At the same moment, we estimate the time complexity of the deep learning model as 1 based on its training theory. The proposed embedding key method in this paper requiresn2. Scrambling and diffusion algorithms are required in the schemes 3xn2x∈0,255 and 6n2, respectively.Composing the previous estimates, we can conclude that the time complexity function formula for the cryptographic algorithm proposed in this article is(13)10017+3x1000n2+1.Formula (13) is simplified by order of magnitude to give the time complexity of the cryptographic algorithm presented On2 herein.


## 4. Discussion

Through the observation of the above simulation experimental results, it can be perceived that the cryptographic algorithm proposed in this paper performs well in terms of histogram, correlation, information entropy, and other statistical performance, and it shows good robustness in common shearing and noise attacks. As a group, it obtains an enormous key space and lower time complexity and better encryption performance such as the PSNR value compared with other research schemes.Because the encryption algorithm proposed in this paper is primarily to operate a chaotic system combined with a deep learning model to generate an encryption key, and then embed the key through an embedding method designed by ourselves. In theory, deep learning models may generate errors when generating keys. But this article focuses on improving the algorithmic security of color image encryption, so the possible errors are unconsidered in this encryption scheme. Naturally, any algorithm includes certain limitations. In the effective experimental process, we tested the pixel number change rate (NPCR) and the uniform means change intensity (UACI). It is found that the resistance to differential attack was weaker than that of other research results and temporarily only supports the encryption of color images of equal length and width.


## 5. Conclusion

In this paper, we proposed a color image encryption scheme based on deep learning and block embedding. Because of its multilevel complex structure, the deep learning model is combined with a chaotic system to ensure the complexity of the generated key. As a group, we design a block embedding method, which combines the encrypted key with the color image organically. Through simulation experiments, it is proved that the proposed encryption scheme obtains good performance and robustness to general attacks.MATLAB uses dual-precision data types by default. To overcome the difference between the simulation accuracy and the factual situation in the encryption algorithm design, we reduce the frequency of the conversion of different data types in the experiment. Meantime, the complex calculation that generates the encryption key is separated from the operation of the key embedding to reduce the complex operation of the color image itself. As one would expect, this paper temporarily only realizes the color image encryption of equal length and width. In the future, we will study the color image encryption with unusual length and width in this direction and improve the robustness of the algorithm to other image attack methods.



---

*Source: 6047349-2022-10-26.xml*