Facial image encryption method, decryption method and image processing device
Through four-dimensional hyperchaotic system and DNA coding technology, combined with hash value grouping and external keys, efficient local encryption of facial images is achieved, which solves the problems of small key space and low security in existing technologies and enhances the encryption effect and anti-attack capability of facial images.
Patent Information
- Application Number
- CN202511127398.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-13
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-08-13
AI Technical Summary
Existing facial image encryption methods have low security due to small key space, high complexity of chaotic system, simple scrambling and diffusion methods, insufficient encryption randomness of DNA coding technology, lack of local encryption targeting, sensitivity to light and posture changes, and weak anti-attack capabilities.
A four-dimensional hyperchaotic system is used to generate multiple chaotic sequences. The intermediate key is generated by group XOR of SHA-256 hash values. The initial value is calculated by combining with the external key. Then, circular hierarchical scrambling, bit plane splicing, V-selective scrambling and dynamic bit-level DNA cross-coding are performed on facial images to achieve local encryption and high-complexity encryption of facial images.
The key space is enhanced, the encryption flexibility and security are improved, the attack difficulty is increased, and efficient pixel value diffusion and information entropy enhancement are achieved. It is suitable for the secure transmission and storage of facial images.
Smart Images

Figure CN120658372A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image encryption technology, and more specifically, relates to a facial image encryption method, a decryption method and an image processing device. Background Art
[0002] With the rapid development of artificial intelligence and the Internet of Things (IoT), facial recognition, as a core technology for biometric authentication, has become deeply integrated into key areas such as smart security, financial payments, and medical diagnosis. Authoritative organizations predict that the global volume of facial recognition-related data will exceed 100 billion frames by 2025, with smart surveillance scenarios alone generating billions of frames of facial image data daily. Because this data contains unique biometric information, its security has become a core challenge for both academia and industry. Once leaked or tampered with, it can trigger chain reactions such as identity theft and privacy violations.
[0003] The application of chaos theory to cryptography offers new insights into image encryption. Digital images inherently possess large spatial volumes and high correlations, necessitating a unique pseudo-random number generator. Chaotic systems are excellent pseudo-random number generators, and their high sensitivity to seed and control factors makes them an ideal platform for generating high-quality pseudo-random numbers. This property enables chaos-based encryption algorithms to effectively resist various cryptanalysis attacks, enhancing the security of encryption systems.
[0004] However, current image encryption methods based on chaotic systems have the following defects and shortcomings: (1) They are vulnerable to chosen plaintext attacks and have a small key space, which limits the flexibility and reliability of the encryption system; (2) Although increasing the complexity of the chaotic system can improve security, it may also lead to increased computational costs and complex algorithm implementation; (3) When using chaotic sequences for encryption, the scrambling and diffusion methods are relatively simple and have low security; (4) The application of DNA coding technology in image encryption faces challenges such as poor coding rule stability and simple arithmetic operations, resulting in insufficient encryption randomness. In addition, facial images are sensitive biometric data, and existing encryption methods are mostly targeted at the entire image, lacking the targetedness of local encryption, and have defects such as sensitivity to changes in lighting and posture, and weak anti-attack capabilities. Summary of the Invention
[0005] In response to the defects of the existing technology, the purpose of the present invention is to provide an image encryption method, an image decryption method and an image processing device, aiming to solve the problems of small key space, high complexity of chaotic system, low security due to relatively simple scrambling and diffusion methods, and insufficient encryption randomness due to DNA encoding technology.
[0006] To achieve the above-mentioned objectives, in a first aspect, the present invention provides a facial image encryption method, which comprises: obtaining a grayscale image of an image to be encrypted, and extracting a facial image from the grayscale image; performing group XOR on the SHA-256 hash values of the facial image to generate multiple intermediate keys; using an external key and multiple intermediate keys to calculate the initial values of the state variables of a four-dimensional hyperchaotic system; using the four-dimensional hyperchaotic system and the initial values of the state variables to generate a first chaotic sequence to a fourth chaotic sequence; dividing the facial image into a plurality of annular layers, and performing a spatial position scrambling operation on each annular layer using a first chaotic sequence to obtain a first matrix; using a second chaotic sequence to perform bit plane splicing and V selection scrambling operations on the first matrix to obtain a second matrix; using the first chaotic sequence to perform dynamic bit-level DNA cross-coding on the second matrix to obtain a DNA coding sequence; using the first chaotic sequence to the fourth chaotic sequence to perform DNA arithmetic operations on the DNA coding sequence to obtain an encrypted facial image; and splicing the encrypted facial image with a non-facial image to obtain a final ciphertext image.
[0007] Preferably, the calculation formula of the intermediate key is: in, The SHA-256 hash values of the facial images are grouped into The SHA-256 hash value grouping rule of the facial image is as follows: the SHA-256 hash values are divided into a subgroup of 8-bit hash values in sequence, to obtain 32 subgroups of 8-bit hash values; the 32 subgroups of 8-bit hash values are divided into a group of 4 subgroups of 8-bit hash values in sequence, is the bitwise exclusive OR operator, .
[0008] Preferably, the calculation of the initial state value of the four-dimensional hyperchaotic system is as follows: in, are the initial state values of the four-dimensional hyperchaotic system, There are four external keys respectively. is a modular operation, For the An intermediate key, .
[0009] Preferably, the equation of the four-dimensional hyperchaotic system is: in, are the four control parameters of the four-dimensional hyperchaotic system, are the four state variables of the four-dimensional hyperchaotic system, is the fourth-dimensional state variable introduced on the basis of Chen's chaotic system. They are the first chaotic sequence, second chaotic sequence, third chaotic sequence and fourth chaotic sequence of the four-dimensional hyperchaotic system.
[0010] Preferably, the first chaotic sequence is used to perform a spatial position scrambling operation on each annular layer to obtain a first matrix, specifically as follows: for each odd-numbered annular layer, a folding and pixel pair exchange strategy is used to perform a position scrambling operation; for each even-numbered annular layer, a chaotic controlled rotation strategy is used to perform a position scrambling operation; the position scrambling results corresponding to all annular layers are spliced according to the spatial position of the facial image to obtain the first matrix.
[0011] Preferably, the second chaotic sequence is used to perform bit plane splicing and V-selection scrambling operations on the first matrix to obtain the second matrix, specifically as follows: 8 bits of each pixel in the first matrix are split into 4 dual-bit planes to form 4 binary matrices; the 4 binary matrices are spliced along the diagonal direction to obtain a spliced matrix; pixel bits are extracted from the spliced matrix according to a V-shaped path to form a plurality of V-shaped bit matrices; each V-shaped bit matrix is sorted and reorganized using the second chaotic sequence; each pixel in the reorganized V-shaped bit matrix is converted into a decimal pixel value to obtain the second matrix.
[0012] Preferably, the method of using the first chaotic sequence to perform dynamic bit-level DNA cross-coding on the second matrix to obtain a DNA coding sequence is as follows: using the first chaotic sequence to generate a first coding rule sequence for controlling bit exchange and a second coding rule sequence for selecting DNA coding rules; flattening the second matrix into a one-dimensional sequence and pairing the end to the end; using the first coding rule sequence to exchange the corresponding bit of each paired pixel, and converting each pixel in the exchanged sequence into a binary pixel value; using the second coding rule sequence to perform DNA encoding on the converted sequence to obtain a DNA coding sequence.
[0013] Preferably, the method of using the first chaotic sequence to the fourth chaotic sequence to perform DNA arithmetic operations on the DNA coding sequence to obtain an encrypted facial image is as follows: using the second half data of the third chaotic sequence to generate a corresponding third coding rule sequence; using the second half data of the fourth chaotic sequence to generate a corresponding fourth coding rule sequence; using the third coding rule sequence to encode the first half data from the third chaotic sequence to obtain a first DNA operand sequence; using the fourth coding rule sequence to encode the first half data from the fourth chaotic sequence to obtain a second DNA operand sequence; performing a modulo 4 operation on the second half data from the first chaotic sequence to obtain a DNA operation selection factor; performing a DNA arithmetic operation on the first DNA operand sequence and the DNA coding sequence according to the DNA operation selection factor to obtain an intermediate diffusion matrix; performing a DNA arithmetic operation on the second DNA operand sequence and the intermediate diffusion matrix according to the DNA operation selection factor to obtain an encrypted DNA coding sequence; using the first half data of the second chaotic sequence to generate a decoding rule sequence; using the decoding rule sequence to decode the encrypted DNA coding sequence; converting each pixel in the decoding result into a decimal pixel value to obtain an encrypted facial image.
[0014] To achieve the above-mentioned purpose, in a second aspect, the present invention provides a facial image decryption method, which is used to decrypt the final ciphertext image generated by the encryption method as described in the first aspect to obtain the complete original image, and the decryption method and the encryption method are inverse operations of each other.
[0015] To achieve the above-mentioned objectives, in a third aspect, the present invention provides an image processing device, comprising: a memory for storing a computer program; and a processor for implementing the steps of the encryption method described in the first aspect, or the steps of the decryption method described in the second aspect, when executing the computer program.
[0016] It can be understood that the beneficial effects of the second to third aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.
[0017] In general, the above technical solutions conceived by the present invention have the following beneficial effects compared with the prior art:
[0018] (1) The present invention provides a facial image encryption method, which performs group XOR on the SHA-256 hash value of the facial image to generate multiple intermediate keys, uses the external key and the multiple intermediate keys to calculate the initial values of the state variables of a four-dimensional hyperchaotic system, and uses the four-dimensional hyperchaotic system and the initial values of the state variables to generate the first chaotic sequence to the fourth chaotic sequence as the key. This application introduces an external key in the process of calculating the initial state value of the hyperchaotic system, which can enhance encryption flexibility and expand the key space. Even if an attacker obtains the hash value (internal key) of the image, he still needs to crack the external key to derive the initial state value of the complete hyperchaotic system, which increases the difficulty of the attack.
[0019] (2) The present invention provides a facial image encryption method. In order to balance encryption speed and security (such as real-time video streaming, Internet of Things device transmission), or scenarios with limited computing resources, a new four-dimensional hyperchaotic system is constructed. The Chen chaotic system is selected. Its system parameter design is more intuitive and its stability analysis is more mature. By introducing the fourth-dimensional state variable, while maintaining a high complexity, the computational complexity is relatively controllable and has efficient nonlinear scalability.
[0020] (3) The present invention provides a facial image encryption method, which divides the facial image into several annular layers, uses a first chaotic sequence to perform spatial position scrambling operations on each annular layer to obtain a first matrix, thereby realizing "position scrambling" to destroy the spatial structure of the image and increase the complexity of encryption; uses a second chaotic sequence to perform bit plane splicing and V selection scrambling operations on the first matrix to obtain a second matrix, thereby realizing "pixel value scrambling", and the information entropy of the image is significantly improved.
[0021] (4) The present invention provides a facial image encryption method, which uses a first chaotic sequence to perform dynamic bit-level DNA cross-coding on a second matrix to obtain a DNA coding sequence, thereby realizing cross-pixel bit exchange, further disrupting the pixel values, and turning the image into unrecognizable noise; and uses the first to fourth chaotic sequences to perform DNA arithmetic operations on the DNA coding sequence to obtain an encrypted facial image, thereby achieving high diffusion of pixel values and further enhancing the encryption effect.
[0022] (5) The present invention provides a facial image encryption method, which obtains a grayscale image of the image to be encrypted, extracts the facial image from the grayscale image, and encrypts only a portion of the facial image. The encryption complexity is high and the method is suitable for the secure transmission and storage of facial images. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is a flow chart of a facial image encryption method provided by the present invention.
[0024] Figure 2This is a flow chart of a facial image decryption method provided by the present invention.
[0025] Figure 3 Schematic diagram of the original image and the encrypted image provided by the present invention, wherein (a) is the original image and (b) is the encrypted image.
[0026] Figure 4 These are the original image histogram and the encrypted image histogram provided by the present invention, wherein (a) is the original image histogram and (b) is the encrypted image histogram. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0028] As used herein, the term "and / or" describes an association between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. As used herein, the symbol " / " indicates that the associated objects are in an "or" relationship. For example, A / B means either A or B.
[0029] In the present invention, the terms "first" and "second" are used to distinguish different objects, rather than to describe a specific order of objects. For example, the terms "first response message" and "second response message" are used to distinguish different response messages, rather than to describe a specific order of response messages.
[0030] In the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present invention should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0031] In the description of the present invention, unless otherwise specified, “plurality” means two or more than two, for example, a plurality of processing units means two or more than two processing units, etc.; a plurality of elements means two or more than two elements, etc.
[0032] The present invention will be described below with reference to the accompanying drawings.
[0033] like Figure 1 As shown, the present invention provides a facial image encryption method, which specifically includes the following steps:
[0034] S10. Based on Chen’s chaotic system, the fourth-dimensional state variable is introduced to construct a new four-dimensional hyperchaotic system.
[0035] In order to balance encryption speed and security (such as real-time video streaming, IoT device transmission), or in scenarios with limited computing resources, the present invention chooses Chen's chaotic system, whose system parameter design is more intuitive and stability analysis is more mature. By introducing the fourth-dimensional state variable, while maintaining high complexity, the computational load is relatively controllable and has efficient nonlinear scalability. Finally, the present invention introduces the fourth-dimensional state variable based on the Chen's chaotic system to construct a new four-dimensional hyperchaotic system, which is expressed as follows: (1) in, are the system parameters of the new four-dimensional hyperchaotic system, are the state variables of the new four-dimensional hyperchaotic system, is the fourth-dimensional state variable introduced on the basis of Chen's chaotic system. is the first chaotic sequence of the new four-dimensional hyperchaotic system, is the second chaotic sequence of the new four-dimensional hyperchaotic system, is the third chaotic sequence of the new four-dimensional hyperchaotic system, is the fourth chaotic sequence of the new four-dimensional hyperchaotic system. For example, when , , and When , the Chen chaotic system has two positive Lyapunov exponents and is in a hyperchaotic state.
[0036] S20. Convert the original image into a grayscale image, and use OpenCV's Haar cascade classifier to extract facial images and non-facial images from the grayscale image.
[0037] After obtaining the original image, since the main focus is on the facial image, the present invention first performs face detection, preferably using the Haar cascade classifier for face detection in OpenCV. The specific file is haarcascade_frontalface_default.xml. The original image may be a color image. To reduce computational complexity, the present invention uses cv2.cvtColor in OpenCV to convert it to a grayscale image. Then load the haarcascade_frontalface_default.xml classifier and use the detectMultiScale function to detect the face. This will get the coordinates of the facial image, so that you can accurately Extract facial images , whose size is , while extracting non-face images After this step, the target area is clearly defined for subsequent encryption operations.
[0038] Compared with the facial image extraction method based on deep learning models, this application prefers to use the Haar cascade classifier for face detection in OpenCV, which can quickly extract facial images and achieve millisecond-level detection even in high-resolution images; the deep learning-based model requires GPU (Graphics Processing Unit) acceleration to achieve real-time effects, and the encryption algorithm is usually run on edge devices (such as cameras and mobile phones). In resource-constrained environments, the Haar cascade classifier is considered a better choice; the model file of the Haar cascade classifier is only a few MB, while the model file of the deep learning model is often hundreds of MB. For the detection module that needs to be embedded in the encryption process, lightweighting can directly reduce the system complexity and avoid introducing additional dependencies; although deep learning performs better in complex scenes (such as occlusion and extreme lighting), the Haar cascade classifier still has a high recall rate in the detection of standard frontal faces. The encryption algorithm is usually targeted at faces collected in compliance with regulations (such as ID photos and surveillance videos). At this time, the false detection / missed detection rate of the Haar cascade classifier is acceptable, and the pre-trained model of OpenCV has been verified by massive data and has strong generalization. Therefore, selecting the Harr cascade classifier can ensure the real-time performance of the encryption process, so that the encryption method proposed in the present invention can be better applied to chaotic iteration or pixel diffusion.
[0039] S30. Perform a SHA-256 hash operation on the facial image and perform an XOR operation on the image in groups to obtain a number of intermediate keys. Calculate the initial state value of a new four-dimensional hyperchaotic system based on the external key and the number of intermediate keys. Substitute the initial state value into the new four-dimensional hyperchaotic system to obtain a first chaotic sequence, a second chaotic sequence, a third chaotic sequence, and a fourth chaotic sequence.
[0040] The facial image to be encrypted is determined by S20 After that, it is necessary to generate a key for the encryption process, which is the core parameter initialization step of the encryption operation. In order to ensure the security of encryption and Figure 1 The present invention combines facial images with and external keys To generate the initial state value of the new four-dimensional hyperchaotic system. First, the facial image is hashed and XORed in groups to obtain several intermediate keys.
[0041] For facial images Perform SHA-256 hash operation to obtain a 256-bit hash value Here, the 256-bit hash value is divided into groups of 8 bits in sequence, for a total of 32 groups of 8-bit hash values. Then, the 32 groups of 8-bit hash values are divided into groups of 4 groups of 8-bit hash values in sequence. After two groupings, the XOR operation is performed to calculate several intermediate keys. Intermediate Key The calculation formula is expressed as: (2) in, is the first one selected from the SHA-256 hash value Intermediate Key The corresponding 4 groups of 8-bit hash values are grouped together. It is a bitwise XOR operator, the same is 0, and different is 1. Through formula (2), 32 groups of 8-bit hash values can be grouped and integrated into 8 8-bit intermediate key values , increasing randomness and security.
[0042] Compared with SHA-512, the present invention chooses SHA-256 hash operation for the following reasons: the hash value length of SHA-512 is 512 bits, and the complexity of generation and processing is slightly higher than SHA-256. However, in image encryption, the complex operations of the hyperchaotic system itself (such as hyperchaotic iteration and DNA encoding) may become a computing bottleneck, while the use of SHA-256 can reduce redundant calculations while ensuring security; the initial conditions of the hyperchaotic system (such as ) usually needs to be converted to a floating-point type (such as a double-precision number in the range of [-10,10]). The 256-bit output of SHA-256 can be directly split into four 64-bit integers and used as the initial state value of the chaotic system after normalization. The mapping process is simpler. Therefore, under the premise of meeting encryption security, hash functions that match the dimension of the chaotic system, have higher computational efficiency, and are simpler in engineering implementation are preferred. The 256-bit output of SHA-256 is just suitable for the initial state value generation requirements of the four-dimensional hyperchaotic system. At the same time, it is superior to SHA-512 in speed, compatibility, and resource usage, making it an ideal choice for medium-security scenarios such as facial image encryption.
[0043] Furthermore, the present invention calculates the initial values of the state variables of the new four-dimensional hyperchaotic system based on the external key and several intermediate keys, which can be expressed as follows: (3) in, 、 、 、 are the initial state values of the new four-dimensional hyperchaotic system, and their value ranges are , 、 、 、 are four external keys, is a modular operation, For the An intermediate key, , , is the bitwise exclusive OR operator, 、 、 、 For the Intermediate Key The corresponding four groups of 8-bit hash values are grouped together. The present invention introduces an external key in the calculation process of the initial state value of the hyperchaotic system, which can enhance encryption flexibility and expand the key space. Even if an attacker obtains the hash value (internal key) of the image, he still needs to crack the external key to derive the initial state value of the complete hyperchaotic system, which increases the difficulty of the attack.
[0044] The present invention combines the hash value and the external key to generate the initial state value of the hyperchaotic system, which provides a basis for the subsequent generation of chaotic sequences. Finally, these initial state values are substituted into the new four-dimensional hyperchaotic system shown in formula (1) to obtain the first chaotic sequence , the second chaotic sequence , the third chaotic sequence , the fourth chaos sequence , The length of each sequence is 2MN, and these chaotic sequences will play a key role in subsequent encryption operations. These are four highly random digital sequences that play a role in the "position scrambling", "pixel value scrambling" and "value diffusion" stages of image encryption. Their complexity and randomness directly determine the security of the encrypted image. In simple terms, the first chaotic sequence and the second chaotic sequence Perform scrambling operations on the "position" and "value" of image pixels respectively; and Used for DNA encoding, it further "hides" the image pixel values, turning the image into unrecognizable noise. These four chaotic sequences together form the core "random engine" of the encryption algorithm, ensuring that only those with the correct key can restore the image.
[0045] S40. Calculate the number of ring layers when performing ring layer scrambling based on the facial image. For each ring layer, execute the following steps: determine whether the current ring layer is an odd layer or an even layer; if the ring layer is an odd layer, adopt a folding and pixel interaction strategy and use a first chaotic sequence to perform a position scrambling operation on the facial image; if the ring layer is an even layer, adopt a chaos control rotation strategy and use the first chaotic sequence to perform a position scrambling operation on the facial image; and splice the position scrambling results corresponding to all the ring layers according to the spatial position of the facial image to obtain a first scrambling matrix.
[0046] The present invention adopts a folding and pixel interaction strategy and uses a first chaotic sequence to perform a position scrambling operation on a facial image, including:
[0047] Calculate the total number of pixels in all odd-numbered layers of the annular layer ; For the first chaotic sequence Perform modulo 2 operation on each element to get the result, and determine the direction of the folding operation based on the result. is an integer greater than 0; according to the judged folding operation direction, extract from the first chaotic sequence to elements, and perform a modulo 2 operation on the extracted elements to generate an exchange mark; according to the exchange mark, selectively exchange pixel pairs at symmetrical positions in the current annular layer, and convert the exchanged pixel pairs into binary pixel values to achieve the position scrambling operation of the facial image.
[0048] The present invention adopts a chaos controlled rotation strategy and utilizes a first chaotic sequence to perform a position scrambling operation on a facial image, comprising:
[0049] Calculate the total number of pixels in the even layers of all annular layers ; Extracted from the first chaotic sequence to elements, and perform a modulo 4 operation on the extracted elements to generate a rotation count mark; according to the rotation count mark, all pixels in the current annular layer are selectively rotated, and the rotated pixel pairs are converted into binary pixel values to achieve the position scrambling operation of the facial image.
[0050] The present invention obtains a chaotic sequence for controlling encryption operations. After that, the pixel positions are scrambled to destroy the spatial structure of the image and increase the complexity of encryption. , using the first chaotic sequence Perform ring layer scrambling. First, calculate the number of ring layers during ring layer scrambling based on the facial image. The formula for calculating the number of ring layers is: (4) in, represents the number of ring layers, Indicates the size of the face image middle and The smaller value of is a rounding function. Formula (4) can be used to determine how many annular layers the facial image is divided into. For example, The image is divided into 128 layers, each of which is a ring-shaped region. Each ring layer uses a different scrambling strategy based on its parity. Odd-numbered layers (1st, 3rd, 5th, ...) use a "folding + pixel pair swap" operation, while even-numbered layers (2nd, 4th, 6th, ...) use a "chaos controlled rotation" operation.
[0051] For odd-numbered layers, first, Layer-by-layer chaotic sequence Before The element generation layer type marking formula is expressed as: (5) The layer type mark generated by formula (5) is used to determine the folding direction of each odd-numbered annular layer. The first chaotic sequence Before The modulo 2 operation is performed on the elements, and the result is 0 or 1, which is used to determine the direction of the folding operation later. 0 means folding along the main diagonal, and 1 means folding along the secondary diagonal, thereby determining the basic transformation direction of each odd-numbered layer of annular stratification.
[0052] Next, calculate the total number of pixels in all odd layers (Accumulate the number of pixels of each odd layer layer by layer, such as Layer Pixels , =1,3,5,……), then from the first chaotic sequence Extract the to elements (corresponding to odd-numbered layer control segments), generate the exchange mark through modulo 2 operation, and the formula is expressed as: (6) in, Indicates the Layer ring layer exchange mark, Indicates that the pixel pairs with symmetrical positions in the annular layer are not exchanged, This means swapping symmetrical pixel pairs within the annular layer to destroy the spatial correlation of the odd layer. After swapping the pixel pairs in the odd layer, the swapped pixel pairs are converted to binary pixel values.
[0053] For even layers, calculate the total number of pixels in all even layers and from the first chaotic sequence Middle Position extraction after segmentation elements, i.e. extract to elements, and the rotation number mark is generated by modulo 4 operation. The formula is expressed as: (7) in, Indicates the The number of rotations of the ring layer is marked. Corresponding to a 90° clockwise rotation, Corresponding to 180° clockwise, Corresponding to 270° clockwise, Corresponding to 90° counterclockwise, the chaotic control of the rotation direction and number of even-numbered layers is achieved. After the pixels of the even-numbered layers are rotated, the rotated pixels are converted into binary pixel values.
[0054] Finally, the position scrambling results of all the annular layers after processing are spliced according to the spatial position of the facial image to obtain the first scrambling matrix After this step, the positions of image pixels are disrupted and the correlation between adjacent pixels is greatly reduced.
[0055] S50. Perform bit plane splicing and V-selection scrambling operations on the first scrambled matrix using a second chaotic sequence to obtain a second scrambled matrix.
[0056] The present invention uses a second chaotic sequence to perform bit plane splicing and V selection scrambling operations on the first scrambled matrix to obtain a second scrambled matrix, including:
[0057] The 8 bits of each pixel in the first scrambled matrix are split into 4 dual-bit planes to form 4 binary matrices; the 4 binary matrices are spliced along the diagonal direction to obtain a spliced matrix, and pixel bits are extracted from the spliced matrix along a V-shaped path to form several V-shaped bit matrices; each V-shaped bit matrix is sorted and reorganized using a second chaotic sequence, and each pixel in the reorganized V-shaped bit matrix is converted into a decimal pixel value to obtain a second scrambled matrix.
[0058] After completing the scrambling of pixel positions, the present invention also scrambles pixel values, specifically using the second chaotic sequence , for the first scrambled matrix Perform bit plane splicing and V selection scrambling operations. First, the first scrambling matrix The 8 bits of each pixel are split into 4 dual bit planes, forming 4 Then, these four binary matrices are spliced into a large matrix along the diagonal direction, recorded as the splicing matrix, and pixel bits are extracted from the splicing matrix according to the V-shaped path to form multiple V-shaped bit matrices. Then, each V-shaped bit matrix is sorted and reorganized, and the formula is expressed as: (8) In formula (8), Represents the second chaotic sequence Before elements, sort is the sorting function. Using the second chaotic sequence Sorted index obtained by sorting some elements in Each V-shaped bit matrix is sorted and reorganized to scramble the pixel values. Finally, each pixel in the reorganized V-shaped bit matrix is converted into a decimal pixel value to obtain the second scrambled matrix Through this step, the pixel values are also disrupted, and the information entropy of the image is significantly improved.
[0059] S60. Perform dynamic bit-level DNA cross-coding on the second scrambled matrix using the first chaotic sequence to obtain a DNA coding sequence.
[0060] After S40 and S50, the spatial structure and pixel values of the image have been disrupted. However, in order to further enhance the encryption effect, the present invention further performs pixel diffusion so that changes in a single pixel can be spread to the entire image. Specifically, the present invention uses the first chaotic sequence to perform dynamic bit-level DNA cross-coding on the second scrambled matrix to obtain a DNA coding sequence, including:
[0061] The first chaotic sequence is used to generate a first coding rule sequence for controlling bit exchange, and the first chaotic sequence is used to generate a second coding rule sequence for selecting a DNA coding rule. The second scrambled matrix is flattened into a one-dimensional sequence and paired end to end, and the first coding rule sequence is used to exchange the corresponding bit of each paired pixel, and each pixel in the exchanged sequence is converted into a binary pixel value. The converted sequence is DNA-encoded using the second coding rule sequence to obtain a DNA coding sequence.
[0062] For the second scrambled matrix Using the first chaotic sequence Perform dynamic bit-level DNA cross-coding. First, through the first chaotic sequence Generate the first encoding rule sequence, the formula is expressed as: (9) The first coding rule sequence generated by formula (9) As an 8-bit mask, it is used to control which bits need to be swapped. The corresponding part is subjected to a modulo 256 operation to obtain an 8-bit mask value.
[0063] At the same time, using the first chaotic sequence Generate the second encoding rule sequence, the formula is as follows: (10) Formula (10) is used to select one of the eight DNA coding rules. Before Perform modulo 8 operation on each element and add 1 to get an integer between 1 and 8, which is used to select the encoding rule. Then, the second scrambling matrix Flatten into a one-dimensional sequence, pair head to tail, and sequence according to the first encoding rule Exchange the corresponding bits of each pair of pixels. Finally, convert each pixel in the exchanged sequence into a binary pixel value according to the second encoding rule sequence Perform DNA encoding on each pixel in the converted sequence and encode it into a DNA sequence (A / G / C / T) to obtain a DNA coding sequence This step swaps bits across pixels, further scrambling the pixel values.
[0064] S70. Perform DNA arithmetic operations on the DNA coding sequence using the first chaotic sequence, the second chaotic sequence, the third chaotic sequence, and the fourth chaotic sequence to obtain an encrypted facial image.
[0065] The present invention uses a first chaotic sequence, a second chaotic sequence, a third chaotic sequence, and a fourth chaotic sequence to perform DNA arithmetic operations on a DNA coding sequence to obtain an encrypted facial image, including:
[0066] Extract the first half of the data and the second half of the data from the third chaotic sequence and the fourth chaotic sequence respectively; generate a corresponding third coding rule sequence according to the second half of the data extracted from the third chaotic sequence, and generate a corresponding fourth coding rule sequence according to the second half of the data extracted from the fourth chaotic sequence; use the third coding rule sequence to encode the first half of the data extracted from the third chaotic sequence to obtain a first DNA operand sequence, and use the fourth coding rule sequence to encode the first half of the data extracted from the fourth chaotic sequence to obtain a second DNA operand sequence; extract the second half of the data from the first chaotic sequence, and encode the second half of the data extracted from the first chaotic sequence. A DNA operation selection factor is obtained by performing a modulo 4 operation on the first DNA operand sequence and the DNA coding sequence according to the DNA operation selection factor to obtain an intermediate diffusion matrix; a DNA arithmetic operation is performed on the second DNA operand sequence and the intermediate diffusion matrix according to the DNA operation selection factor to obtain an encrypted DNA coding sequence; the first half of the data is extracted from the second chaotic sequence, and a decoding rule sequence is generated according to the first half of the data extracted from the second chaotic sequence; the encrypted DNA coding sequence is decoded using the decoding rule sequence, and each pixel in the decoding result is converted into a decimal pixel value to obtain an encrypted facial image.
[0067] After pixel bit scrambling and DNA encoding, a DNA coding sequence is obtained. , the DNA coding sequence Still has a certain degree of reversibility, the present invention continues to use the third chaotic sequence and the fourth chaos sequence DNA coding sequence Perform DNA arithmetic.
[0068] First, from the third chaotic sequence and the fourth chaos sequence Extract subsequences from:
[0069] Extract the first half of the data from the third chaotic sequence Z and the fourth chaotic sequence W respectively, and record them as: 、 At the same time, the second half of the data is extracted from the third chaotic sequence Z and the fourth chaotic sequence W, respectively, and recorded as: 、 , and then according to the second half of the third chaotic sequence Z Generate the third encoding rule sequence, the formula is expressed as: , and according to the fourth chaotic sequence The second half of the data Generate the fourth encoding rule sequence, the formula is expressed as: .
[0070] Will Each pixel in the sequence is encoded according to the third rule Encoded as 4 DNA bases, the first DNA operand sequence is obtained, denoted as Similarly, Each pixel in the sequence is encoded according to the fourth coding rule Encoded as 4 DNA bases, the second DNA operand sequence is obtained, which is recorded as .
[0071] To control DNA coding sequences Which DNA operation method is used for each pixel in the present invention? Extract the second half of the data and perform a modulo 4 operation on it to obtain the DNA operation selection factor , the formula is: (11) in, The values of are as follows: 0 means DNA addition operation is selected, 1 means DNA subtraction operation is selected, 2 means DNA XOR operation is selected, and 3 means DNA XOR operation is selected.
[0072] First DNA operand sequence and the second DNA operand sequence Each 4-bit pair is paired into a group, and the DNA coding sequence The 4-bit DNA bases of each pixel in are calculated according to the following DNA diffusion rules:
[0073] First DNA diffusion: DNA coding sequence obtained by S60 As the core operation object, the DNA operation selects the factor Drive the first DNA operand sequence and DNA coding sequences Iterative operation block by block generates intermediate diffusion matrix For example: the initial block is encoded by DNA sequence The first and last blocks of the corresponding first DNA operand sequence The XOR starts the diffusion chain, that is, the DNA coding sequence The first and last two blocks, the first block is the first 4-pixel group, and the last block is the last 4-pixel group, respectively corresponding to the first DNA operand sequence Performs a bitwise XOR operation to pass the first DNA operand sequence The randomness of the encrypted data is broken, and the original data correlation of the first and last blocks is broken, which serves as the initial trigger of the diffusion process, so that the changes in pixel values in subsequent iterative operations can be propagated bidirectionally along the sequence, realizing the diffusion of the statistical characteristics of the encrypted data.
[0074] For the initial block, , DNA coding sequence The first piece, DNA coding sequence The tail block, is the corresponding first DNA operand sequence ; For the The middle block, , let the current block be , Indicates the DNA coding sequence Middle To The four consecutive pixels are used as the basic unit of DNA arithmetic operation. The diffusion result of the previous block is , then the block-by-block iterative operation rules are: (12) in, is the XOR operation, For the XOR operation, the result retains the 4-bit base format. For the The first DNA operand sequence corresponding to the intermediate blocks.
[0075] Second DNA diffusion: intermediate diffusion matrix As the core operation object, the DNA operation selects the factor Drives the second DNA operand sequence and intermediate diffusion matrix Block-by-block iterative operations generate encrypted DNA coding sequences For example: the last block passes through the intermediate diffusion matrix The first and last blocks of the corresponding second DNA operand sequence XOR closed diffusion chain, namely: , is the intermediate diffusion matrix The first piece, is the intermediate diffusion matrix The tail block, is the corresponding second DNA operand sequence; For the The middle block, , let the current block be , the diffusion result of the previous block is , then the block-by-block iterative operation rules are: (13) in, For the The second DNA operand sequence corresponding to the intermediate blocks.
[0076] In the two DNA diffusions of the present invention, the DNA operation selection factor Dynamically select the operation type and combine it with the DNA coding sequence The initial value of and the first DNA operand sequence and the second DNA operand sequence The randomness of the pixel values is realized by deep diffusion and full image dependence.
[0077] Finally, the first half of the data is extracted from the second chaotic sequence Y. Based on the first half of the data extracted from the second chaotic sequence, a decoding rule sequence is generated. The formula is expressed as follows: (14) The encrypted DNA coding sequence Split into MN groups, each group of 4 DNA bases, according to the corresponding decoding rule sequence Decode into 8-bit binary and then convert to decimal pixel value to get the encrypted facial image .
[0078] During the encryption process, the present invention first uses the second encoding rule sequence Encode the decimal pixel value into a DNA coding sequence, diffuse the pixel value through DNA arithmetic operation, and then use the decoding rule sequence Perform the reverse operation to restore the encrypted DNA coding sequence after DNA operation to decimal pixel values that can be recognized and displayed by the computer. After this step, the pixel values are highly diffused, and the encryption effect is further enhanced. Decoding rule sequence With the second encoding rule sequence The generation method is consistent. Using the first chaotic sequence Modulo 8 plus 1, Using the second chaotic sequence The modulo-plus-1 formula of 8 is used for both encryption and decryption. Using different chaotic sequences in the encryption and decryption processes can enhance security, construct differential recovery paths, prevent the encryption path from being reversible, and expand the key space.
[0079] S80: splicing the encrypted facial image and the non-facial image to obtain a complete encrypted image.
[0080] After completing the encryption of the facial image, the present invention will encrypt the facial image With non-face images Splicing is performed to obtain a complete encrypted image, that is, the encrypted facial image is stitched together according to the coordinates obtained by the previous face detection. Accurately embed non-face images The corresponding positions are formed, thus forming a complete encrypted image C. At this point, the encryption process of the entire facial image is completed.
[0081] like Figure 2 As shown, the present invention provides a facial image decryption method, in which the image to be decrypted is the complete encrypted image obtained by the facial image encryption method. The decryption method and the encryption method are inverse operations of each other, and the decryption method includes:
[0082] S10-1. Use OpenCV's Haar cascade classifier to extract non-face images and encrypted face images from the complete encrypted image.
[0083] In actual operation, it is necessary to ensure that the facial image is extracted in the same manner as in the encryption method of the first aspect. For the specific implementation of this step, please refer to S20 in the encryption method of the first aspect and will not be repeated here, thereby extracting the non-facial image. and encrypted facial images .
[0084] S20-1. Perform a SHA-256 hash operation on the encrypted facial image and perform bitwise XOR operations on the images in groups to obtain several intermediate keys for decryption. Calculate the initial state value of the new four-dimensional hyperchaotic system for decryption based on the external key and the several intermediate keys for decryption. Substitute the initial state value into the new four-dimensional hyperchaotic system to obtain a first chaotic sequence, a second chaotic sequence, a third chaotic sequence, and a fourth chaotic sequence.
[0085] The present invention is used to encrypt facial images Perform SHA-256 hash operation to obtain a 256-bit hash value, and divide the hash value into groups of 8 bits each. The intermediate key for decryption is calculated in the same way as for encryption. , the formula is: (15) in, For the Intermediate Key The corresponding 4 groups of 8-bit hash values are grouped together. Then use the same external key as used for encryption Calculate the initial state value of the new four-dimensional hyperchaotic system during decryption , the formula is: (16) The initial state value Substituting the new four-dimensional hyperchaotic system shown in formula (1), we get the same first chaotic sequence as that in encryption: , the second chaotic sequence , the third chaotic sequence , the fourth chaos sequence This step is crucial because the decryption process relies on the same chaotic sequence as the encryption process, ensuring that the keys are synchronized for correct decryption.
[0086] S30-1. Perform DNA inverse arithmetic operations on the encrypted facial image using the first chaotic sequence, the second chaotic sequence, the third chaotic sequence, and the fourth chaotic sequence to obtain a DNA coding sequence.
[0087] The first step of decryption is to restore the numerical information of each encrypted pixel. Each pixel is encoded as 4 DNA bases, so the DNA coding sequence is 4MN long. The encrypted facial image must be divided into groups of 4 to form MN groups of DNA bases. To accurately decode the pixel value represented by each group of DNA bases, first Each group of 4 DNA bases is sequenced according to its corresponding decoding rule It is restored to 8-bit binary and then converted into a decimal integer to obtain the encrypted DNA coding sequence , which are the pixel values after the second DNA diffusion. However, since these values also contain DNA arithmetic perturbations during encryption, DNA inverse arithmetic operations must be continued.
[0088] To do this, it is necessary to select factors based on DNA operations Get the DNA operation mode used for each pixel, such as DNA addition operation, DNA subtraction operation, DNA XOR operation, DNA XOR operation, and restore the first DNA operand sequence involved in the operation , the second DNA operand sequence . First DNA operand sequence By chaotic sequence By the first coding rule sequence And generate, Second DNA operand sequence By chaotic sequence By the second encoding rule sequence After completing the DNA operand sequence recovery, combined with the DNA operation selection factor The specified DNA operation method uses the DNA coding rules to perform reverse operations from the encrypted DNA coding sequence Recover the DNA coding sequence before dynamic bit-level DNA cross-coding block by block Among them, the encrypted DNA coding sequence Recover the DNA coding sequence before dynamic bit-level DNA cross-coding block by block Including: First, from the encrypted DNA coding sequence Recover the intermediate diffusion matrix before the second DNA diffusion block by block , and then diffuse the matrix from the middle Recover the DNA coding sequence before the first DNA diffusion block by block , which is the output of dynamic bit-level DNA cross-coding in encryption.
[0089] S40-1. Use the first chaotic sequence to perform dynamic bit-level DNA cross-reversal encoding on the DNA coding sequence to obtain a second scrambled matrix.
[0090] The present invention requires the recovery of DNA coding sequence Decode and restore to the original pixel value. This step is completely symmetrical with the dynamic bit-level DNA cross-coding in the encryption stage. First, the second coding rule sequence DNA coding sequence The 4-bit DNA bases of each pixel in the DNA are translated into binary code to obtain 8-bit binary code, which is then converted into decimal pixel value to form a pixel sequence after bit-level perturbation. At this point, although the value of each pixel is correct, its bit structure has been cross-perturbed across pixels during the encryption process. In order to restore its true bit arrangement, a bit-level DNA cross-reverse encoding operation is required. The pixel sequence after bit-level perturbation is converted into an MN×8 bit matrix, and every two rows are paired as a cross group. The first encoding rule sequence is used. Restore the MN×8 bit matrix, the first coding rule sequence is an 8-bit control word. If a certain bit of the control word is 1, the bit of the current pixel pair at that position is swapped, otherwise it remains unchanged. After completing all bit swap operations, the decimal pixel values are recombined to obtain the second scrambled matrix after cross-perturbation restoration. .
[0091] S50-1. Use the second chaotic sequence to perform bit plane splicing and V selection scrambling inverse operations on the second scrambled matrix to obtain a first scrambled matrix, and use the first chaotic sequence to perform annular layered position scrambling inverse operation on the first scrambled matrix to obtain the original facial image.
[0092] The final stage of decryption is to restore the pixels from the spatially scrambled structure to their original spatial positions. The spatial scrambling during encryption consists of two steps: first, through the bit-plane concatenation and V-selective scrambling operations of S50 in the first aspect, and second, through the even-odd ring layered position scrambling operation of S40 in the first aspect. Decryption requires the reverse of these steps.
[0093] First, perform the inverse operation of bit plane splicing and V selection scrambling for S50: transform the second scrambling matrix Each pixel is split into 4 biplanes, and the front is extracted from the first chaotic sequence Y. elements, generate a sorted index , according to the reverse order of V-shaped sampling during encryption, The inverse index reorganizes the bit plane group and restores the original bit plane structure, that is, the first scrambled matrix is obtained .
[0094] Secondly, perform the ring layer position scrambling inverse operation for S40: First, the ring layer position scrambling inverse operation must ensure that the ring layer position scrambling is completely consistent with the encryption position. , to ensure the layered structure matches; secondly, the odd and even layers are reverse transformed and reversely spliced to restore the original spatial position of the pixels. Control the folding operation direction (main / sub-diagonal) and pixel pair exchange. Decryption requires reverse operation. Encryption is done by the first chaotic sequence. The segment modulo 2 generates the folding operation mark, and the decryption is unfolded in the opposite direction of the folding operation mark. In addition, for the pixel pair restoration of the odd layer, the first chaotic sequence is used during encryption. Generate a switch tag for each ring layer, such as The switching of the ring layer is marked as , perform the inverse exchange when decrypting , eliminate the position disturbance during encryption; for even-layer pixel restoration, the first chaotic sequence is used during encryption Modulo 4 generates each annular layer Rotation mark , rotate in the opposite direction when decrypting, through Generate reverse rotation mark, such as the rotation mark is (90° clockwise), corresponding to the reverse rotation mark (90° inverse), according to For the first Layer Annular Slicing performs a counterclockwise rotation, restoring the original spatial arrangement of the pixels.
[0095] When encrypting, the image is divided from the outer layer to the inner layer. When decrypting, the annular layers are spliced in reverse order from the inner layer to the outer layer, ensuring that each pixel returns to the coordinates before encryption, and finally generating a facial matrix consistent with the original image space. .
[0096] S60-1. Splice the non-face image and the original face image to obtain a complete original image.
[0097] The original facial matrix Embed non-face images according to their original coordinates (the coordinates of the facial image recorded during encryption) (non-face image retained during encryption), get the complete decrypted image, that is, the original image If the original image is a color image, the original image must be Restore to color image. At this point, the decryption process of the entire facial image is completed.
[0098] The facial image decryption method proposed in the present invention has a decryption process that is the inverse process of the encryption method of the first aspect, and achieves lossless decryption through DNA inverse arithmetic operations, dynamic bit-level DNA cross-coding, bit plane splicing and V-selection scrambling inverse operations, circular layered position scrambling inverse operations, and facial area restoration.
[0099] Example
[0100] Figure 3 The original image in (a) is the Lena image, which is a very famous test image in the field of image processing and computer vision. It is widely used in algorithm testing, performance evaluation and teaching demonstration. The encryption method proposed in this application is used to encrypt it. The encrypted ciphertext image is as follows Figure 3 As shown in (b).
[0101] Compare the histogram of the original image (such as Figure 4 (a)) and the ciphertext image histogram after encryption by this method (as shown in Figure 4 As shown in (b) in the figure, it is obvious that the histogram distribution of the encrypted image by this method is completely different from the histogram distribution of the original image, which proves that the facial image is securely encrypted.
[0102] It should be understood that the above-mentioned device is used to execute the method in the above-mentioned embodiment. The implementation principle and technical effect of the corresponding program module in the device are similar to those described in the above-mentioned method. The working process of the device can refer to the corresponding process in the above-mentioned method and will not be repeated here.
[0103] Based on the methods in the above embodiments, the present invention provides an electronic device that may include: a processor, a communications interface, a memory, and a communications bus. The processor, the communications interface, and the memory communicate with each other via the communications bus. The processor may invoke logic instructions in the memory to execute the methods in the above embodiments.
[0104] Furthermore, the logic instructions in the aforementioned memory can be implemented as software functional units and, when sold or used as independent products, stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product, stored in a storage medium, includes instructions for causing a computer device (such as a personal computer, server, or network device) to execute all or part of the steps of the methods described in various embodiments of the present invention.
[0105] Based on the method in the above embodiment, the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method in the above embodiment.
[0106] Based on the methods in the above embodiments, the present invention provides a computer program product. When the computer program product runs on a processor, the processor executes the methods in the above embodiments.
[0107] It is understood that the processor in the present invention may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA), other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0108] The method steps of the present invention can be implemented via hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, a hard disk, a removable hard disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC.
[0109] The above embodiments can be implemented in whole or in part through software, hardware, firmware, or any combination thereof. When implemented using software, they can be implemented in whole or in part in the form of a computer program product. The computer program product comprises one or more computer instructions. When loaded and executed on a computer, the computer program instructions fully or partially produce the processes or functions described herein. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted via the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible by a computer, or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
[0110] It should be understood that the various numerical numbers involved in the present invention are only used for the convenience of description and are not intended to limit the scope of the embodiments of the present invention.
[0111] It will be easily understood by those skilled in the art that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A facial image encryption method, characterized in that: The encryption method includes: Obtain a grayscale image of the image to be encrypted, and extract the facial image from the grayscale image; Group XOR the SHA-256 hash values of the facial image to generate multiple intermediate keys; Using an external key and multiple intermediate keys, the initial values of the state variables of the four-dimensional hyperchaotic system are calculated; Using a four-dimensional hyperchaotic system and initial values of state variables, the first chaotic sequence to the fourth chaotic sequence are generated; The facial image is divided into a plurality of annular layers, and a first chaotic sequence is used to perform a spatial position scrambling operation on each annular layer to obtain a first matrix; Performing bit plane splicing and V-selection scrambling operations on the first matrix using a second chaotic sequence to obtain a second matrix; Using the first chaotic sequence to perform dynamic bit-level DNA cross-coding on the second matrix, a DNA coding sequence is obtained; Performing DNA arithmetic operations on the DNA coding sequence using the first to fourth chaotic sequences to obtain an encrypted facial image; The encrypted facial image is concatenated with the non-facial image to obtain the final ciphertext image.
2. The encryption method according to claim 1, wherein: The calculation formula of the intermediate key is: ; in, The SHA-256 hash values of the facial images are grouped into The SHA-256 hash value grouping rule of the facial image is as follows: the SHA-256 hash values are divided into a subgroup of 8-bit hash values in sequence, to obtain 32 subgroups of 8-bit hash values; the 32 subgroups of 8-bit hash values are divided into a group of 4 subgroups of 8-bit hash values in sequence, is the bitwise exclusive OR operator, .
3. The encryption method according to claim 1, wherein: The calculation of the initial state value of the four-dimensional hyperchaotic system is as follows: ; in, are the initial state values of the four-dimensional hyperchaotic system, There are four external keys respectively. is a modular operation, For the An intermediate key, .
4. The encryption method according to claim 3, wherein: The equation of the four-dimensional hyperchaotic system is: ; in, are the four control parameters of the four-dimensional hyperchaotic system, are the four state variables of the four-dimensional hyperchaotic system, is the fourth-dimensional state variable introduced on the basis of Chen's chaotic system. They are the first chaotic sequence, second chaotic sequence, third chaotic sequence and fourth chaotic sequence of the four-dimensional hyperchaotic system.
5. The encryption method according to claim 1, wherein: The first chaotic sequence is used to perform spatial position scrambling operation on each ring layer to obtain a first matrix, which is as follows: For each odd-numbered ring layer, the folding and pixel pair exchange strategy is used to perform position scrambling operations; For each even-numbered ring layer, a chaos control rotation strategy is used to perform position scrambling operations; The position scrambling results corresponding to all the annular layers are spliced according to the spatial position of the facial image to obtain the first matrix.
6. The encryption method according to claim 1, wherein: The second chaotic sequence is used to perform bit plane splicing and V selection scrambling operations on the first matrix to obtain the second matrix, which is specifically as follows: Split the 8 bits of each pixel in the first matrix into 4 double-bit planes to form 4 binary matrices; Splice the four binary matrices along the diagonal direction to obtain a spliced matrix; Extract pixel bits from the splicing matrix according to a V-shaped path to form several V-shaped bit matrices; Using the second chaotic sequence to sort and reorganize each V-shaped bit matrix; Each pixel in the reorganized V-shaped bit matrix is converted into a decimal pixel value to obtain a second matrix.
7. The encryption method according to claim 1, wherein: The first chaotic sequence is used to perform dynamic bit-level DNA cross-coding on the second matrix to obtain a DNA coding sequence, which is specifically as follows: Using the first chaotic sequence, a first coding rule sequence for controlling bit exchange and a second coding rule sequence for selecting DNA coding rules are generated; Flatten the second matrix into a one-dimensional sequence and pair it end to end; swapping corresponding bits of each paired pixel using a first coding rule sequence, and converting each pixel in the swapped sequence into a binary pixel value; The converted sequence is DNA-encoded using the second encoding rule sequence to obtain a DNA encoding sequence.
8. The encryption method according to claim 1, wherein: The first chaotic sequence to the fourth chaotic sequence are used to perform DNA arithmetic operations on the DNA coding sequence to obtain an encrypted facial image, as follows: Using the second half of the third chaotic sequence data, a corresponding third coding rule sequence is generated; Using the second half of the fourth chaotic sequence data, a corresponding fourth coding rule sequence is generated; Using the third encoding rule sequence, encoding the first half of the data from the third chaotic sequence to obtain a first DNA operand sequence; Using the fourth coding rule sequence, encoding the first half of the data from the fourth chaotic sequence to obtain a second DNA operand sequence; Performing a modulo 4 operation on the second half of the first chaotic sequence to obtain a DNA operation selection factor; performing DNA arithmetic operations on the first DNA operand sequence and the DNA coding sequence according to the DNA operation selection factor to obtain an intermediate diffusion matrix; performing DNA arithmetic operations on the second DNA operand sequence and the intermediate diffusion matrix according to the DNA operation selection factor to obtain an encrypted DNA coding sequence; Using the first half of the second chaotic sequence data, a decoding rule sequence is generated; Using the decoding rule sequence, the encrypted DNA coding sequence is decoded; Convert each pixel in the decoding result into a decimal pixel value to obtain the encrypted facial image.
9. A facial image decryption method, characterized in that: The decryption method is used to decrypt the final ciphertext image generated by the encryption method according to any one of claims 1 to 8 to obtain a complete original image. The decryption method and the encryption method are inverse operations of each other.
10. An image processing device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the encryption method according to any one of claims 1 to 8, or the steps of the decryption method according to claim 9, when executing the computer program.
Citation Information
Patent Citations
Chaos image encryption method based on dual scrambling and DNA coding
CN108898025A
Image secure transmission method based on four-dimensional hyper-chaotic system and DNA coding
CN120415684A
Data encryption method based on DNA encoding, data decryption method based on DNA encoding, intelligent terminal, and medium
WO2025118369A1