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.

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 [15]. 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 [69].

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 [1013]. 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 [1418].

For example, the DNA encryption algorithm based on chaos [1921]: 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 [2224]: 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.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 where , , and are the three control parameters of the 2D SF-SIMM, , , and . When , 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 and . The bifurcation diagram of the 2D SF-SIMM is shown in Figure 2. The selected initial values are and .

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 Figure 3. The face image extracted using OpenCV is shown in Figure 4.

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: ( is a plaintext image)

Step 1: according to the plaintext , generate an initial revision key where and .

Step 2: bring into the logistic iteration for 100 times to generate a new revision key where , , and .

Step 3: given the initial keys , generate the key of the cryptosystem by Equation (4) according to the revised key

Step 4: the new keys are brought into the 2D SF-SIMM to generate the keystream of the cryptosystem and where the size of is and the size of is .

Step 5: extract the face contour, where the contour coordinates are , a new plaintext is generated , , and .

Step 6: generate three sorting matrices for encryption stage by Algorithm 1.

 Input: and
 Output:

Step 7: three encryption matrices are generated for the encryption stage

Step 8: the first encryption, encrypting the extracted face image,

Combine the new ciphertext with the original plaintext to produce a new plaintext image .

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

Forward encryption is described as

Output: .

3.2. The Decryption Algorithm

The decryption algorithm is described as follows.

Input: ( is the ciphertext image), secret keys are , and .

Step 1: given the initial key , generate the key of the cryptosystem based on the revised key

Step 2: the keystream of the cryptosystem and are generated.

Step 3: the first decryption is described as follows.

The decryption process of forward encryption:

The decryption process of the backward encryption:

Step 4: extract the face part for the second decryption

Step 5: replace the first decrypted face part .

Output: .

4. Simulation Experiments

4.1. Visualization

In the cryptographic system, select , , , , and as the initial keys for visual analysis. The size of images are . The visual analysis result is shown in Figures 57. Visually, it has a good encryption effect, and the decryption algorithm can restore the plaintext image without loss.

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 Table 1. 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.

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. Figures 8 and 9 are the correlation analysis results of the proposed algorithm.

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 Table 2. In addition, the comparison results with some new methods (Nafise [27], Chai [7], Ayubi [28], and Asgar [29]) are shown in Table 3.

The 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 Figure 10. Histogram analysis shows that the distribution of ciphertext histograms is uniform, so the proposed algorithm can effectively mask the characteristics of plaintext images

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.

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

The size of images is , 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.

Differential 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 include , and . If the calculation accuracy is , the key space of the proposed algorithm is

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 Figure 11. The initial keys are set to , , , , and . The new keys are set to , , , , and .

Using NPCR and UACI to verify the difference in Figure 11, 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].

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

The information entropy of the proposed algorithm is shown in Table 7. In addition, the comparison results with some new methods (Nafise [27], Chai [7], Ayubi [28], and Asgar [29]) are shown in Table 8.

The local information entropy of the proposed algorithm is shown in Table 9. 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].

Information 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 Figure 12.

The Peak Signal-to-Noise Ratio (PSNR) metric is commonly used to measure the resiliency of an image and calculated as [35]

Robustness of algorithms is tested by PSNR which are shown in Table 10.

The 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.

The speed analysis shows that the encryption efficiency of the proposed algorithm is very fast, and it takes 0.336 s to process a 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.

Data Availability

The data used to support the findings of this study are included within the article.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

This research was supported by the National Natural Science Foundation of China (61802212).