Multi-image encryption method based on four-dimensional memristor hyperchaotic system and storage medium
By adopting a multi-image encryption method based on a four-dimensional memristor superchaotic system in the image encryption technology, the problems of poor memristor model performance and insufficient dynamic performance of the chaotic system in the existing technology are solved, and efficient and secure image encryption is achieved, and the generated encrypted images have higher attack resistance and robustness.
Patent Information
- Application Number
- CN202510103067.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2045-01-22
AI Technical Summary
The memristor model in the prior art is poor in effect, and the dynamic performance of the chaotic system is insufficient, resulting in low encryption efficiency and insufficient anti-attack ability and robustness of the generated encrypted images.
Using a multi-image encryption method based on the four-dimensional memristor superchaotic system, a new memristor model is constructed and introduced into the three-dimensional chaotic system, a four-dimensional memristor superchaotic system is generated, which enhances the randomness of the chaotic sequence, and improves encryption efficiency and security through cross-plane helical traversal and bidirectional diffusion operations.
It effectively improves the effect of the memristor model and the dynamic performance of the chaotic system, enhances the randomness of the chaotic sequence, improves the efficiency and security of image encryption, and makes the generated encrypted images have higher attack resistance and robustness.
Smart Images

Figure CN119696761A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image encryption technology, and more specifically, to a multi-image encryption method and storage medium based on a four-dimensional memristor hyperchaotic system. Background Art
[0002] With the rapid development of multimedia and communication technology, many different forms of digital information are widely disseminated on the Internet, such as text, images, videos, etc., which greatly facilitates people's instant information exchange. As an indispensable medium in digital communication, images can convey information more intuitively and vividly. However, due to illegal user attacks or unauthorized access, images exchanged on the Internet can easily be maliciously tampered with by lawbreakers and leak private information. Therefore, protecting the secure exchange of images has become a top priority.
[0003] A chaotic system is a deterministic nonlinear dynamic system with complex dynamic behavior, extreme sensitivity to initial conditions, and low predictability. Therefore, chaotic encryption technology is widely used in the field of image encryption. The chaotic sequence generated by the chaotic system plays a vital role in the method. The randomness of the sequence will affect the encryption effect and security, and the time required to generate the sequence will also affect the time consumption of image encryption. In recent years, in order to enhance the randomness of the chaotic sequence, many researchers have tried to apply memristors to chaotic systems. For example, a new memristor model is constructed, and then the memristor is introduced into the existing chaotic system to construct a new type of memristor-based chaotic system. The hash value related to the plaintext image is obtained by hash function calculation, and a mathematical model is constructed to convert its value into the initial value of the chaotic system. The chaotic sequence is obtained after iterative calculation. Then, this chaotic sequence is used for image scrambling and diffusion operations, and finally the ciphertext image is obtained. However, most memristor chaotic systems are applied to single image encryption, and due to the poor effect of the memristor model, the dynamics of the chaotic system is insufficient, and there are problems such as low encryption efficiency. Summary of the invention
[0004] In order to overcome the problems of poor effect of the prior art memristor model, insufficient dynamic performance of the chaotic system and low encryption efficiency, the present invention provides a multi-image encryption method and storage medium based on a four-dimensional memristor hyperchaotic system, which can effectively improve the effect of the memristor model and enhance the dynamic performance of the chaotic system, thereby strengthening the randomness of the chaotic sequence; at the same time, the present invention adopts a multi-image encryption method to greatly improve the image encryption efficiency; in addition, the encrypted image generated by the present invention is also more resistant to attack and more robust.
[0005] In order to solve the above technical problems, the technical solution of the present invention is as follows:
[0006] A multi-image encryption method based on a four-dimensional memristor hyperchaotic system comprises the following steps:
[0007] S1: construct a new memristor model, introduce the new memristor model into a three-dimensional chaotic system, and obtain a four-dimensional memristor hyperchaotic system;
[0008] S2: Get the plaintext grayscale image P 1 , P 2 and P 3 , and calculate the hash values associated with each plaintext grayscale image, cross-reorganize each hash value and transform it through a preset mathematical model to obtain the initial value x of the chaotic system 0 ,y 0 、z 0 and u 0 ; Set the initial value x 0 ,y 0 , z 0 ,u 0 Substitute it into the four-dimensional memristor hyperchaotic system for iterative update to generate random sequences X, Y, Z and U;
[0009] S3: For the plaintext grayscale image P 1 , P 2 and P 3 Preprocessing is performed, and the size of each image after preprocessing is M×N, where M and N are the height and width of the preprocessed image respectively;
[0010] Construct an image matrix PP of size M×N×3 based on all preprocessed images; sort the random sequence X in ascending order to obtain the index sequence S; use the sequences Y, Z, and U to generate a three-dimensional pseudo-random matrix K of size M×N×3 1 and K 2 ;
[0011] S4: Perform a spiral traversal of the image matrix PP across the plane, and store the pixel values obtained in the one-dimensional vector T 0 In the example, we use the index sequence S to calculate the one-dimensional vector T 0 The index is scrambled and the scrambled sequence is stored in a one-dimensional vector T 1 middle;
[0012] S5: The one-dimensional vector T 1 Reorganize into a three-dimensional matrix TCM of size M×N×3; use the three-dimensional pseudo-random matrix K 1 Perform a cross-plane forward diffusion operation on the three-dimensional matrix TCM to obtain the matrix C after forward diffusion 0 ; Using the three-dimensional pseudo-random matrix K 2 For the matrix C 0 Perform a cross-plane reverse diffusion operation to obtain the final ciphertext image C1 , completing multi-image encryption.
[0013] Preferably, in step S1, the constructed novel memristor model is expressed as:
[0014]
[0015] Where i is the current through the memristor, v is the voltage applied across the memristor, is the state variable inside the memristor, is the memristor’s memristor function, For is a continuous function of the independent variable, and α, β, and ε are the first to third preset parameters respectively.
[0016] Preferably, in step S1, the novel memristor model is introduced into the three-dimensional chaotic system to obtain a four-dimensional memristor hyperchaotic system, denoted as M4CS, which is expressed as:
[0017]
[0018] W(u)=e α +ln(β+u)
[0019] Among them, x, y, z and u are the inputs of M4CS, and is the output of M4CS; μ, η, a, b and k are the fourth to eighth preset parameters respectively.
[0020] Preferably, the step S2 comprises:
[0021] S2.1: Input three plaintext grayscale images P 1 , P 2 and P 3 ;
[0022] S2.2: Use SHA-256 to identify P 1 , P 2 and P 3 Calculate the hash value and record the corresponding hash value as H 1 , H 2 and H 3 ; H 1 , H 2 and H 3 Crossover recombination forms a new hash value K'. The rules of crossover recombination are as follows:
[0023] K'={H 1 (1),H 2 (1),H 3 (1),…,H 1(64),H 2 (64),H 3 (64)}
[0024] S2.3: Group K' into groups, with each group consisting of 12 hexadecimal numbers, for a total of 16 groups, denoted as K' = {K 1 ',K' 2 ,…,K 1 ' 6}; Convert the hexadecimal values in each group to decimal values to obtain the key h, denoted as h = {h 1 ,h 2 ,…,h 16}, the process of converting K' from hexadecimal to decimal is as follows:
[0025] h i =hex2dec(K i '),i=1,…,16
[0026] Among them, hex2dec() is a hexadecimal to decimal conversion function;
[0027] S2.4: Convert the key h through a mathematical model to obtain the initial value x 0 ,y 0 ,z 0 and u 0 ;
[0028] S2.5: Set the initial value x 0 ,y 0 、z 0 、u 0 Substitute it into M4CS and iterate several times to obtain four groups of random sequences X, Y, Z, and U.
[0029] Preferably, in step S2, the preset mathematical model is specifically:
[0030]
[0031] Among them, mod represents the remainder function.
[0032] Preferably, in step S2.5, the initial value x 0 ,y 0 、z 0 、u 0 Substitute it into M4CS and iterate (500+M×N×3) times, and discard the results of the first 500 iterations to eliminate transient effects, and obtain four groups of random sequences X, Y, Z, and U.
[0033] Preferably, step S3 comprises:
[0034] S3.1: Record three plaintext grayscale images P respectively1 , P 2 and P 3 Size;
[0035] S3.2: The plaintext grayscale image P 1 , P 2 and P 3 The pixels are divided into rows, and the total number of rows after segmentation tl is recorded. The size of each image after preprocessing is calculated according to the following formula:
[0036] M = N = ceil (sqrt (tl / 3))
[0037] Among them, sqrt means to find the square root; the function ceil() means the upward rounding function;
[0038] S3.3: construct an all-zero matrix O of size M×N×3, fill the preprocessed image row by row into the all-zero row vector, and obtain a new image matrix PP;
[0039] S3.4: Sort the chaotic sequence X in ascending order to generate the index sequence S, as shown below:
[0040] [~,S]=sort(X)
[0041] S3.5: Create two one-dimensional vectors W of size M×N×3 0 ,W 1 , using the chaotic sequences Y, Z, and U, fill W according to the following method 0 :
[0042]
[0043] Fill W as follows 1 :
[0044]
[0045] S3.6: Fill the W 0 and W 1 Converted into a three-dimensional pseudo-random matrix K of size M×N×3 1 and K 2 , the conversion is as follows:
[0046]
[0047] Among them, the floor() function represents the rounding down function.
[0048] Preferably, the step S4 comprises:
[0049] S4.1: Perform a cross-plane spiral traversal scrambling on the image matrix PP. The specific scrambling process is as follows:
[0050] If M is an odd number, the number of circles required for the spiral traversal is I = (M / 2) + 1; if M is an even number, the number of circles required for the spiral traversal is I = M / 2;
[0051] Each image has the same number of spiral traversal circles I, and the outermost circle to the innermost circle of the spiral traversal are denoted as CR k ,CR k-1 ,…,CR 1 , where k = I, I-1, …, 1; first traverse the CR of the first image I Circle, then traverse the CR of the second image I-1 Circle, and so on; when traversing to the CR of the last image t Circle (1≤t≤I), back to the CR of the first image again I-1 The circle is traversed, and then the CR of the second image is traversed I-2 Circle, repeat the above traversal process;
[0052] When all the spiral turns of the first image have been traversed, the CR of the second image will be traversed. I Repeat the traversal process similar to the first image, and so on, until all images are traversed; all the sequences obtained by traversal are saved as a one-dimensional vector T 0 ;
[0053] S4.2: Scrambling a one-dimensional vector T using an index sequence S 0 , and obtain a one-dimensional vector T of size M×N×3 1 , the specific scrambling process is as follows:
[0054] T 1 (i) = T 0 (S(i)),i=1,2,…,M×N×3
[0055] Among them, T 1 (i) is a one-dimensional vector T 1 The i-th element of T 0 (S(i)) represents the scrambling of the one-dimensional vector T using the index sequence S 0 The ith element of .
[0056] Preferably, step S5 comprises:
[0057] S5.1: Transform the one-dimensional vector T 1 Convert to a three-dimensional matrix TCM of size M×N×3:
[0058] TCM=reshape(T 1 ,M,N,3)
[0059] S5.2: Combined with the three-dimensional pseudo-random matrix K 1 , starting from the first layer image, from top to bottom, according to the following calculation formula, the forward diffusion operation is performed on the scrambled three-dimensional matrix TCM to obtain the matrix C after forward diffusion 0 :
[0060]
[0061] A 0 (r,c,l) and B 0 The expression for (r,c,l) is as follows:
[0062]
[0063] Among them, C 0 (r,c,l) is the matrix C 0 The element of the rth row, cth column, and lth layer in ; L is the number of image layers;
[0064] S5.3: Starting from the last layer of images, from bottom to top, combined with the three-dimensional pseudo-random matrix K 2 According to the following calculation formula, the matrix C 0 Perform reverse diffusion operation to obtain the final ciphertext image C 1 :
[0065]
[0066] A 1 (r,c,l) and B 1 The expression for (r,c,l) is as follows:
[0067]
[0068] Among them, C 0 (r,c,l) is the ciphertext image C 1 The element in the rth row, cth column, and lth layer.
[0069] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method are implemented.
[0070] Compared with the prior art, the technical solution of the present invention has the following beneficial effects:
[0071] The present invention provides a multi-image encryption method and storage medium based on a four-dimensional memristor hyperchaotic system. The present invention constructs a novel memristor model and introduces it into a three-dimensional chaotic system to obtain a novel four-dimensional memristor hyperchaotic system, which can enhance the effect of the memristor model and the dynamic performance of the chaotic system. Secondly, different from the traditional two-dimensional spiral traversal method, the present invention adopts a cross-plane spiral traversal method to rearrange the pixel positions of the image to obtain a first scrambled image, and then uses the chaotic series generated by the chaotic system to implement secondary image index scrambling to obtain a scrambled image. After the secondary image scrambling, the correlation between adjacent pixels is greatly reduced, thereby enhancing the encryption effect. In addition, the present invention performs a cross-plane bidirectional diffusion modular addition operation on the scrambled image and a pseudo-random matrix generated by the chaotic sequence to finally obtain a ciphertext image. The cross-plane scrambling and diffusion method is adopted to greatly improve the effect and efficiency of image encryption, and also make the encryption method have excellent security and robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] Figure 1 This is a flow chart of a multi-image encryption method based on a four-dimensional memristor hyperchaotic system provided in Example 1.
[0073] Figure 2 This is a framework diagram of a multi-image encryption method based on a four-dimensional memristor hyperchaotic system provided in Example 2.
[0074] Figure 3 This is a schematic diagram of the traversal direction of a spiral path provided in Example 2.
[0075] Figure 4 This is a schematic diagram of the cross-plane spiral traversal provided in Example 2.
[0076] Figure 5 This is a schematic diagram of the cross-plane forward diffusion provided in Example 2.
[0077] Figure 6 This is a schematic diagram of the cross-plane reverse diffusion provided in Example 2.
[0078] Figure 7 Schematic diagram of the plaintext images House, Kiel and Peppers provided in Example 2.
[0079] Figure 8 This is a schematic diagram of the ciphertext image provided in Example 2.
[0080] Fig. 9 Schematic diagram of the decrypted images House, Kiel and Peppers provided in Example 2.
[0081] Fig.10It is the histogram of the plaintext image House provided in Example 2.
[0082] Fig.11 It is the histogram of the plaintext image Kiel provided in Example 2.
[0083] Fig.12 It is the histogram of the plaintext image Peppers provided in Example 2.
[0084] Fig.13 It is the histogram of the ciphertext image provided in Example 2. DETAILED DESCRIPTION
[0085] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;
[0086] In order to better illustrate the present embodiment, some parts in the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product;
[0087] It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0088] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0089] Example 1
[0090] like Figure 1 As shown, this embodiment provides a multi-image encryption method based on a four-dimensional memristor hyperchaotic system, comprising the following steps:
[0091] S1: construct a new memristor model, introduce the new memristor model into a three-dimensional chaotic system, and obtain a four-dimensional memristor hyperchaotic system;
[0092] S2: Get the plaintext grayscale image P 1 , P 2 and P 3 , and calculate the hash values associated with each plaintext grayscale image, cross-reorganize each hash value and transform it through a preset mathematical model to obtain the initial value x of the chaotic system 0 ,y 0 、z 0 and u 0 ; Set the initial value x 0 ,y 0 , z 0 ,u 0 Substitute it into the four-dimensional memristor hyperchaotic system for iterative update to generate random sequences X, Y, Z and U;
[0093] S3: For the plaintext grayscale image P 1 , P 2and P 3 Preprocessing is performed, and the size of each image after preprocessing is M×N, where M and N are the height and width of the preprocessed image respectively;
[0094] Construct an image matrix PP of size M×N×3 based on all preprocessed images; sort the random sequence X in ascending order to obtain the index sequence S; use the sequences Y, Z, and U to generate a three-dimensional pseudo-random matrix K of size M×N×3 1 and K 2 ;
[0095] S4: Perform a spiral traversal of the image matrix PP across the plane, and store the pixel values obtained in the one-dimensional vector T 0 In the example, we use the index sequence S to calculate the one-dimensional vector T 0 The index is scrambled and the scrambled sequence is stored in a one-dimensional vector T 1 middle;
[0096] S5: The one-dimensional vector T 1 Reorganize into a three-dimensional matrix TCM of size M×N×3; use the three-dimensional pseudo-random matrix K 1 Perform a cross-plane forward diffusion operation on the three-dimensional matrix TCM to obtain the matrix C after forward diffusion 0 ; Using the three-dimensional pseudo-random matrix K 2 For the matrix C 0 Perform a cross-plane reverse diffusion operation to obtain the final ciphertext image C 1 , completing multi-image encryption.
[0097] In the specific implementation process, a new memristor model is first constructed, and the memristor is introduced into a three-dimensional chaotic system, thereby obtaining a new four-dimensional memristor hyperchaotic system;
[0098] Then, the hash values related to the three plaintext grayscale images are generated, and each hash value is cross-recombined and converted through a preset mathematical model as the initial value of the designed four-dimensional chaotic system. After iterative calculation, a chaotic (random) sequence is generated;
[0099] Then, a cross-plane spiral traversal method is used to rearrange the pixel positions of the image to obtain the first scrambled image. Then, the chaotic series generated by the chaotic system is used to implement secondary image index scrambling to obtain a secondary scrambled image, thereby reducing the correlation between adjacent pixels.
[0100] Then the secondary scrambled image is combined with the pseudo-random matrix K generated by the chaotic sequence 1 and K 2, perform cross-plane bidirectional diffusion modular addition operations, and obtain the final ciphertext image after forward and reverse diffusion operations in sequence. Bidirectional diffusion allows each pixel to include as much information as possible about other pixels;
[0101] This method can effectively improve the randomness of the sequence and the efficiency of image processing, and also has excellent confidentiality, robustness and resistance to data loss in terms of security.
[0102] Example 2
[0103] like Figure 2 As shown, this embodiment provides a multi-image encryption method based on a four-dimensional memristor hyperchaotic system, comprising the following steps:
[0104] S1: construct a new memristor model, introduce the new memristor model into a three-dimensional chaotic system, and obtain a four-dimensional memristor hyperchaotic system;
[0105] S2: Get the plaintext grayscale image P 1 , P 2 and P 3 , and calculate the hash values associated with each plaintext grayscale image, cross-reorganize each hash value and transform it through a preset mathematical model to obtain the initial value x of the chaotic system 0 ,y 0 、z 0 and u 0 ; Set the initial value x 0 ,y 0 , z 0 ,u 0 Substitute it into the four-dimensional memristor hyperchaotic system for iterative update to generate random sequences X, Y, Z and U;
[0106] S3: For the plaintext grayscale image P 1 , P 2 and P 3 Preprocessing is performed, and the size of each image after preprocessing is M×N, where M and N are the height and width of the preprocessed image respectively;
[0107] Construct an image matrix PP of size M×N×3 based on all preprocessed images; sort the random sequence X in ascending order to obtain the index sequence S; use the sequences Y, Z, and U to generate a three-dimensional pseudo-random matrix K of size M×N×3 1 and K 2 ;
[0108] S4: Perform a spiral traversal of the image matrix PP across the plane, and store the pixel values obtained in the one-dimensional vector T 0 In the example, we use the index sequence S to calculate the one-dimensional vector T 0The index is scrambled and the scrambled sequence is stored in a one-dimensional vector T 1 middle;
[0109] S5: The one-dimensional vector T 1 Reorganize into a three-dimensional matrix TCM of size M×N×3; use the three-dimensional pseudo-random matrix K 1 Perform a cross-plane forward diffusion operation on the three-dimensional matrix TCM to obtain the matrix C after forward diffusion 0 ; Using the three-dimensional pseudo-random matrix K 2 For the matrix C 0 Perform a cross-plane reverse diffusion operation to obtain the final ciphertext image C 1 , complete multi-image encryption;
[0110] In step S1, the constructed novel memristor model is expressed as:
[0111]
[0112] Where i is the current through the memristor, v is the voltage applied across the memristor, is the state variable inside the memristor, is the memristor’s memristor function, For is a continuous function of the independent variable, α, β, ε are the first to third preset parameters respectively;
[0113] In step S1, the novel memristor model is introduced into the three-dimensional chaotic system to obtain a four-dimensional memristor hyperchaotic system, denoted as M4CS, which is expressed as:
[0114]
[0115] W(u)=e α +ln(β+u)
[0116] Among them, x, y, z and u are the inputs of M4CS, and is the output of M4CS; μ, η, a, b and k are the fourth to eighth preset parameters respectively;
[0117] The step S2 comprises:
[0118] S2.1: Input three plaintext grayscale images P 1 , P 2 and P 3 ;
[0119] S2.2: Use SHA-256 to identify P 1 , P 2 and P 3Calculate the hash value and record the corresponding hash value as H 1 , H 2 and H 3 ; H 1 , H 2 and H 3 Crossover recombination forms a new hash value K'. The rules of crossover recombination are as follows:
[0120] K'={H 1 (1),H 2 (1),H 3 (1),…,H 1 (64),H 2 (64),H 3 (64)}
[0121] S2.3: Group K' into groups, with each group consisting of 12 hexadecimal numbers, for a total of 16 groups, denoted as K' = {K 1 ',K' 2 ,…,K 1 ' 6}; Convert the hexadecimal values in each group to decimal values to obtain the key h, denoted as h = {h 1 ,h 2 ,…,h 16}, the process of converting K' from hexadecimal to decimal is as follows:
[0122] h i =hex2dec(K i '),i=1,…,16
[0123] Among them, hex2dec() is a hexadecimal to decimal conversion function;
[0124] S2.4: Convert the key h through the following mathematical model to obtain the initial value x 0 ,y 0 ,z 0 and u 0 :
[0125]
[0126] Among them, mod represents the remainder function;
[0127] S2.5: Set the initial value x 0 ,y 0 、z 0 、u 0 Substitute it into M4CS and iterate (500+M×N×3) times, and discard the first 500 iterations to eliminate the transient effect, and get four groups of random sequences X, Y, Z, and U;
[0128] The step S3 comprises:
[0129] S3.1: Record three plaintext grayscale images P respectively 1 , P 2 and P 3 Size;
[0130] S3.2: The plaintext grayscale image P 1 , P 2 and P 3 The pixels are divided into rows, and the total number of rows after segmentation tl is recorded. The size of each image after preprocessing is calculated according to the following formula:
[0131] M = N = ceil (sqrt (tl / 3))
[0132] Among them, sqrt means to find the square root; the function ceil() means the upward rounding function;
[0133] S3.3: construct an all-zero matrix O of size M×N×3, fill the preprocessed image row by row into the all-zero row vector, and obtain a new image matrix PP;
[0134] S3.4: Sort the chaotic sequence X in ascending order to generate the index sequence S, as shown below:
[0135] [~,S]=sort(X)
[0136] S3.5: Create two one-dimensional vectors W of size M×N×3 0 ,W 1 , using the chaotic sequences Y, Z, and U, fill W according to the following method 0 :
[0137]
[0138] Fill W as follows 1 :
[0139]
[0140] S3.6: Fill the W 0 and W 1 Converted into a three-dimensional pseudo-random matrix K of size M×N×3 1 and K 2 , the conversion is as follows:
[0141]
[0142] Among them, the floor() function represents the rounding down function;
[0143] The step S4 comprises:
[0144] S4.1: Perform a cross-plane spiral traversal scrambling on the image matrix PP. The specific scrambling process is as follows:
[0145] If M is an odd number, the number of circles required for the spiral traversal is I = (M / 2) + 1; if M is an even number, the number of circles required for the spiral traversal is I = M / 2;
[0146] Each image has the same number of spiral traversal circles I, and the outermost circle to the innermost circle of the spiral traversal are denoted as CR k ,CR k-1 ,…,CR 1 , where k = I, I-1, …, 1; first traverse the CR of the first image I Circle, then traverse the CR of the second image I-1 Circle, and so on; when traversing to the CR of the last image t Circle (1≤t≤I), back to the CR of the first image again I-1 The circle is traversed, and then the CR of the second image is traversed I-2 Circle, repeat the above traversal process;
[0147] When all the spiral turns of the first image have been traversed, the CR of the second image will be traversed. I Repeat the traversal process similar to the first image, and so on, until all images are traversed; all the sequences obtained by traversal are saved as a one-dimensional vector T 0 ;
[0148] S4.2: Scrambling a one-dimensional vector T using an index sequence S 0 , and obtain a one-dimensional vector T of size M×N×3 1 , the specific scrambling process is as follows:
[0149] T 1 (i) = T 0 (S(i)),i=1,2,…,M×N×3
[0150] Among them, T 1 (i) is a one-dimensional vector T 1 The i-th element of T 0 (S(i)) represents the scrambling of the one-dimensional vector T using the index sequence S 0 The i-th element of ;
[0151] The step S5 comprises:
[0152] S5.1: Transform the one-dimensional vector T 1 Convert to a three-dimensional matrix TCM of size M×N×3:
[0153] TCM=reshape(T 1 ,M,N,3)
[0154] S5.2: Combined with the three-dimensional pseudo-random matrix K 1 , starting from the first layer image, from top to bottom, according to the following calculation formula, the forward diffusion operation is performed on the scrambled three-dimensional matrix TCM to obtain the matrix C after forward diffusion 0 :
[0155]
[0156] A 0 (r,c,l) and B 0 The expression for (r,c,l) is as follows:
[0157]
[0158] Among them, C 0 (r,c,l) is the matrix C 0 The element of the rth row, cth column, and lth layer in ; L is the number of image layers;
[0159] S5.3: Starting from the last layer of images, from bottom to top, combined with the three-dimensional pseudo-random matrix K 2 According to the following calculation formula, the matrix C 0 Perform reverse diffusion operation to obtain the final ciphertext image C 1 :
[0160]
[0161] A 1 (r,c,l) and B 1 The expression for (r,c,l) is as follows:
[0162]
[0163] Among them, C 0 (r,c,l) is the ciphertext image C 1 The element in the rth row, cth column, and lth layer.
[0164] In the specific implementation process, a new memristor model is first constructed, which is expressed as:
[0165]
[0166] Where i is the current through the memristor, v is the voltage applied across the memristor, is the state variable inside the memristor, is the memristor’s memristor function, For is a continuous function of the independent variable, α, β, ε are the first to third preset parameters respectively. In this embodiment, α=0.6, β=1, ε=0.1;
[0167] The new memristor model is introduced into the three-dimensional chaotic system, and a four-dimensional memristor hyperchaotic system is obtained, denoted as M4CS, which can be expressed as:
[0168]
[0169] W(u)=e α +ln(β+u)
[0170] Among them, x, y, z and u are the inputs of M4CS, and is the output of M4CS; μ, η, a, b and k are the fourth to eighth preset parameters respectively;
[0171] Then get the plaintext grayscale image P 1 , P 2 and P 3 , use SHA-256 to identify P 1 , P 2 and P 3 Calculate the hash value and record the corresponding hash value as H 1 , H 2 and H 3 ; H 1 , H 2 and H 3 Crossover recombination forms a new hash value K'. The rules of crossover recombination are as follows:
[0172] K'={H 1 (1),H 2 (1),H 3 (1),…,H 1 (64),H 2 (64),H 3 (64)}
[0173] K' is divided into groups, with each group consisting of 12 hexadecimal numbers, for a total of 16 groups, denoted as K' = {K 1 ',K' 2 ,…,K 1 ' 6}; Convert the hexadecimal values in each group to decimal values to obtain the key h, denoted as h = {h 1 ,h 2 ,…,h 16}, the process of converting K' from hexadecimal to decimal is as follows:
[0174] h i=hex2dec(K i '),i=1,…,16
[0175] Among them, hex2dec() is a hexadecimal to decimal conversion function;
[0176] The key h is converted through the following mathematical model to obtain the initial value x 0 ,y 0 ,z 0 and u 0 :
[0177]
[0178] Among them, mod represents the remainder function;
[0179] Set the initial value x 0 ,y 0 、z 0 、u 0 Substitute it into M4CS and iterate (500+M×N×3) times, and discard the first 500 iterations to eliminate the transient effect, and get four groups of random sequences X, Y, Z, and U;
[0180] For the plaintext grayscale image P 1 , P 2 and P 3 Preprocess and record three plaintext grayscale images P 1 , P 2 and P 3 Size;
[0181] The plaintext grayscale image P 1 , P 2 and P 3 The pixels are divided into rows, and the total number of rows after segmentation tl is recorded. The size of each image after preprocessing is calculated according to the following formula:
[0182] M = N = ceil (sqrt (tl / 3))
[0183] Wherein, sqrt means to find the square root; function ceil() means to round up to an integer; the size of each image after preprocessing is M×N, where M and N are the height and width of the image after preprocessing, respectively. In this embodiment, M=N;
[0184] Construct an all-zero matrix O of size M×N×3, fill the preprocessed image row by row into the all-zero row vector, and obtain a new image matrix PP;
[0185] Sort the chaotic sequence X in ascending order to generate the index sequence S as follows:
[0186] [~,S]=sort(X)
[0187] Create two one-dimensional vectors W of size M×N×3 0 ,W 1 , using the chaotic sequences Y, Z, and U, fill W according to the following method 0 :
[0188]
[0189] Fill W as follows 1 :
[0190]
[0191] After filling, W 0 and W 1 Converted into a three-dimensional pseudo-random matrix (pseudo-random matrix) K of size M×N×3 1 and K 2 , the conversion is as follows:
[0192]
[0193] Among them, the floor() function represents the rounding down function;
[0194] Then the image matrix PP is scrambled by spiral traversal across the plane. The specific scrambling process is as follows:
[0195] If M is an odd number, the number of circles required for the spiral traversal is I = (M / 2) + 1; if M is an even number, the number of circles required for the spiral traversal is I = M / 2;
[0196] Each image has the same number of spiral traversal circles I, and the outermost circle to the innermost circle of the spiral traversal are denoted as CR k ,CR k-1 ,…,CR 1 , where k = I, I-1, …, 1; first traverse the CR of the first image I Circle, then traverse the CR of the second image I-1 Circle, and so on; when traversing to the CR of the last image t Circle (1≤t≤I), back to the CR of the first image again I-1 The circle is traversed, and then the CR of the second image is traversed I-2 Circle, repeat the above traversal process;
[0197] When all the spiral turns of the first image have been traversed, the CR of the second image will be traversed. I The traversal process similar to the first image is repeated, and so on, until all images are traversed; thus, the pixel value sequence obtained after the traversal is the result of a scrambling, such as Figure 3 Given the direction of a spiral traversal path, all the sequences obtained by traversal are saved as a one-dimensional vector T 0 ;
[0198] Figure 4 (a) gives an example of three 4×4 matrices performing cross-plane spiral traversal and index scrambling. Figure 4 The matrices in (a) are denoted as EP from left to right. 1 ,EP 2 and EP 3 ; First, EP 1 The outermost spiral traversal, such as Figure 4 (a) Chinese EP 1 As shown in the outer circle path; then in EP 1 The spiral path that has been traversed shrinks one circle and performs EP 2 The spiral traversal of Figure 4 (a) Chinese EP 2 As shown in the inner circle path; then, due to the EP 2 After the spiral path is traversed, EP is performed after shrinking one circle. 3 There is no spiral path to traverse, so no EP is needed 3 The spiral traversal ends the first round of traversal; the second round of traversal starts from EP 1 The inner circle path starts, and then shrinks inward for a circle. 2 There is no spiral path to traverse, so the second round of traversal ends, that is, the first matrix has been completely traversed; the third round of traversal starts from EP 2 The outer path starts, and when the traversal of EP is completed 2 After the black path, shrink a circle on this basis and traverse EP 3 The black path of the traversal ends the third round of spiral traversal. At this point, all elements of the second image have been traversed. The fourth round of traversal starts from EP 3 The outer path starts due to EP 3 There are no other images after that, so when EP 3 After the outer circle path traversal is completed, the entire cross-plane spiral traversal process ends. Figure 4 (b) is a scrambled matrix obtained after spiral traversal across the plane (i.e., a one-dimensional vector T 0 ); The first scrambled matrix is scrambled by index to obtain the second scrambled image (i.e., the one-dimensional vector T 1 ), the result is as follows Figure 4 (c)
[0199] Scramble the one-dimensional vector T using the index sequence S 0 , and obtain a one-dimensional vector T of size M×N×3 1, the specific scrambling process is as follows:
[0200] T 1 (i) = T 0 (S(i)), i = 1, 2, …, M × N × 3
[0201] where, T 1 (i) is the i-th element of the one-dimensional vector T 1 ; T 0 (S(i)) represents scrambling the i-th element of the one-dimensional vector T using the index sequence S 0 ;
[0202] Finally, convert the one-dimensional vector T 1 into a three-dimensional matrix TCM of size M × N × 3:
[0203] TCM = reshape(T 1 , M, N, 3)
[0204] Combine with the three-dimensional pseudo-random matrix K 1 , starting from the first-layer image, from top to bottom, according to the following calculation formula, perform a forward diffusion operation on the scrambled three-dimensional matrix TCM to obtain the forward-diffused matrix C 0 :
[0205]
[0206] A 0 (r, c, l) and B 0 (r, c, l) are expressed as follows:
[0207]
[0208] where, C 0 (r, c, l) is the element in the r-th row, c-th column, and l-th layer of the matrix C 0 ; L is the number of image layers;
[0209] Figure 5 gives an example of the forward diffusion operation of three 4×4 image matrices combined with the pseudo-random matrix generated by the chaotic sequence. Let the pseudo-random matrix used for forward diffusion be EK 1 ; during the forward diffusion process, let rf be the row number, cf be the column number, and lf be the number of the image matrix; and 1 < rf ≤ 4, 1 < cf ≤ 4, 1 < lf ≤ 3. When the pixel to be diffused is at the position (1, 1, 1), since there are no diffused elements to its left and above, add the pixel value and the element value at the corresponding position of the pseudo-random matrix EK 1 modulo to complete the diffusion operation of the pixel value. The process is as Figure 5(a) When the pixel to be diffused is located at (1, c, 1), there are diffused pixels to the left, but no diffused pixels to the top. Therefore, the pixel value is compared with the diffused pixel value to the left and EK 1 The element values at the corresponding positions are modulo-added. The process is as follows: Figure 5 (b) Figure 5 In (c), the pixel is located at (r, 1, 1). There is no diffused pixel to the left of the pixel, but there is a diffused pixel to the top. Therefore, take its pixel value and the diffused pixel value to the top and EK 1 The element values at the corresponding positions are modulo-added to obtain the result of the diffusion of the pixel value; when the pixel is in the first layer but not in the first row and the first column, such as Figure 5 As shown in (d), the pixel has diffused pixels to the left and upward, so take the pixel value of the pixel and its pixel values in the left and upward directions, and EK 1 Perform modular addition operation on the element values at corresponding positions; Figure 5 (e) and Figure 5 (f) represents the diffusion process across planes. Their diffusion operation is essentially based on the diffusion process within a plane, adding the diffusion effect between different planes. Therefore, the diffusion effect across planes can be obtained by simply adding the pixel value diffused at the corresponding position of the previous plane to the modular addition operation of the diffusion within the plane.
[0210] Starting from the last layer of images, from bottom to top, combined with the three-dimensional pseudo-random matrix K 2 According to the following calculation formula, the matrix C 0 Perform reverse diffusion operation to obtain the final ciphertext image C 1 , complete multi-image encryption:
[0211]
[0212] A 1 (r,c,l) and B 1 The expression for (r,c,l) is as follows:
[0213]
[0214] Among them, C 0 (r,c,l) is the ciphertext image C 1 The element at the rth row, cth column, and lth level in ;
[0215] Figure 6 An example of reverse diffusion operation using three 4×4 image matrices combined with a pseudo-random matrix generated by a chaotic sequence is given. Suppose the pseudo-random matrix used for reverse diffusion is EK 2; The process of reverse diffusion is similar to the forward process. The main difference is that the forward diffusion starts from the first image matrix, while the reverse diffusion starts from the last image matrix. The diffusion direction within the plane and between different planes is also exactly opposite to the forward diffusion. Let rr be the row number, cr be the column number, and lr be the image matrix; and 1≤rr<4,1≤cr<4,1≤lr<3, Figure 6 (a) indicates that in the reverse diffusion process, when the pixel is located at (4,4,3), since there is no diffused pixel to the right and downward, it is only necessary to compare the pixel value at this position with EK 2 The pixel values at the corresponding positions are subjected to modular addition operations to complete the diffusion operation of the pixel; Figure 6 (b) and Figure 6 (c) shows the diffusion process of the pixel at position (4,cr,3) and (rr,cr,3) respectively. When the pixel is at (4,cr,3), the pixel can only diffuse to the right, so the pixel value of the pixel and its pixel value to the right and EK 2 The pixel values at the corresponding positions can be modulo-added; when the pixel is at (rr, cr, 3), the pixel can diffuse to the right and downward at the same time, so it is only necessary to add the pixel value to the right, downward and EK 2 The pixel values at the corresponding positions are subjected to modular addition operations to complete the diffusion operation of the pixel; Figure 6 (d) and Figure 6 (e) represent the reverse diffusion process between different planes, which is actually Figure 6 (a) and Figure 6 (c) The diffusion effect between different planes is increased in the diffusion direction. They are all based on the diffusion within the plane plus EK 2 The result of the modular addition operation after the element value at the corresponding position;
[0216] This embodiment also provides a simulation experiment. Figure 7 The plaintext images House, Kiel and Peppers are shown; Figure 7 The plaintext image House, Kiel and Peppers are encrypted to obtain Figure 8 The ciphertext image shown; Figure 8 Decrypt the ciphertext image and get Fig. 9 The decrypted image shown; it can be seen that this method can achieve high-quality image encryption;
[0217] This embodiment also counts Figure 7 The grayscale histogram of Figures 10-12 As shown, they are the histogram of the plaintext image House, the histogram of the plaintext image Kiel, and the histogram of the plaintext image Peppers; Fig.13 is the histogram of the ciphertext image; Figures 10 to 13 It can be seen that this method has high security and strong robustness;
[0218] This method can effectively enhance the dynamic performance of the chaotic system, while improving the effect and efficiency of image encryption; in addition, the encrypted image generated by this method has higher anti-attack ability and robustness.
[0219] The same or similar reference numerals correspond to the same or similar components;
[0220] The terms used in the drawings to describe positional relationships are only used for illustrative purposes and should not be construed as limiting this patent;
[0221] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A multi-image encryption method based on a four-dimensional memristor hyperchaotic system, characterized in that: The following steps are involved: S1: construct a new memristor model, introduce the new memristor model into a three-dimensional chaotic system, and obtain a four-dimensional memristor hyperchaotic system; S2: Obtain plaintext grayscale images P1, P2 and P3, and calculate the hash value hash associated with each plaintext grayscale image respectively, cross-reorganize each hash value hash and convert it through a preset mathematical model to obtain the initial values x0, y0, z0 and u0 of the chaotic system; substitute the initial values x0, y0, z0, u0 into the four-dimensional memristor hyperchaotic system for iterative update to generate random sequences X, Y, Z and U; S3: preprocess the plaintext grayscale images P1, P2 and P3, and the size of each image after preprocessing is M×N, where M and N are the height and width of the preprocessed image respectively; Construct an image matrix PP of size M×N×3 based on all preprocessed images; sort the random sequence X in ascending order to obtain an index sequence S; use the sequences Y, Z, and U to generate three-dimensional pseudo-random matrices K1 and K2 of size M×N×3; S4: perform a spiral traversal of the image matrix PP across the plane, and store the pixel values obtained by the traversal in a one-dimensional vector T0; perform index scrambling on the one-dimensional vector T0 using the index sequence S, and store the scrambled sequence in a one-dimensional vector T1; S5: Reorganize the one-dimensional vector T1 into a three-dimensional matrix TCM of size M×N×3; use the three-dimensional pseudo-random matrix K1 to perform a cross-plane forward diffusion operation on the three-dimensional matrix TCM to obtain the matrix C0 after forward diffusion; use the three-dimensional pseudo-random matrix K2 to perform a cross-plane reverse diffusion operation on the matrix C0 to obtain the final ciphertext image C1, and complete multi-image encryption.
2. The multi-image encryption method based on a four-dimensional memristor hyperchaotic system according to claim 1, characterized in that: In step S1, the constructed novel memristor model is expressed as: Where i is the current through the memristor, v is the voltage applied across the memristor, is the state variable inside the memristor, is the memristor’s memristor function, For is a continuous function of the independent variable, and α, β, and ε are the first to third preset parameters respectively.
3. The multi-image encryption method based on a four-dimensional memristor hyperchaotic system according to claim 2, characterized in that: In step S1, the novel memristor model is introduced into the three-dimensional chaotic system to obtain a four-dimensional memristor hyperchaotic system, denoted as M4CS, which is expressed as: W(u) is α +ln(β+u) Among them, x, y, z and u are the inputs of M4CS, and is the output of M4CS; μ, η, a, b and k are the fourth to eighth preset parameters respectively.
4. The multi-image encryption method based on a four-dimensional memristor hyperchaotic system according to claim 1, characterized in that: The step S2 comprises: S2.1: Input three plaintext grayscale images P1, P2 and P3; S2.2: Use SHA-256 to calculate the hash values of P1, P2 and P3 respectively, and record the corresponding hash values obtained as H1, H2 and H3 respectively; cross-recombine H1, H2 and H3 to form a new hash value K'. The cross-recombination rules are as follows: K'={H1(1),H2(1),H3(1),…,H1(64),H2(64),H3(64)} S2.3: Group K' into groups, with each group consisting of 12 hexadecimal numbers, for a total of 16 groups, denoted as K' = {K1', K'2, ..., K1'6}; convert the hexadecimal values in each group into decimal values to obtain the key h, denoted as h = {h1, h2, ..., h 16 }, the process of converting K' from hexadecimal to decimal is as follows: h i =hex2dec(K i '),i=1,…,16 Among them, hex2dec() is a hexadecimal to decimal conversion function; S2.4: convert the key h through a mathematical model to obtain initial values x0, y0, z0 and u0; S2.5: Substitute the initial values x0, y0, z0, and u0 into M4CS and iterate several times to obtain four sets of random sequences X, Y, Z, and U.
5. The multi-image encryption method based on a four-dimensional memristor hyperchaotic system according to claim 4, characterized in that: In step S2, the preset mathematical model is specifically: Among them, mod represents the remainder function.
6. A multi-image encryption method based on a four-dimensional memristor hyperchaotic system according to claim 4 or 5, characterized in that: In step S2.5, the initial values x0, y0, z0, and u0 are substituted into M4CS and iterated (500+M×N×3) times, and the results of the first 500 iterations are discarded to eliminate transient effects, thereby obtaining four random sequences of X, Y, Z, and U.
7. The multi-image encryption method based on a four-dimensional memristor hyperchaotic system according to claim 1, characterized in that: The step S3 comprises: S3.1: Record the sizes of three plaintext grayscale images P1, P2 and P3 respectively; S3.2: Divide the pixels of the plaintext grayscale images P1, P2 and P3 by rows, and record the total number of rows after segmentation tl, and calculate the size of each image after preprocessing according to the following formula: M = N = ceil (sqrt (tl / 3)) Among them, sqrt means to find the square root; the function ceil() means the upward rounding function; S3.3: construct an all-zero matrix O of size M×N×3, fill the preprocessed image row by row into the all-zero row vector, and obtain a new image matrix PP; S3.4: Sort the chaotic sequence X in ascending order to generate the index sequence S, as shown below: [~,S]=sort(X) S3.5: Create two one-dimensional vectors W0 and W1 of size M×N×3, and use the chaotic sequences Y, Z, and U to fill W0 according to the following method: Fill W1 as follows: S3.6: Convert the padded W0 and W1 into three-dimensional pseudo-random matrices K1 and K2 of size M×N×3 respectively, as follows: Among them, the floor() function represents the rounding down function.
8. The multi-image encryption method based on a four-dimensional memristor hyperchaotic system according to claim 1, characterized in that: The step S4 comprises: S4.1: Perform a cross-plane spiral traversal scrambling on the image matrix PP. The specific scrambling process is as follows: If M is an odd number, the number of circles required for the spiral traversal is I = (M / 2) + 1; if M is an even number, the number of circles required for the spiral traversal is I = M / 2; Each image has the same number of spiral traversal circles I, and the outermost circle to the innermost circle of the spiral traversal are denoted as CR k ,CR k-1 ,…,CR1, where k=I,I-1,…,1; first traverse the CR of the first image I Circle, then traverse the CR of the second image I-1 Circle, and so on; when traversing to the CR of the last image t Circle (1≤t≤I), back to the CR of the first image again I-1 The circle is traversed, and then the CR of the second image is traversed I-2 Circle, repeat the above traversal process; When all the spiral turns of the first image have been traversed, the CR of the second image will be traversed. I Circle, repeat the traversal process similar to the first image, and so on, until all images are traversed; all the sequences obtained by traversal are saved as a one-dimensional vector T0; S4.2: Use the index sequence S to scramble the one-dimensional vector T0 to obtain a one-dimensional vector T1 of size M×N×3. The specific scrambling process is as follows: T1(i)=T0(S(i)),i=1,2,…,M×N×3 Wherein, T1(i) is the i-th element of the one-dimensional vector T1; T0(S(i)) represents the i-th element of the one-dimensional vector T0 scrambled using the index sequence S.
9. The multi-image encryption method based on a four-dimensional memristor hyperchaotic system according to claim 1, characterized in that: The step S5 comprises: S5.1: Convert the one-dimensional vector T1 into a three-dimensional matrix TCM of size M×N×3: TCM=reshape(T1,M,N,3) S5.2: Combined with the three-dimensional pseudo-random matrix K1, starting from the first layer of the image, from top to bottom, according to the following calculation formula, the scrambled three-dimensional matrix TCM is forward diffused to obtain the matrix C0 after forward diffusion: The expressions of A0(r,c,l) and B0(r,c,l) are as follows: Where C0(r,c,l) is the element of the rth row, cth column, and lth layer in the matrix C0; L is the number of image layers; S5.3: Starting from the last layer of images, from bottom to top, combined with the three-dimensional pseudo-random matrix K2, according to the following calculation formula, the matrix C0 is subjected to reverse diffusion operation to obtain the final ciphertext image C1: The expressions of A1(r,c,l) and B1(r,c,l) are as follows: Where C0(r,c,l) is the element at the rth row, cth column, and lth layer in the ciphertext image C1.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Plaintext associated image encryption algorithm based on hyperchaos Chen system
CN108234813A
Color image compression encryption method based on two-dimensional compressed sensing and memristor chaotic system
CN111614455A
Hyper-chaotic encryption method based on Josephf traversal and bit plane reconstruction
CN112422266A
Multi-image encryption algorithm based on cascade modulation chaotic system and block scrambling-diffusion
CN114928434A
Chaotic map-based digital chaotic encryption method
WO2018153317A1
Cited By
Remote sensing image encryption method based on four-dimensional hyperchaotic mapping
CN120498643A
A remote sensing image encryption method based on four-dimensional hyperchaotic mapping
CN120498643B