A method for encrypting and decrypting face images
Through an encryption method that combines hash functions and 2D-LSCM chaotic mapping, the face area is encrypted using synchronous scrambling and diffusion, which solves the problems of resource waste and redundant information in the existing technology, and achieves efficient and secure images. Encryption, especially the protection of the face area.
Patent Information
- Application Number
- CN202410977632.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-22
AI Technical Summary
Existing face image encryption algorithms usually encrypt the entire image, resulting in a waste of resources and the existence of redundant information. They also lack localized processing of the face area, making it difficult to make full use of chaos characteristics to improve encryption efficiency and security.
The hash function is used to generate the secret key of the encryption system, combined with 2D-LSCM chaos mapping to generate the key stream of the encryption system, the facial information in the face image is identified and the location is recorded, and the facial information is encrypted through simultaneous scrambling and diffusion. And the original image is obtained through the decryption process, and the encryption security is evaluated through adjacent pixel correlation analysis.
By processing face areas locally, computing resource overhead is reduced, encryption efficiency and security are improved, the ability to resist attacks is increased, and user privacy is effectively protected, especially when transmitting or storing images of face information.
Smart Images

Figure CN118505480B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image encryption technology, and in particular to a method for encrypting and decrypting a face image. Background Art
[0002] With the rapid development of computer and Internet technology, multimedia information transmission has become increasingly popular and indispensable. However, the open and shared network environment poses a huge threat to information transmission, which may cause immeasurable damage. In data transmission, images play a vital role, so the importance of image encryption has gradually become prominent. In this context, the key role of face image encryption is particularly emphasized, because the face is one of the most personal and sensitive parts of the image, and its encryption can effectively protect personal privacy and sensitive information.
[0003] Chaotic image encryption uses the nonlinear and random characteristics of chaotic dynamic systems to protect the security of images. The disorder and sensitivity of chaotic systems and their dependence on initial conditions give them unique advantages in the field of image encryption. Traditional face encryption algorithms usually encrypt the entire image, which leads to a waste of resources because in an image containing a face, the parts other than the face image can be regarded as redundant information.
[0004] In order to make more effective use of chaotic characteristics, a regional encryption method can be considered to focus on protecting the area containing the face, while performing a lighter weight processing on the rest. This can improve the overall efficiency by applying the chaotic encryption algorithm to the face area of interest. This strategy can not only reduce the overhead of computing resources, but also respond more flexibly to the characteristics of different images.
[0005] In addition, the periodicity and ergodicity of chaotic image encryption can also be used to design more secure encryption algorithms. By cleverly combining these characteristics of chaos, a more complex and powerful image encryption system can be constructed to improve the ability to resist attacks. Therefore, in the field of chaotic image encryption, further optimizing and innovating encryption algorithms, especially localized processing of face areas, will help to protect image information more efficiently and securely. Summary of the invention
[0006] The technical problem to be solved by the present invention is to provide a method for encrypting and decrypting a face image, the main steps of which include using a hash function to generate a secret key of an encryption system, combining a 2D-LSCM chaotic map to generate a key stream of a cryptographic system, identifying facial information in a face image and recording the position, encrypting the facial information by synchronous scrambling and diffusion, and finally obtaining the original image through a decryption process. In this method, security is assessed by analyzing the correlation between adjacent pixels. The combination of chaotic mapping and hash functions provides a complex encryption mechanism, and encrypting facial information by synchronous scrambling and diffusion increases security.
[0007] The present invention adopts the following technical solutions to achieve the invention objectives:
[0008] A method for encrypting and decrypting a face image, characterized in that it comprises the following steps:
[0009] S1: Generate a system key for encryption using a hash function based on the plaintext image;
[0010] S2: Use the secret key generated by S1 and combine it with 2D-LSCM chaotic mapping to generate the key stream for the cryptographic system;
[0011] S3: Identify facial information in the input face image and record the position of each facial information;
[0012] S4: Encrypt the facial information by synchronous scrambling and diffusion. The key stream required for encryption is generated by S2 to obtain the encrypted facial information image.
[0013] S5: Using the reverse process of encryption, the encrypted facial information image is decrypted using the secret key generated by S2 to obtain the original face image;
[0014] S6: The security of this encryption method is evaluated by analyzing the correlation between adjacent pixels to ensure the effectiveness and protection capabilities of the encryption process.
[0015] As a further limitation of the present technical solution, S1 specifically includes:
[0016] For a face image , the number of pixel values of the length of the image is , the number of pixel values in the image height is , using a hash function to generate the secret key of the cryptographic system, where is the input of the hash function;
[0017] Use the hash 256 function to generate the secret key of the cryptographic system , the secret key Divide into equal parts, each containing 16 bits, convert the binary system to decimal, and get 16 decimal sub-keys, which are ;
[0018] This secret key Converted to the initial value of 2D-LSCM chaotic mapping,
[0019] (1);
[0020] in: is the initial value of the 2D-LSCM chaotic map;
[0021] mod is the modulo function.
[0022] As a further limitation of the present technical solution, S2 specifically includes:
[0023] S21: 2D-LSCM, its expression is:
[0024] (2);
[0025] in: It is The state value at the moment;
[0026] It is The state value at the moment;
[0027] is the control parameter;
[0028] S22: Initial value of 2D-LSCM chaotic map generated according to S1 , using 2D-LSCM chaotic mapping to generate the key stream of the cryptographic system;
[0029] (3);
[0030] (4);
[0031] S23: Based on key stream Generate the key stream required for diffusion ,
[0032] (5);
[0033] in: floor is the rounding function;
[0034] S24: Based on key stream Generate the secret key stream required for scrambling ,
[0035] (6);
[0036] (7);
[0037] (8);
[0038] in: By default, the first column is in ascending order. If the first columns are the same, the second column is in ascending order, and so on.
[0039] Z is the matrix to be sorted;
[0040] L It is based on Z The number of columns or column vector to sort;
[0041] B is the result of sorting the original matrix in ascending order of the specified column.
[0042] As a further limitation of the present technical solution, S3 specifically includes:
[0043] Use face detection algorithms to identify facial information in images and record the location of facial areas , and upload the coordinates to the encryption system.
[0044] As a further limitation of the present technical solution, S4 specifically includes:
[0045] The location of the facial information of the face is recorded as:
[0046] (9);
[0047] in: is the location of the facial information identified in S3;
[0048] The encryption algorithm for synchronous scrambling and diffusion is:
[0049] (10);
[0050] when hour,
[0051] (11);
[0052] when hour,
[0053] (12);
[0054] when , hour,
[0055] (13);
[0056] in: is a ciphertext image;
[0057] The ciphertext image Embedded into original image In the example above, we get the encrypted face image .
[0058] As a further limitation of the present technical solution, S5 specifically includes:
[0059] The encryption method is a reversible process, using a secret key With ciphertext The original image can be obtained;
[0060] By secret key The key stream is obtained by 2D-LSCM chaotic mapping , through the encrypted face image , get the ciphertext , the decryption steps are:
[0061] (14);
[0062] when hour,
[0063] (15);
[0064] when hour,
[0065] (16);
[0066] when hour,
[0067] (17);
[0068] Will decrypt the image Embed in , and get the original image.
[0069] As a further limitation of the present technical solution, S6 specifically includes:
[0070] The calculation method of the correlation between adjacent pixels is:
[0071] (18);
[0072] (19);
[0073] in: Represents the adjacent pixel values;
[0074] Yes all The mean of
[0075] Yes all The mean of
[0076] Represent all Expected value;
[0077] Represent all Expected value;
[0078] represent and The correlation coefficient of
[0079] N It is the number of adjacent elements taken. The closer the correlation between adjacent pixels is to 0, the stronger the algorithm's ability to resist statistics is.
[0080] Compared with the prior art, the advantages and positive effects of the present invention are: the present invention avoids redundant encryption of the entire image by localized processing of the face area, thereby reducing the cost of computing resources. Compared with redundant encryption of the entire image, the present invention reduces the cost of computing resources required for encryption by localized processing of the face area. This method can improve encryption efficiency, especially for large-size images or video data. The present invention makes full use of the nonlinear and random characteristics of the chaotic dynamics system to increase the complexity and security of the encryption algorithm. The chaotic dynamics system has a high degree of randomness and unpredictability, making it more difficult for attackers to crack the encryption algorithm. The facial information is encrypted by synchronous scrambling and diffusion, which further increases the security of the encryption algorithm. The attacker needs to crack the scrambling and diffusion algorithms at the same time, which undoubtedly brings great challenges to the attacker. By localized processing of the face area, the present invention can better protect the privacy of users, especially when images containing face information need to be transmitted or stored. This personalized security allows users to share or store their digital images more confidently without worrying about the risk of privacy leakage. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] Figure 1 It is a flow chart of the present invention.
[0082] Figure 2 The facial recognition result of the face image provided by the embodiment of the present invention; Figure 2 (a) is the original picture of Lena. Figure 2 (b) is the face part of Lena. Figure 2 The middle (c) is the original picture of Girlface. Figure 2 Middle (d) is the facial part of the Girlface image.
[0083] Figure 3 Lena encryption and decryption diagram provided for an embodiment of the present invention; Figure 3 (a) is the original picture of Lena. Figure 3 (b) is the Lena encryption graph. Figure 3 (c) is Lena’s decryption graph.
[0084] Figure 4 The Girlface encryption and decryption diagram provided by the embodiment of the present invention; Figure 4 (a) is the original picture of Girlface. Figure 4 (b) is the encrypted image of Girlface. Figure 4 (c) in the middle is the decrypted image of Girlface. DETAILED DESCRIPTION
[0085] A specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings, but it should be understood that the protection scope of the present invention is not limited by the specific implementation.
[0086] The present invention comprises the following steps:
[0087] S1: Based on the plaintext image, a hash function is used to generate a system key for encryption.
[0088] In specific implementation, as a preferred embodiment of the present invention, the S1 specifically includes:
[0089] For a face image , the number of pixel values of the length of the image is , the number of pixel values in the image height is , using a hash function to generate the secret key of the cryptographic system, where is the input of the hash function;
[0090] Use the hash 256 function to generate the secret key of the cryptographic system , the secret key Divide into equal parts, each containing 16 bits, convert the binary system to decimal, and get 16 decimal sub-keys, which are ;
[0091] This secret key Converted to the initial value of 2D-LSCM chaotic mapping,
[0092] (1);
[0093] in: is the initial value of the 2D-LSCM chaotic map;
[0094] mod is the modulo function.
[0095] S2: Use the secret key generated by S1 and combine it with the 2D-LSCM chaotic map to generate the key stream for the cryptographic system.
[0096] In specific implementation, as a preferred embodiment of the present invention, S2 specifically includes:
[0097] S21: 2D-LSCM was proposed by Hua and its expression is:
[0098] (2);
[0099] in: It is The state value at the moment;
[0100] It is The state value at the moment;
[0101] is the control parameter;
[0102] S22: Initial value of 2D-LSCM chaotic map generated according to S1 , using 2D-LSCM chaotic mapping to generate the key stream of the cryptographic system;
[0103] (3);
[0104] (4);
[0105] S23: Based on key stream Generate the key stream required for diffusion ,
[0106] (5);
[0107] in: floor is the rounding function;
[0108] S24: Based on key stream Generate the secret key stream required for scrambling ,
[0109] (6);
[0110] (7);
[0111] (8);
[0112] in: By default, the first column is in ascending order. If the first columns are the same, the second column is in ascending order, and so on.
[0113] Z is the matrix to be sorted;
[0114] L It is based on Z The number of columns or column vector to sort;
[0115] B is the result of sorting the original matrix in ascending order of the specified column.
[0116] S3: Identify facial information in the input face image and record the position of each facial information.
[0117] In specific implementation, as a preferred embodiment of the present invention, S3 specifically includes:
[0118] Use face detection algorithms to identify facial information in images and record the location of facial areas , and upload the coordinates to the encryption system.
[0119] The facial information is encrypted by synchronous scrambling and diffusion. The key stream required for encryption is generated by S2 to obtain the encrypted facial information image.
[0120] In specific implementation, as a preferred embodiment of the present invention, the S4 specifically includes:
[0121] The location of the facial information of the face is recorded as:
[0122] (9);
[0123] in: is the location of the facial information identified in S3;
[0124] The encryption algorithm for synchronous scrambling and diffusion is:
[0125] (10);
[0126] when hour,
[0127] (11);
[0128] when hour,
[0129] (12);
[0130] when , hour,
[0131] (13);
[0132] in: is a ciphertext image;
[0133] The ciphertext image Embedded into original image In the example above, we get the encrypted face image .
[0134] S5: Using the reverse process of encryption, the encrypted facial information image is decrypted using the secret key generated by S2 to obtain the original face image.
[0135] In specific implementation, as a preferred embodiment of the present invention, the S5 specifically includes:
[0136] The encryption method is a reversible process, using a secret key With ciphertext The original image can be obtained;
[0137] By secret key The key stream is obtained by 2D-LSCM chaotic mapping , through the encrypted face image , get the ciphertext , the decryption steps are:
[0138] (14);
[0139] when hour,
[0140] (15);
[0141] when hour,
[0142] (16);
[0143] when hour,
[0144] (17);
[0145] Will decrypt the image Embed in The original image is obtained. This patent adopts a symmetric cryptographic system, so the decrypted image is consistent with the original image. Figure 3 (a) and Figure 3 The same as the image in (c), Figure 4 (a) and Figure 4 Same as the image in (c).
[0146] S6: The security of this encryption method is evaluated by analyzing the correlation between adjacent pixels to ensure the effectiveness and protection capabilities of the encryption process.
[0147] The S6 specifically includes:
[0148] The calculation method of the correlation between adjacent pixels is:
[0149] (18);
[0150] (19);
[0151] in: Represents the adjacent pixel values;
[0152] Yes all The mean of
[0153] Yes all The mean of
[0154] Represent all Expected value;
[0155] Represent all Expected value;
[0156] represent and The correlation coefficient of
[0157] N It is the number of adjacent elements taken. The closer the correlation between adjacent pixels is to 0, the stronger the algorithm's ability to resist statistics is.
[0158] Table 1 Correlation analysis
[0159] image Plain text level Plain text vertical Plaintext diagonal Cipher Level Redaction Vertical Cipher Diagonal Lena 0.970 0.984 0.950 0.005 0.001 -0.002 Girlface 0.983 0.982 0.973 0.002 0.001 -0.006
[0160] The security of this encryption method is evaluated by analyzing the correlation between adjacent pixels to ensure the effectiveness and protection capabilities of the encryption process.
[0161] The above disclosure is only a specific embodiment of the present invention, but the present invention is not limited thereto, and any changes that can be conceived by those skilled in the art should fall within the protection scope of the present invention.
Claims
1. A method for encrypting and decrypting facial images. It is characterized in that The following steps are involved: S1: Generate a system key for encryption using a hash function based on the plaintext image; S2: Use the secret key generated by S1 and combine it with 2D-LSCM chaotic mapping to generate the key stream for the cryptographic system; S3: Identify facial information in the input face image and record the position of each facial information; S4: Encrypt the facial information by synchronous scrambling and diffusion. The key stream required for encryption is generated by S2 to obtain the encrypted facial information image. S5: Using the reverse process of encryption, the encrypted facial information image is decrypted using the secret key generated by S2 to obtain the original face image; S6: Evaluate the security of this encryption method by analyzing the correlation between adjacent pixels to ensure the effectiveness and protection capability of the encryption process; The S1 specifically includes: For a face image , the number of pixel values of the length of the image is , the number of pixel values in the image height is , using a hash function to generate the secret key of the cryptographic system, where is the input of the hash function; Use the hash 256 function to generate the secret key of the cryptographic system , the secret key Divide into equal parts, each containing 16 bits, convert the binary system to decimal, and get 16 decimal sub-keys, which are ; This secret key Converted to the initial value of 2D-LSCM chaotic mapping, (1); in: is the initial value of the 2D-LSCM chaotic map; mod is the modulo function; The S2 specifically includes: S21: 2D-LSCM, its expression is: (2); in: It is The state value at the moment; It is The state value at the moment; is the control parameter; S22: Initial value of 2D-LSCM chaotic map generated according to S1 , using 2D-LSCM chaotic mapping to generate the key stream of the cryptographic system; (3); (4); S23: Based on key stream Generate the key stream required for diffusion , (5); in: floor is the rounding function; S24: Based on key stream Generate the secret key stream required for scrambling , (6); (7); (8); in: By default, the first column is in ascending order. If the first columns are the same, the second column is in ascending order, and so on. Z is the matrix to be sorted; L It is based on Z The number of columns or column vector to sort; B is the result of sorting the original matrix in ascending order of the specified columns; The S4 specifically includes: The location of the facial information of the face is recorded as: (9); in: is the location of the facial information identified in S3; The encryption algorithm for synchronous scrambling and diffusion is: (10); when hour, (11); when hour, (12); when , hour, (13); in: is a ciphertext image; The ciphertext image Embedded into original image In the example above, we get the encrypted face image .
2. The method for encrypting and decrypting a facial image according to claim 1, Features: The S3 specifically includes: Use face detection algorithms to identify facial information in images and record the location of facial areas , and upload the coordinates to the encryption system.
3. The method for encrypting and decrypting a facial image according to claim 2, Features: The S5 specifically includes: The encryption method is a reversible process, using a secret key With ciphertext The original image can be obtained; By secret key The key stream is obtained by 2D-LSCM chaotic mapping , through the encrypted face image , get the ciphertext , the decryption steps are: (14); when hour, (15); when hour, (16); when hour, (17); Will decrypt the image Embed in , and get the original image.
4. The method for encrypting and decrypting a face image according to claim 3, Features: The S6 specifically includes: The calculation method of the correlation between adjacent pixels is: (18); (19); in: Represents the adjacent pixel values; Yes all The mean of Yes all The mean of Represent all Expected value; Represent all Expected value; represent and The correlation coefficient of N It is the number of adjacent elements taken. The closer the correlation between adjacent pixels is to 0, the stronger the algorithm's ability to resist statistics is.
