# A High-Security Privacy Image Encryption Algorithm Based on Chaos and Double Encryption Strategy

Authors: Zhiqiang Cheng; Wencheng Wang; Yuezhang Dai; Lun Li
Journal: Journal of Applied Mathematics
 (2022)

---

## Abstract

Faces are widely used in information recognition and other fields. Due to the openness of the Internet, ensuring that face information is not stolen by criminals is a hot issue. The traditional encryption method only encrypts the whole area of the image and ignores some features of the face. This paper proposes a double-encrypted face image encryption algorithm. The contour features of the face are extracted, followed by two rounds of encryption. The first round of encryption algorithm encrypts the identified face image, and the second round of encryption algorithm encrypts the entire image. The encryption algorithm used is scrambling and diffusion at the same time, and the keystream of the cryptosystem is generated by 2D SF-SIMM. The design structure of this cryptosystem increases security, and the attacker needs to crack two rounds of the algorithm to get the original face image.


---

## Body

## 1. Introduction

Nowadays, in the era of rapid development of the Internet, people can receive and publish information through the Internet anytime, anywhere. Images are the most intuitive carrier for obtaining information. Nowadays, images have been widely used in military, medical, and other fields. As an important information-sharing carrier, image is a hot issue in realizing image security sharing and transmission [1–5]. Image encryption technology is one of the important technologies for image protection. Image encryption technology can convert a regular plaintext image into an unrecognizable noise image [6–9].Traditional encryption schemes such as AES are not suitable for digital images, which makes image encryption algorithms based on chaos theory gradually favored by researchers. There is a common connection between the pseudorandom keystream generated by chaos and cryptography, which makes image encryption algorithms based on chaos theory widely used [10–13]. At the same time, the current research on chaos theory is also deepening. The combination of chaos theory and other technologies increases the complexity of the cryptographic system, making the proposed cryptographic system more secure [14–18].For example, the DNA encryption algorithm based on chaos [19–21]: Yang et al. proposed CGI image encryption, which uses logistic chaotic to generate the keystream of the cryptosystem and combines with DNA encoding to obtain ciphertext images. This method reduces the number of key transmissions and has great advantages in image encryption with large amounts of data [19]. Quantum encryption algorithm based on chaos theory [22–24]: the keystream generated by the four-wing chaotic system is XORed with the plaintext to obtain a semiencrypted ciphertext image, and quantum rotation is used to complete the encryption operation in the diffusion stage. The experimental results are good, but the time of this algorithm is very slow [22]. In Ref. [25], compressed sensing and chaos theory are used to encrypt images, which reduces the amount of information transmission and increases the complexity of the algorithm, but the encryption process is lossy.As one of the most private images in images, face images have been used in the field of information recognition, such as unlocking mobile phones. Ensuring more secure transmission of face images on the Internet is one of the most important topics in cryptography today. The above-mentioned image encryption algorithms are global encryption of the image. In this paper, we propose a double-encrypted image encryption algorithm for face images. The outline of the face is identified for the first encryption, followed by the second encryption of the entire image. Compared with traditional encryption algorithms, the proposed algorithm has higher security. An attacker needs to crack two rounds of the encryption algorithm to get the original face image. Compared with cracking the algorithm once, there is no doubt that it takes more time to crack the encryption algorithm twice. Furthermore, to improve the security of the encryption system, we use a strategy of simultaneous diffusion and scrambling, which has a higher complexity. In the designed cryptosystem, the required keystream is generated by 2D SF-SIMM. The 2D SF-SIMM [26] was proposed by Liu et al.; this system has three control parameters and more complex dynamic behavior. Therefore, the cryptosystem based on 2D SF-SIMM has a large key space.


## 2. Related Works

### 2.1. 2D SF-SIMM

The 2D SF-SIMM was proposed by Liu et al. It is a system composed of four sins and has three control parameters. Compared with other 2D chaotic systems, 2D SF-SIMM has a larger parameter space and better performance. It is described as(1)fn+1=ηsinλgnsinθ/fngn+1=ηsinλfn+1sinθ/gn,where η, θ, and λ are the three control parameters of the 2D SF-SIMM, η∈−∞,+∞, θ∈−∞,+∞, and λ∈−∞,+∞. When ηλ>1, at that time, the system exhibits strong chaotic behavior. The trajectory diagram of the 2D SF-SIMM is shown in Figure 1. The selected initial values are x0=0.65478466897887 and y0=0.85426984531656. The bifurcation diagram of the 2D SF-SIMM is shown in Figure 2. The selected initial values are x0=0.52169852522365 and y0=0.96655412365898.Figure 1
Trajectory diagram of 2D SF-SIMM. (a) Trajectory diagram withη=3.7, θ=5.2, and λ=2.6. (b) Trajectory diagram with η=2.9, θ=6.8, and λ=5.9. (c) Trajectory diagram with η=4.3, θ=2.2, and λ=4.8.
(a)(b)(c)Figure 2
Bifurcation diagram of 2D SF-SIMM. (a) Bifurcation diagram of sequenceX with η=3.7 and λ=2.6. (b) Bifurcation diagram of sequence Y with η=3.7 and λ=2.6.
(a)(b)


### 2.2. Extraction of Facial Contours

The open source OpenCV is used to realize the detection of face contours. In this paper, the image data is used as shown in Figure3. The face image extracted using OpenCV is shown in Figure 4.Figure 3
Face contour of face images. (a) Barbara. (b) Girl. (c) Lena. (d) Reagan.
(a)(b)(c)(d)Figure 4
Visualization for Barbara. (a) First encryption. (b) Second encryption. (c) Decrypt for the first time. (d) Decrypt for the second time.
(a)(b)(c)(d)


## 2.1. 2D SF-SIMM

The 2D SF-SIMM was proposed by Liu et al. It is a system composed of four sins and has three control parameters. Compared with other 2D chaotic systems, 2D SF-SIMM has a larger parameter space and better performance. It is described as(1)fn+1=ηsinλgnsinθ/fngn+1=ηsinλfn+1sinθ/gn,where η, θ, and λ are the three control parameters of the 2D SF-SIMM, η∈−∞,+∞, θ∈−∞,+∞, and λ∈−∞,+∞. When ηλ>1, at that time, the system exhibits strong chaotic behavior. The trajectory diagram of the 2D SF-SIMM is shown in Figure 1. The selected initial values are x0=0.65478466897887 and y0=0.85426984531656. The bifurcation diagram of the 2D SF-SIMM is shown in Figure 2. The selected initial values are x0=0.52169852522365 and y0=0.96655412365898.Figure 1
Trajectory diagram of 2D SF-SIMM. (a) Trajectory diagram withη=3.7, θ=5.2, and λ=2.6. (b) Trajectory diagram with η=2.9, θ=6.8, and λ=5.9. (c) Trajectory diagram with η=4.3, θ=2.2, and λ=4.8.
(a)(b)(c)Figure 2
Bifurcation diagram of 2D SF-SIMM. (a) Bifurcation diagram of sequenceX with η=3.7 and λ=2.6. (b) Bifurcation diagram of sequence Y with η=3.7 and λ=2.6.
(a)(b)


## 2.2. Extraction of Facial Contours

The open source OpenCV is used to realize the detection of face contours. In this paper, the image data is used as shown in Figure3. The face image extracted using OpenCV is shown in Figure 4.Figure 3
Face contour of face images. (a) Barbara. (b) Girl. (c) Lena. (d) Reagan.
(a)(b)(c)(d)Figure 4
Visualization for Barbara. (a) First encryption. (b) Second encryption. (c) Decrypt for the first time. (d) Decrypt for the second time.
(a)(b)(c)(d)


## 3. Face Encryption Algorithm

The proposed encryption algorithm is a double encryption algorithm; the first is the encryption of the extracted face, and the second is the encryption of the whole image. In the encryption algorithm, a strategy of scrambling and diffusion is proposed at the same time. This approach has been shown to have high complexity. In addition, this algorithm is a symmetric encryption algorithm, and the encryption process is the reverse process of decryption.


### 3.1. The Encryption Algorithm

The encryption algorithm is described as follows.Input:P (P is a plaintext image)Step 1: according to the plaintextP, generate an initial revision key k(2)k=1m1×n1∑i=1m1∑j=1n1Pi,j,where m1=sizeP,1 and n1=sizeP,2.Step 2: bringk into the logistic iteration for 100 times to generate a new revision key k1(3)fn+1=3.999+k110000×fn×1−fn,where n=1,2,3,⋯,100, f1=k, and k1=f100.Step 3: given the initial keysx0,y0,η,θ,λ, generate the key of the cryptosystem by Equation (4) according to the revised key k1(4)x0=x0+k1,y0=y0+k1,η=η+k1,θ=θ+k1,λ=λ+k1.Step 4: the new keysx0,y0,η,θ,λ are brought into the 2D SF-SIMM to generate the keystream of the cryptosystem X and Y(5)xn+1=ηsinλynsinθxn,yn+1=ηsinλxn+1sinθyn,where the size of X is m1×n1 and the size of Y is m1×n1.Step 5: extract the face contour, where the contour coordinates areA=a1,a2,a3,a4, a new plaintext is generated F=Pa1:a2,a3:a4, m2=sizeF,1, and n2=sizeF,2.Step 6: generate three sorting matricesS1,S2,S3 for encryption stage by Algorithm 1.
(6)S1=SX,m1×n1,S2=SY,m2×n2,S3=SY,m1×n1.Algorithm 1: (s=SX,N).
Input:X and NY=X1:NYM=1,2,3,4,⋯,MYM2=Y;YMYM3=sortrowsYM2,1s=YM31:end,2Output:sStep 7: three encryption matricesD1,D2,D3 are generated for the encryption stage
(7)D1=modfloorX1:m1×n1×1012,256,D2=modfloorY1:m2×n2×1013,256,D3=modfloorY1:m1×n1×1014,256.Step 8: the first encryption, encrypting the extracted face image,(8)C1S21=FS21+D2S21mod256,C1S2i=FS2i+D2S2i+C1S2i−1mod256,i=1,2,3,⋯,m2×n2.Combine the new ciphertext with the original plaintext to produce a new plaintext imagePa1:a2,a3:a4=C1.Step 9: the second encryption is to encrypt the entire image. This encryption is divided into backward encryption and forward encryption.Backward encryption is described as(9)C2S11=PS11+D1S11mod256,C2S1i=PS1i+D1S1i+C2S1i−1mod256,i=1,2,3,⋯,m1×n1.Forward encryption is described as(10)C3S3m1×n1=C2S3m1×n1+D3S3m1×n1mod256,C3S3i=C2S3i+D3S3i+C3S3i+1mod256,i=m1×n1−1,m1×n1−2,⋯,1.Output:C3.


### 3.2. The Decryption Algorithm

The decryption algorithm is described as follows.Input:C3 (C3 is the ciphertext image), secret keys are x0,y0,η,θ,λ, and k1.Step 1: given the initial keyx0,y0,η,θ,λ, generate the key of the cryptosystem based on the revised key k1(11)x0=x0+k1,y0=y0+k1,η=η+k1,θ=θ+k1,λ=λ+k1.Step 2: the keystream of the cryptosystemD1,D2,D3 and S1,S2,S3 are generated.Step 3: the first decryption is described as follows.The decryption process of forward encryption:(12)C2S3m1×n1=C3S3m1×n1−D3S3m1×n1mod256,C2S3i=C3S3i−D3S3i−C3S3i+1mod256,i=m1×n1−1,m1×n1−2,⋯,1.The decryption process of the backward encryption:(13)PS11=C2S11−D1S11mod256,PS1i=C2S1i−D1S1i−C2S1i−1mod256,i=1,2,3,⋯,m1×n1.Step 4: extract the face partC1=Pa1:a2,a3:a4 for the second decryption
(14)FS21=C1S21−D2S21mod256,FS2i=C1S2i−D2S2i−C1S2i−1mod256,i=1,2,3,⋯,m2×n2.Step 5: replace the first decrypted face partPa1:a2,a3:a4=F.Output:P.


## 3.1. The Encryption Algorithm

The encryption algorithm is described as follows.Input:P (P is a plaintext image)Step 1: according to the plaintextP, generate an initial revision key k(2)k=1m1×n1∑i=1m1∑j=1n1Pi,j,where m1=sizeP,1 and n1=sizeP,2.Step 2: bringk into the logistic iteration for 100 times to generate a new revision key k1(3)fn+1=3.999+k110000×fn×1−fn,where n=1,2,3,⋯,100, f1=k, and k1=f100.Step 3: given the initial keysx0,y0,η,θ,λ, generate the key of the cryptosystem by Equation (4) according to the revised key k1(4)x0=x0+k1,y0=y0+k1,η=η+k1,θ=θ+k1,λ=λ+k1.Step 4: the new keysx0,y0,η,θ,λ are brought into the 2D SF-SIMM to generate the keystream of the cryptosystem X and Y(5)xn+1=ηsinλynsinθxn,yn+1=ηsinλxn+1sinθyn,where the size of X is m1×n1 and the size of Y is m1×n1.Step 5: extract the face contour, where the contour coordinates areA=a1,a2,a3,a4, a new plaintext is generated F=Pa1:a2,a3:a4, m2=sizeF,1, and n2=sizeF,2.Step 6: generate three sorting matricesS1,S2,S3 for encryption stage by Algorithm 1.
(6)S1=SX,m1×n1,S2=SY,m2×n2,S3=SY,m1×n1.Algorithm 1: (s=SX,N).
Input:X and NY=X1:NYM=1,2,3,4,⋯,MYM2=Y;YMYM3=sortrowsYM2,1s=YM31:end,2Output:sStep 7: three encryption matricesD1,D2,D3 are generated for the encryption stage
(7)D1=modfloorX1:m1×n1×1012,256,D2=modfloorY1:m2×n2×1013,256,D3=modfloorY1:m1×n1×1014,256.Step 8: the first encryption, encrypting the extracted face image,(8)C1S21=FS21+D2S21mod256,C1S2i=FS2i+D2S2i+C1S2i−1mod256,i=1,2,3,⋯,m2×n2.Combine the new ciphertext with the original plaintext to produce a new plaintext imagePa1:a2,a3:a4=C1.Step 9: the second encryption is to encrypt the entire image. This encryption is divided into backward encryption and forward encryption.Backward encryption is described as(9)C2S11=PS11+D1S11mod256,C2S1i=PS1i+D1S1i+C2S1i−1mod256,i=1,2,3,⋯,m1×n1.Forward encryption is described as(10)C3S3m1×n1=C2S3m1×n1+D3S3m1×n1mod256,C3S3i=C2S3i+D3S3i+C3S3i+1mod256,i=m1×n1−1,m1×n1−2,⋯,1.Output:C3.


## 3.2. The Decryption Algorithm

The decryption algorithm is described as follows.Input:C3 (C3 is the ciphertext image), secret keys are x0,y0,η,θ,λ, and k1.Step 1: given the initial keyx0,y0,η,θ,λ, generate the key of the cryptosystem based on the revised key k1(11)x0=x0+k1,y0=y0+k1,η=η+k1,θ=θ+k1,λ=λ+k1.Step 2: the keystream of the cryptosystemD1,D2,D3 and S1,S2,S3 are generated.Step 3: the first decryption is described as follows.The decryption process of forward encryption:(12)C2S3m1×n1=C3S3m1×n1−D3S3m1×n1mod256,C2S3i=C3S3i−D3S3i−C3S3i+1mod256,i=m1×n1−1,m1×n1−2,⋯,1.The decryption process of the backward encryption:(13)PS11=C2S11−D1S11mod256,PS1i=C2S1i−D1S1i−C2S1i−1mod256,i=1,2,3,⋯,m1×n1.Step 4: extract the face partC1=Pa1:a2,a3:a4 for the second decryption
(14)FS21=C1S21−D2S21mod256,FS2i=C1S2i−D2S2i−C1S2i−1mod256,i=1,2,3,⋯,m2×n2.Step 5: replace the first decrypted face partPa1:a2,a3:a4=F.Output:P.


## 4. Simulation Experiments

### 4.1. Visualization

In the cryptographic system, selectη=3.7, θ=5.2, λ=2.6, x0=0.65478466897887, and y0=0.85426984531656 as the initial keys for visual analysis. The size of images are 512×512. The visual analysis result is shown in Figures 5–7. Visually, it has a good encryption effect, and the decryption algorithm can restore the plaintext image without loss.Figure 5
Visualization for Barbara. (a) First encryption. (b) Second encryption. (c) Decrypt for the first time. (d) Decrypt for the second time.
(a)(b)(c)(d)Figure 6
Visualization for girl. (a) First encryption. (b) Second encryption. (c) Decrypt for the first time. (d) Decrypt for the second time.
(a)(b)(c)(d)Figure 7
Visualization for Reagan. (a) First encryption. (b) Second encryption. (c) Decrypt for the first time. (d) Decrypt for the second time.
(a)(b)(c)(d)


### 4.2. NIST Statistical Tests

NIST is used to test whether plaintext images and ciphertext images are random. The NIST test results of the proposed algorithm are shown in Table1. The NIST test results show that the pixel value of the plaintext image is not random, and the pixel value of the ciphertext has good randomness, so the algorithm has high security.Table 1
NIST test of plaintext and ciphertext.
Statistical testPlaintextCiphertextP valueResultP valueResultNonoverlapping template matching0No0.9797YesRuns0No0.4389YesSerial0No0.1111YesSpectral0No0.2581YesRank0No0.4087YesRandom excursions0No0.5949YesCumulative sums0No0.2622YesFrequency0No0.6028YesUniversal0No0.7112YesLinear complexity0No0.2217YesLongest run of ones0No0.1174YesApproximate entropy0No0.2967YesRandom excursion variant0No0.3188YesBlock frequency0No0.4242YesOverlapping template matching0No0.5079Yes


### 4.3. Correlation Analysis

The correlation coefficient of adjacent pixels can reflect the degree of diffusion of image pixel values. When adjacent pixel values have a low correlation and vice versa, the image presents a state of divergence. The lower the correlation, the better it can prevent the attacker from obtaining meaningful information from the ciphertext image. Figures8 and 9 are the correlation analysis results of the proposed algorithm.Figure 8
Correlation analysis of Barbara. (a) Correlation analysis of plaintext. (b) Correlation analysis of ciphertext.
(a)(b)Figure 9
Correlation analysis of girl. (a) Correlation analysis of plaintext. (b) Correlation analysis of ciphertext.
(a)(b)When the correlation image presents a state of aggregation, it indicates that the adjacent pixels of the image have strong correlation. When the correlation image shows a divergent state, it indicates that the adjacent pixels of the image have weak correlation. Visually, the proposed algorithm reduces the correlation of adjacent pixels in the image.The quantitative analysis results of the correlation are shown in Table2. In addition, the comparison results with some new methods (Nafise [27], Chai [7], Ayubi [28], and Asgar [29]) are shown in Table 3.Table 2
Correlation coefficients.
ImagePlaintextCiphertextHor.Ver.Diag.Hor.Ver.Diag.Barbara0.8610240.9570770.840216-0.000463-0.001143-0.000671Girl0.9854190.9882770.9748040.000828-0.000270-0.005194Lena0.9737300.9868680.960985-0.0009040.0005030.001368Reagan0.9709190.9797140.9592510.00066150.003655-0.000902Table 3
Correlation coefficient comparison of Lena.
AlgorithmsProposedNafise [27]Chai [7]Ayubi [28]Asgar [29]Hor.-0.000904-0.00055198-0.0029-0.0031-0.0022Ver.0.0005030.000867990.0013-0.02930.0013Diag.0.001368-0.0032701-0.00260.00770.0013The relationship of plaintext image in three directions is linear, while the correlation of ciphertext is more discrete. The correlation analysis results show that the plaintext image has strong correlation, and the adjacent pixels of the ciphertext image basically have no correlation. The comparison results show that the proposed method has better effect and higher security.


### 4.4. Histogram Analysis

Generally speaking, the histogram is evenly distributed, which can effectively prevent attackers from analyzing the histogram to obtain plaintext information. Histogram analysis of the proposed method is shown in Figure10. Histogram analysis shows that the distribution of ciphertext histograms is uniform, so the proposed algorithm can effectively mask the characteristics of plaintext imagesFigure 10
Histogram analysis. (a) Histogram analysis of Lena. (b) Histogram analysis of encrypted Lena. (c) Histogram analysis of Reagan. (d) Histogram analysis of encrypted Reagan.
(a)(b)(c)(d)The chi-square test was used to verify that the histogram was uniform [30], and the chi-square test results are shown in Table 4. The ciphertext chi-square test result is around 250, and the chi-square test result shows that the ciphertext histogram distribution is uniform.Table 4
Chi-square test results.
ImagePlaintextCiphertextBarbara147977267.1699Girl291918264.4570Lena160082244.4805Reagan212015263.9355


### 4.5. Differential Attack

The cryptographic system should be sensitive to the plaintext. Even if the plaintext changes slightly, the obtained ciphertext should be very different. The two test indicators of NPCR and UACI are calculated as(15)NPCR=∑i,jEi,jM×N×100%,UACI=1M×N∑i,jC1i,j−C2i,j255×100%.The size of images is512×512, when the value of NPCR exceeds 99.5893% and the value of UACI is between 33.3730% and 33.5541%, indicating that the algorithm is resistant to differential attacks [31]. NPCR and UACI are shown in Table 5.Table 5
NPCR and UACI test results (%).
ImageNPCRPass or no passUACIPass or no passBarbara99.6036Pass33.4892PassGirl99.6102Pass33.5023PassLena99.6059Pass33.4652PassReagan99.6099Pass33.4899PassDifferential attack results show that the algorithm proposed in this paper is sensitive to plaintext. Even if the plaintext changes slightly, the obtained ciphertext is also very different.


### 4.6. Key Analysis

The keys of the proposed algorithm includex0,y0,η,θ,λ, and k1. If the calculation accuracy is 10−15, the key space of the proposed algorithm is
(16)keyspace=1015×1015×1015×1015×1015×1015=1090>2100.This is sufficient to resist brute force attacks. For different keys, even with minor changes, the final decrypted image should not contain any information related to the plaintext, that is, the algorithm is sensitive to the key. The sensitivity analysis of the algorithm is shown in Figure11. The initial keys are set to η=3.7, θ=5.2, λ=2.6, x0=0.65478466897887, and y0=0.85426984531656. The new keys are set to η=3.7+10−15, θ=5.2+10−15, λ=2.6+10−15, x0=0.65478466897887+10−15, and y0=0.85426984531656+10−15.Figure 11
Sensitivity analysis. (a) Decrypted image by correct key. (b) Decrypted image byx0=0.65478466897887+10−15. (c) Decrypted image by y0=0.85426984531656+10−15. (d) Decrypted image by η=3.7+10−15. (e) Decrypted image by θ=5.2+10−15. (f) Decrypted image by λ=2.6+10−15.
(a)(b)(c)(d)(e)(f)Using NPCR and UACI to verify the difference in Figure11, the sensitivity analysis results are shown in Table 6. Key sensitivity analysis shows that the image decrypted with the wrong key is very different from the plaintext image, indicating that the proposed algorithm has high sensitivity [32, 33].Table 6
Key sensitivity analysis (%).
NPCR/UACIFigure11(a)Figure11(b)Figure11(c)Figure11(d)Figure11(e)Figure11(f)Figure11(a)—0.3045310.3034530.3041820.3038100.304662Figure11(b)0.995910—0.3359920.3354950.3353040.336274Figure11(c)0.9961350.995716—0.3364610.3354480.336229Figure11(d)0.9959980.9958110.995693—0.3362080.337019Figure11(e)0.9960550.9955360.9957230.995811—0.336059Figure11(f)0.9962690.9954910.9956550.9958410.995758—


### 4.7. Information Entropy Analysis

Information entropy is mainly used to measure the uncertainty of plaintext information and ciphertext information. For digital images, the calculation formula is(17)Ht=−∑i=0255ptilogpti.The information entropy of the proposed algorithm is shown in Table7. In addition, the comparison results with some new methods (Nafise [27], Chai [7], Ayubi [28], and Asgar [29]) are shown in Table 8.Table 7
Information entropy.
ImagePlaintextCiphertextBarbara7.4603527.999264Girl7.2514067.999273Lena7.4486357.999328Reagan7.3542127.999274Table 8
Information entropy comparison of Lena.
AlgorithmsProposedNafise [27]Chai [7]Ayubi [28]Asgar [29]Information entropy7.99937.99877.99737.99937.9984The local information entropy of the proposed algorithm is shown in Table9. The local information entropy reflects the chaotic degree of the local information of the image. The range of the local information entropy is between 7.901901305 and 7.903037329 [34].Table 9
Local information entropy.
ImageLocal information entropyResultBarbara7.902155656540PassGirl7.902632365459PassLena7.902423121654PassReagan7.902232165444PassInformation entropy analysis shows that the ciphertext of the proposed algorithm not only has better performance globally but also has better performance in local subblocks. The comparative analysis results show that the information entropy of the proposed algorithm is closer to the theoretical value, so the proposed algorithm has higher security and resists statistical attacks.


### 4.8. Robustness Analysis

The plaintext will be attacked by some noise or lose some information during the transmission process, so the designed algorithm is required to be robust. Even under some noise attack or information loss, part of the plaintext image can still be obtained through the decryption algorithm. The robustness analysis of the algorithm is shown in Figure12.Figure 12
Robustness analysis. (a) 0.05 “salt & pepper.” (b) 0.01 “salt & pepper.” (c) 0.001 “salt & pepper.” (d) Lose information. (e) Decrypt of 0.05 “salt & pepper.” (f) Decrypt of 0.01 “salt & pepper.” (g) Decrypt of 0.001 “salt & pepper.” (h) Decrypt of lose information.
(a)(b)(c)(d)(e)(f)(g)(h)The Peak Signal-to-Noise Ratio (PSNR) metric is commonly used to measure the resiliency of an image and calculated as [35]
(18)PSNR=10×log2552MSEdB.Robustness of algorithms is tested by PSNR which are shown in Table10.Table 10
PSNR of robustness analysis.
Image 1Image 2PSNRGirlDecrypt of 0.05 “salt & pepper”14.6529GirlDecrypt of 0.01 “salt & pepper”21.3457GirlDecrypt of 0.001 “salt & pepper”31.0475GirlDecrypt of lose information21.0327The PSNR analysis results show that the proposed algorithm has good robustness. Even if part of the information is lost or attacked by noise, part of the plaintext information can still be obtained through the decryption algorithm. In addition, when the information is lost, although part of the information of the plaintext image is restored, the important information of the face is still in the ciphertext state, and this algorithm has a good effect on protecting the security of the face.


### 4.9. Speed Analysis

The running time of the algorithm is also an important indicator for security analysis [36, 37]. The operating environment of the proposed algorithm is Windows 10, MATLAB 2021a, i3-10105, 4 cores, and 6 MB cache. The encryption time of the proposed algorithm is shown in Table 11.Table 11
Speed analysis.
AlgorithmTime (s)Proposed0.336Ref. [38]0.663Ref. [39]0.390Ref. [40]0.785Ref. [37]0.139The speed analysis shows that the encryption efficiency of the proposed algorithm is very fast, and it takes 0.336 s to process a512×512 image. The experimental results show that the proposed algorithm is not only safe but also suitable for industrial production.


## 4.1. Visualization

In the cryptographic system, selectη=3.7, θ=5.2, λ=2.6, x0=0.65478466897887, and y0=0.85426984531656 as the initial keys for visual analysis. The size of images are 512×512. The visual analysis result is shown in Figures 5–7. Visually, it has a good encryption effect, and the decryption algorithm can restore the plaintext image without loss.Figure 5
Visualization for Barbara. (a) First encryption. (b) Second encryption. (c) Decrypt for the first time. (d) Decrypt for the second time.
(a)(b)(c)(d)Figure 6
Visualization for girl. (a) First encryption. (b) Second encryption. (c) Decrypt for the first time. (d) Decrypt for the second time.
(a)(b)(c)(d)Figure 7
Visualization for Reagan. (a) First encryption. (b) Second encryption. (c) Decrypt for the first time. (d) Decrypt for the second time.
(a)(b)(c)(d)


## 4.2. NIST Statistical Tests

NIST is used to test whether plaintext images and ciphertext images are random. The NIST test results of the proposed algorithm are shown in Table1. The NIST test results show that the pixel value of the plaintext image is not random, and the pixel value of the ciphertext has good randomness, so the algorithm has high security.Table 1
NIST test of plaintext and ciphertext.
Statistical testPlaintextCiphertextP valueResultP valueResultNonoverlapping template matching0No0.9797YesRuns0No0.4389YesSerial0No0.1111YesSpectral0No0.2581YesRank0No0.4087YesRandom excursions0No0.5949YesCumulative sums0No0.2622YesFrequency0No0.6028YesUniversal0No0.7112YesLinear complexity0No0.2217YesLongest run of ones0No0.1174YesApproximate entropy0No0.2967YesRandom excursion variant0No0.3188YesBlock frequency0No0.4242YesOverlapping template matching0No0.5079Yes


## 4.3. Correlation Analysis

The correlation coefficient of adjacent pixels can reflect the degree of diffusion of image pixel values. When adjacent pixel values have a low correlation and vice versa, the image presents a state of divergence. The lower the correlation, the better it can prevent the attacker from obtaining meaningful information from the ciphertext image. Figures8 and 9 are the correlation analysis results of the proposed algorithm.Figure 8
Correlation analysis of Barbara. (a) Correlation analysis of plaintext. (b) Correlation analysis of ciphertext.
(a)(b)Figure 9
Correlation analysis of girl. (a) Correlation analysis of plaintext. (b) Correlation analysis of ciphertext.
(a)(b)When the correlation image presents a state of aggregation, it indicates that the adjacent pixels of the image have strong correlation. When the correlation image shows a divergent state, it indicates that the adjacent pixels of the image have weak correlation. Visually, the proposed algorithm reduces the correlation of adjacent pixels in the image.The quantitative analysis results of the correlation are shown in Table2. In addition, the comparison results with some new methods (Nafise [27], Chai [7], Ayubi [28], and Asgar [29]) are shown in Table 3.Table 2
Correlation coefficients.
ImagePlaintextCiphertextHor.Ver.Diag.Hor.Ver.Diag.Barbara0.8610240.9570770.840216-0.000463-0.001143-0.000671Girl0.9854190.9882770.9748040.000828-0.000270-0.005194Lena0.9737300.9868680.960985-0.0009040.0005030.001368Reagan0.9709190.9797140.9592510.00066150.003655-0.000902Table 3
Correlation coefficient comparison of Lena.
AlgorithmsProposedNafise [27]Chai [7]Ayubi [28]Asgar [29]Hor.-0.000904-0.00055198-0.0029-0.0031-0.0022Ver.0.0005030.000867990.0013-0.02930.0013Diag.0.001368-0.0032701-0.00260.00770.0013The relationship of plaintext image in three directions is linear, while the correlation of ciphertext is more discrete. The correlation analysis results show that the plaintext image has strong correlation, and the adjacent pixels of the ciphertext image basically have no correlation. The comparison results show that the proposed method has better effect and higher security.


## 4.4. Histogram Analysis

Generally speaking, the histogram is evenly distributed, which can effectively prevent attackers from analyzing the histogram to obtain plaintext information. Histogram analysis of the proposed method is shown in Figure10. Histogram analysis shows that the distribution of ciphertext histograms is uniform, so the proposed algorithm can effectively mask the characteristics of plaintext imagesFigure 10
Histogram analysis. (a) Histogram analysis of Lena. (b) Histogram analysis of encrypted Lena. (c) Histogram analysis of Reagan. (d) Histogram analysis of encrypted Reagan.
(a)(b)(c)(d)The chi-square test was used to verify that the histogram was uniform [30], and the chi-square test results are shown in Table 4. The ciphertext chi-square test result is around 250, and the chi-square test result shows that the ciphertext histogram distribution is uniform.Table 4
Chi-square test results.
ImagePlaintextCiphertextBarbara147977267.1699Girl291918264.4570Lena160082244.4805Reagan212015263.9355


## 4.5. Differential Attack

The cryptographic system should be sensitive to the plaintext. Even if the plaintext changes slightly, the obtained ciphertext should be very different. The two test indicators of NPCR and UACI are calculated as(15)NPCR=∑i,jEi,jM×N×100%,UACI=1M×N∑i,jC1i,j−C2i,j255×100%.The size of images is512×512, when the value of NPCR exceeds 99.5893% and the value of UACI is between 33.3730% and 33.5541%, indicating that the algorithm is resistant to differential attacks [31]. NPCR and UACI are shown in Table 5.Table 5
NPCR and UACI test results (%).
ImageNPCRPass or no passUACIPass or no passBarbara99.6036Pass33.4892PassGirl99.6102Pass33.5023PassLena99.6059Pass33.4652PassReagan99.6099Pass33.4899PassDifferential attack results show that the algorithm proposed in this paper is sensitive to plaintext. Even if the plaintext changes slightly, the obtained ciphertext is also very different.


## 4.6. Key Analysis

The keys of the proposed algorithm includex0,y0,η,θ,λ, and k1. If the calculation accuracy is 10−15, the key space of the proposed algorithm is
(16)keyspace=1015×1015×1015×1015×1015×1015=1090>2100.This is sufficient to resist brute force attacks. For different keys, even with minor changes, the final decrypted image should not contain any information related to the plaintext, that is, the algorithm is sensitive to the key. The sensitivity analysis of the algorithm is shown in Figure11. The initial keys are set to η=3.7, θ=5.2, λ=2.6, x0=0.65478466897887, and y0=0.85426984531656. The new keys are set to η=3.7+10−15, θ=5.2+10−15, λ=2.6+10−15, x0=0.65478466897887+10−15, and y0=0.85426984531656+10−15.Figure 11
Sensitivity analysis. (a) Decrypted image by correct key. (b) Decrypted image byx0=0.65478466897887+10−15. (c) Decrypted image by y0=0.85426984531656+10−15. (d) Decrypted image by η=3.7+10−15. (e) Decrypted image by θ=5.2+10−15. (f) Decrypted image by λ=2.6+10−15.
(a)(b)(c)(d)(e)(f)Using NPCR and UACI to verify the difference in Figure11, the sensitivity analysis results are shown in Table 6. Key sensitivity analysis shows that the image decrypted with the wrong key is very different from the plaintext image, indicating that the proposed algorithm has high sensitivity [32, 33].Table 6
Key sensitivity analysis (%).
NPCR/UACIFigure11(a)Figure11(b)Figure11(c)Figure11(d)Figure11(e)Figure11(f)Figure11(a)—0.3045310.3034530.3041820.3038100.304662Figure11(b)0.995910—0.3359920.3354950.3353040.336274Figure11(c)0.9961350.995716—0.3364610.3354480.336229Figure11(d)0.9959980.9958110.995693—0.3362080.337019Figure11(e)0.9960550.9955360.9957230.995811—0.336059Figure11(f)0.9962690.9954910.9956550.9958410.995758—


## 4.7. Information Entropy Analysis

Information entropy is mainly used to measure the uncertainty of plaintext information and ciphertext information. For digital images, the calculation formula is(17)Ht=−∑i=0255ptilogpti.The information entropy of the proposed algorithm is shown in Table7. In addition, the comparison results with some new methods (Nafise [27], Chai [7], Ayubi [28], and Asgar [29]) are shown in Table 8.Table 7
Information entropy.
ImagePlaintextCiphertextBarbara7.4603527.999264Girl7.2514067.999273Lena7.4486357.999328Reagan7.3542127.999274Table 8
Information entropy comparison of Lena.
AlgorithmsProposedNafise [27]Chai [7]Ayubi [28]Asgar [29]Information entropy7.99937.99877.99737.99937.9984The local information entropy of the proposed algorithm is shown in Table9. The local information entropy reflects the chaotic degree of the local information of the image. The range of the local information entropy is between 7.901901305 and 7.903037329 [34].Table 9
Local information entropy.
ImageLocal information entropyResultBarbara7.902155656540PassGirl7.902632365459PassLena7.902423121654PassReagan7.902232165444PassInformation entropy analysis shows that the ciphertext of the proposed algorithm not only has better performance globally but also has better performance in local subblocks. The comparative analysis results show that the information entropy of the proposed algorithm is closer to the theoretical value, so the proposed algorithm has higher security and resists statistical attacks.


## 4.8. Robustness Analysis

The plaintext will be attacked by some noise or lose some information during the transmission process, so the designed algorithm is required to be robust. Even under some noise attack or information loss, part of the plaintext image can still be obtained through the decryption algorithm. The robustness analysis of the algorithm is shown in Figure12.Figure 12
Robustness analysis. (a) 0.05 “salt & pepper.” (b) 0.01 “salt & pepper.” (c) 0.001 “salt & pepper.” (d) Lose information. (e) Decrypt of 0.05 “salt & pepper.” (f) Decrypt of 0.01 “salt & pepper.” (g) Decrypt of 0.001 “salt & pepper.” (h) Decrypt of lose information.
(a)(b)(c)(d)(e)(f)(g)(h)The Peak Signal-to-Noise Ratio (PSNR) metric is commonly used to measure the resiliency of an image and calculated as [35]
(18)PSNR=10×log2552MSEdB.Robustness of algorithms is tested by PSNR which are shown in Table10.Table 10
PSNR of robustness analysis.
Image 1Image 2PSNRGirlDecrypt of 0.05 “salt & pepper”14.6529GirlDecrypt of 0.01 “salt & pepper”21.3457GirlDecrypt of 0.001 “salt & pepper”31.0475GirlDecrypt of lose information21.0327The PSNR analysis results show that the proposed algorithm has good robustness. Even if part of the information is lost or attacked by noise, part of the plaintext information can still be obtained through the decryption algorithm. In addition, when the information is lost, although part of the information of the plaintext image is restored, the important information of the face is still in the ciphertext state, and this algorithm has a good effect on protecting the security of the face.


## 4.9. Speed Analysis

The running time of the algorithm is also an important indicator for security analysis [36, 37]. The operating environment of the proposed algorithm is Windows 10, MATLAB 2021a, i3-10105, 4 cores, and 6 MB cache. The encryption time of the proposed algorithm is shown in Table 11.Table 11
Speed analysis.
AlgorithmTime (s)Proposed0.336Ref. [38]0.663Ref. [39]0.390Ref. [40]0.785Ref. [37]0.139The speed analysis shows that the encryption efficiency of the proposed algorithm is very fast, and it takes 0.336 s to process a512×512 image. The experimental results show that the proposed algorithm is not only safe but also suitable for industrial production.


## 5. Conclusion

This paper proposes a double encryption strategy for images based on chaos. The face image is first identified, and the first encryption is to encrypt the identified face image. Combine the ciphertext with the original ciphertext to get a new plaintext image. The second encryption is to encrypt the entire image. In the design of the cryptographic system, we use the strategy of simultaneous diffusion and scrambling, which has high complexity. The double encryption algorithm has high security, and the attacker needs to crack two different encryption algorithms to obtain the original face image. Compared with cracking the algorithm once, there is no doubt that it is more difficult to crack twice. It is verified that the proposed algorithm has high security by NIST, visual analysis, statistical analysis, and other methods.



---

*Source: 9040702-2022-07-15.xml*