A multi-image encryption method based on improved z curve and chaotic signal

By combining the improved z-curve and chaotic signal with a grid multi-vortex chaotic system and DNA dynamic coding multi-image encryption method, the efficiency and security issues of single-image encryption algorithms in the era of big data are solved, achieving efficient and secure multi-image encryption and enhancing resistance to differential attacks and noise attacks.

CN119892999BActive Publication Date: 2026-07-21SHANGHAI MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI MARITIME UNIVERSITY
Filing Date
2024-12-18
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing single-image encryption algorithms are insufficient to meet the demands of rapid and efficient processing of massive amounts of information in the era of big data. Traditional space-filling curve scrambling has weak randomness and is easily cracked. Furthermore, existing image encryption algorithms are not effective against differential attacks and noise attacks.

Method used

An improved z-curve and chaotic signal are combined with a grid multi-vortex chaotic system and DNA dynamic coding multi-image encryption method. The key is generated by randomly fusing color images, and the image pixels are diffused by using the improved z-curve and Knuth-Durstenfeld Shuffle algorithm.

Benefits of technology

It improves encryption efficiency, enhances key randomness and image security, effectively resists differential and noise attacks, and improves the security and anti-cracking ability of image encryption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892999B_ABST
    Figure CN119892999B_ABST
Patent Text Reader

Abstract

The application discloses a multi-image encryption method based on improved z curve and chaotic signals, which comprises the following steps: fusing four input images with different sizes into a fused image by randomly selecting R, G and B color channels of the input images; processing the fused image by using an SHA256 algorithm to obtain a key, and calculating the initial value of a grid multi-vortex chaotic system by grouping, and then performing zero padding and block operation on the fused image in sequence, and then substituting the initial value into the grid multi-vortex chaotic system to obtain three chaotic sequences, and performing partial division on the chaotic sequences; combining the chaotic sequences, performing scrambling operation on each sub-block by two algorithms in sequence and storing the sub-blocks into an array; performing dynamic DNA encoding and decoding operation on the elements in the array by combining the chaotic sequences to obtain sequence DNAjiema; and performing grouping diffusion on the sequence DNAjiema by using an improved center diffusion algorithm, so that an encrypted image is finally obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of image encryption, specifically a multi-image encryption method based on improved z-curves and chaotic signals. Background Technology

[0002] With the rapid development of information technology, information security has become increasingly urgent, especially the security of images as a crucial information transmission medium. As computer technology advances rapidly, various cracking techniques emerge, making the search for more secure and effective encryption algorithms imperative.

[0003] Most existing image encryption algorithms are single-image encryptions. However, with the rapid development of information technology, single-image encryption algorithms are no longer suitable for the demands of the big data era for rapid and efficient processing of massive amounts of information. Multi-image encryption not only provides higher security when protecting multiple image data, but also allows for parallel processing of multiple images, significantly improving data encryption efficiency and becoming an ideal choice for meeting the challenges of the big data era. Chaos theory, with its high initial value sensitivity and randomness, has been widely applied in the field of image encryption. Compared with conventional chaotic systems, multi-vortex chaotic systems have more complex chaotic behavior and nonlinear characteristics. When used for image encryption, it can increase the randomness of the signal and enhance its resistance to various interferences. Scrambling of space-filling curves can effectively increase the security of image encryption. However, traditional space-filling curves have relatively simple paths and weak randomness, making them easy to crack.

[0004] In view of this, the present invention provides a multi-image encryption algorithm based on an improved z-curve, a grid multi-vortex chaotic system, and DNA dynamic coding. Summary of the Invention

[0005] This invention provides a multi-image encryption method based on an improved z-curve and chaotic signals. Simulation results and security analysis show that the multi-image encryption algorithm can resist differential attacks, cropping attacks, noise attacks, etc., and has good security performance.

[0006] This invention can be achieved through the following technical solutions:

[0007] A multi-image encryption method based on improved z-curves and chaotic signals includes the following steps:

[0008] Step 1: By randomly selecting the R, G, and B color channels of the input image, merge four input images of different sizes into a single merged image O;

[0009] Step 2: Use the SHA256 algorithm to process the fused image O to obtain the key, and calculate the initial values ​​X0, Y0, and Z0 of the grid multi-vortex chaotic system through group calculation. At the same time, perform zero-padding and block-division operations on the fused image O in sequence. Then, substitute the initial values ​​X0, Y0, and Z0 into the grid multi-vortex chaotic system to obtain three chaotic sequences X, Y, and Z, and divide the chaotic sequences into parts.

[0010] Step 3: Combining the divided chaotic sequence, each sub-block is scrambled using the improved z-curve and the Knuth-DurstenfeldShuffle algorithm, and the scrambled sub-blocks are stored in the cell array.

[0011] Step 4: By combining the divided chaotic sequence, the elements in the cell array are dynamically encoded, processed, and decoded to obtain the sequence DNA jiema;

[0012] Step 5: The sequenced DNA jiema is grouped and diffused using an improved center diffusion algorithm to finally obtain an encrypted image.

[0013] Furthermore, in step one, one channel is randomly selected from the R, G, and B channels of each input image, and the image pixels of the selected channel are filled into an M*M matrix one by one to form the R channel of the fused image O. Then, one channel is randomly selected from the remaining two channels of each input image, and the image pixels of the selected channel are filled into an M*M matrix one by one to form the G channel of the fused image O. Finally, the image pixels of the remaining channel of each input image are filled into an M*M matrix one by one to form the B channel of the fused image O, thus forming an M*M fused image O.

[0014] Furthermore, in step two, a channel is randomly selected from the fused image O, the average pixel value of the channel is calculated, and it is used as the input of the SHA256 algorithm to obtain a 256-bit hash value K, i.e., key K. The key K is divided into 32 groups and the initial values ​​X0, Y0, and Z0 of the grid multi-vortex chaotic system are calculated.

[0015] Furthermore, the initial values ​​X0, Y0, and Z0 of the grid-based multi-vortex chaotic system are calculated using the following equations.

[0016]

[0017] X0 = (x0 + y0) / 2

[0018] Y0 = (z0 + w0) / 2

[0019] Z0 = (x0 + y0 + z0 + w0) / 2

[0020] Furthermore, the fused image O is first zero-padding to obtain a matrix of size M2*M2*3, then divided into blocks, with each sub-block corresponding to a matrix of size t*t. The initial values ​​X0, Y0, and Z0 are then substituted into the grid-based multi-vortex chaotic system to calculate the chaotic sequences X, Y, and Z.

[0021] Then take the first to third (M2) elements of the chaotic sequence X. 2 / t 2 Let the position be denoted as chaotic sequence X1, and let the first (1+3)*(M2)th position of chaotic sequence X be... 2 / t 2 Up to the 1+3*(M2) 2 / t 2 Let +M2*M2*24 be the chaotic sequence X2, and let the first + 3*(M2)th bit of the chaotic sequence X be... 2 / t 2 +M2*M2*24 to the 1st+3*(M2) 2 / t 2 Let the position +M2*M2*24+M2*M2*12 be denoted as chaotic sequence X3, let the position 1 to 24*M2*M2 of chaotic sequence Y be denoted as chaotic sequence Y1, let the position 1+24*M2*M2 to 1+24*M2*M2+12*M2*M2 of chaotic sequence Y be denoted as chaotic sequence Y2, and let chaotic sequence Z remain unchanged.

[0022] Furthermore, in step two, the fused image O is divided into three two-dimensional matrices, and each two-dimensional matrix is ​​padded with zeros. Each padded two-dimensional matrix has a size of M²*M². Then, each padded two-dimensional matrix is ​​divided into M²*M² / t... 2 A small block,

[0023] For each sub-block, the improved z-curve is first used in conjunction with the chaotic sequence X1 to scramble the sub-block. Then, the Knuth-Durstenfeld Shuffle algorithm is used to further scramble the sub-block. Finally, the scrambled sub-blocks are stored in the cell array in row order.

[0024] Furthermore, the improved z-curve is set as a closed-loop curve, obtained by rotating the z-shaped curves by 90 degrees sequentially four times and then connecting them end to end. It includes the first to fourth z-shaped curves in a clockwise direction. Based on the starting position and direction of movement, four traversal modes are designed.

[0025] Traversal mode 1 is: starting from the bottom left corner and traversing along the first z-shaped curve; traversal mode 2 is: starting from the top left corner and traversing along the second z-shaped curve; traversal mode 3 is: starting from the top right corner and traversing along the third z-shaped curve; traversal mode 4 is: starting from the bottom right corner and traversing along the fourth z-shaped curve.

[0026] Using the following equation, each element in the chaotic sequence X1 can be converted into a number between 1 and 64.

[0027] X1 = mod(ceil(abs(X1)*10) 15 ),64)+1

[0028] Take t=8, use the different values ​​in the transformed chaotic sequence X1 as the starting points of different sub-blocks, and scramble the 8*8 sub-blocks according to the traversal pattern.

[0029] Furthermore, the method for obtaining the sequence DNA jiema in step four includes the following steps:

[0030] Step I: First, convert each element in the cell array into an eight-bit binary string to form the sequence hechengtu. Then, use the following equation to convert each element in the chaotic sequence X2 into a number between 0 and 7. Then, according to the DNA encoding rules in Table 1, use the converted chaotic sequence X2 to encode the sequence hechengtu into DNA to obtain the first sequence DNAbianma.

[0031] X2 = mod(ceil(abs(X2)*10) 15 ),8)

[0032] Table 1 DNA coding rules

[0033]

[0034] Step II: Repeat Step I. According to the DNA encoding rules, use the chaotic sequence X3 to encode the chaotic sequence Z to obtain the second sequence DNAbianma. Then, according to the DNA operation rules in Table 2, use the chaotic sequence Y1 to perform DNA operations on the first and second sequences DNAbianma to obtain the sequence DNAyunsuan.

[0035] Among them, the equation X3 = mod(ceil(abs(X3)*10) is used. 15 ),8), each element in the chaotic sequence X3 is processed into a number between 0 and 7;

[0036] Table 2 DNA Operation Rules

[0037]

[0038] Step III: Following the inverse operation of DNA encoding rules, use the chaotic sequence Y2 to decode the DNA sequence yunsuan to obtain the DNA sequence jiema.

[0039] Furthermore, in step II, each element in the chaotic sequence Y1 is first processed into a number between 0 and 4 using the following equation;

[0040] Y1 = mod(ceil(abs(Y1)*10) 15 ),5)

[0041] Then, iterate through the bases at the same positions in the first and second DNA sequences. According to the DNA operation rules in Table 2, when Y1 is 0, perform the addition operation between the first and second DNA sequences; when Y1 is 1, perform the subtraction operation between the first and second DNA sequences; when Y1 is 2, perform the XOR operation between the first and second DNA sequences; when Y1 is 3, perform the XOR operation between the first and second DNA sequences; and when Y1 is 4, perform the inversion operation of the first DNA sequence.

[0042] Furthermore, based on the improved center diffusion algorithm, the DNA jiema sequence is divided into multiple subsequences of length 8. The fourth and fifth positions of each subsequence are selected as the starting point. The values ​​of the fourth and fifth positions are compared. If the values ​​are different, all positions are inverted. If the values ​​are the same, the values ​​of the third and sixth positions are compared. If the values ​​of the third and sixth positions are different, the values ​​of the first to third positions and the sixth to eighth positions are inverted. If the values ​​are the same, the values ​​of the second and seventh positions are compared. If the values ​​of the second and seventh positions are different, the values ​​of the first, second, seventh, and eighth positions are inverted. If the values ​​are the same, the values ​​of the first and eighth positions are compared. If the values ​​of the first and eighth positions are different, the values ​​of the first and eighth positions are inverted. If the values ​​are the same, the subsequence remains unchanged. This achieves the diffusion of image pixels. The diffused binary number is then converted into a decimal number, and the matrix is ​​converted into M2*M2*3 to obtain the encrypted image.

[0043] The beneficial technical effects of this invention are as follows:

[0044] 1. Compared with existing image encryption technologies, the multi-image encryption algorithm of this invention first randomly fuses color images of different sizes to obtain a fused image. Then, it randomly selects the average pixel value of one channel from the fused image as the input to the SHA256 algorithm to generate a key, which serves as the initial value for the grid multi-vortex chaotic system. Next, it uses an improved z-curve and the Knuth-Durstenfeld Shuffle algorithm to scramble the pixels of the fused image, reducing the correlation between image pixels and achieving pixel-level encryption. Finally, it uses a grid multi-vortex chaotic sequence, DNA dynamic coding, and an improved center diffusion algorithm to diffuse the image pixels, completing the image encryption. This method improves encryption efficiency by randomly combining four color images of different sizes through the R, G, and B channels to fuse them into a single color image for parallel encryption. Furthermore, by associating the chaotic key with the pixel values ​​of the fused image, it enhances the randomness of the key, achieving "one-to-one" encryption. Figure One dense".

[0045] 2. To address the limitations of traditional space-filling curve scrambling, this invention designs an improved Z-curve, which is a closed-loop curve obtained by rotating the Z-shaped curve by 90 degrees sequentially four times and then connecting them end to end. This allows any position within an 8x8 sub-block to serve as a starting point. The initial position of the scrambled image pixels in the improved Z-curve is determined by the chaotic sequence of the grid multi-vortex chaotic system. By scrambling the original sub-blocks, different sub-blocks select different initial Z-curve scrambling positions, making it difficult for attackers to infer the content of the original image by analyzing features such as histograms and frequency distributions, thus making it difficult to crack.

[0046] 3. This invention employs a combination of dynamic DNA encoding, grid-based multi-vortex chaotic sequences, and an improved center diffusion algorithm to perform diffusion operations on image pixels. First, applying biological DNA to image encryption adds extra complexity and randomness. Dynamic DNA encoding transforms image pixel values ​​into DNA bases, and the dynamic switching of different encoding rules makes the representation of image data more complex, thereby enhancing encryption strength. DNA operations include DNA addition, subtraction, XOR, XNOR, and inversion, with the operation rules dynamically generated using multi-vortex chaotic sequences, ensuring that each base is calculated differently, further improving resistance to attacks. DNA decoding transforms bases into image pixel values, thus achieving the first diffusion of image pixels. Second, the improved center diffusion algorithm is applied to the diffusion processing of image pixels, selecting the center point as the starting point and comparing and diffusing bit by bit to achieve a second diffusion of image pixels, better resisting statistical and differential attacks, further enhancing the security of the encryption algorithm.

[0047] Simulation results and security analysis show that the multi-image encryption algorithm of this invention has good security and resistance to various attacks. Attached Figure Description

[0048] Figure 1 This is a schematic diagram of the overall process of the present invention;

[0049] Figure 2 This is a schematic diagram of the Lyapunov exponent of the grid-based multi-vortex chaotic system of the present invention;

[0050] Figure 3 These are schematic diagrams illustrating four modes of the improved z-curve of this invention;

[0051] Figure 4 This is a schematic diagram of the improved z-curve scrambling process of the present invention;

[0052] Figure 5 The simulation results of this invention are shown in the following: (a) original images of Peppers, Baboon, House, and Plane; (b) encrypted images; and (c) decrypted images of Peppers, Baboon, House, and Plane.

[0053] Figure 6 Histograms of the original image and encrypted image of the present invention, wherein (a) Peppers histogram, (b) Baboon histogram, (c) House histogram, (d) Plane histogram, and (e) encrypted image histogram;

[0054] Figure 7 This is a schematic diagram of the key sensitivity test of the present invention, wherein (a) Peppers decryption image with x offset 10-14, (b) Baboon decryption image with x offset 10-14, (c) House decryption image with x offset 10-14, and (d) Plane decryption image with x offset 10-14.

[0055] Figure 8 This is a schematic diagram of the correlation test of adjacent pixels in the present invention, wherein (a) the horizontal correlation distribution of adjacent pixels in Plane, (b) the horizontal correlation distribution of adjacent pixels in the encrypted image, (c) the vertical correlation distribution of adjacent pixels in House, (d) the vertical correlation distribution of adjacent pixels in the encrypted image, (e) the diagonal correlation distribution of adjacent pixels in Peppers, and (f) the diagonal correlation distribution of adjacent pixels in the encrypted image.

[0056] Figure 9 This is a schematic diagram of the cropping attack experiment of the present invention, wherein (a) 25% of the encrypted and decrypted images are cropped from the upper left corner; (b) 25% of the encrypted and decrypted images are cropped from the center; (c) 25% of the encrypted and decrypted images are cropped from the top; and (d) 25% of the encrypted and decrypted images are cropped from the four corners.

[0057] Figure 10 This is a schematic diagram of the noise attack test of the present invention, wherein (a) is the encrypted image after the noise attack, (b) is the Peppers decrypted image after the noise attack, (c) is the Baboon decrypted image after the noise attack, (d) is the House decrypted image after the noise attack, and (e) is the Plane decrypted image after the noise attack. Detailed Implementation

[0058] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0059] See appendix Figure 1 This invention provides a multi-image encryption algorithm based on an improved z-curve and chaotic signals, including multi-image fusion, image pixel scrambling, dynamic DNA encoding / decoding, and image pixel diffusion. The multi-image fusion randomly selects the R, G, and B color channels of the input images, fusing four input images of different sizes into a single color fused image. The average pixel value of the fused image is then used as input to the SHA-256 algorithm to obtain the key. Initial values ​​X0, Y0, and Z0 of a grid multi-vortex chaotic system are obtained through group calculation. These initial values ​​are then substituted into the grid multi-vortex chaotic system to obtain three chaotic sequences X, Y, and Z. The image pixel scrambling uses an improved z-curve and the Knuth-Durstenfeld Shuffle algorithm to scramble the image pixels. The dynamic DNA encoding / decoding combines the chaotic sequences to perform DNA encoding, DNA operations, and DNA decoding on the scrambled image sequence. The image pixel diffusion uses an improved center diffusion algorithm to diffuse the pixels of the decoded sequence, ultimately obtaining the encrypted image.

[0060] To address the limitations of traditional space-filling curve scrambling, this invention designs an improved Z-curve. In this improved Z-curve, the initial positions of the scrambled image pixels are determined by the chaotic sequence of a grid-based multi-scroll chaotic system, making it difficult to crack. Furthermore, a combination of dynamic DNA encoding, grid-based multi-scroll chaotic sequences, and an improved center-diffusion algorithm is used to perform diffusion operations on the image pixels, further enhancing the security of the encryption algorithm. Simulation results and security analysis demonstrate that the multi-image encryption algorithm of this invention possesses good security and resistance to various attacks.

[0061] Specifically as follows:

[0062] Step 1: Multi-image fusion

[0063] Input four color images of arbitrary size and read the size of each color image. Let the number of elements in a single channel be s, and let the size of the fused image O be M*M*3. Randomly select one channel from the R, G, and B channels of each color image, and fill the image pixels of the selected channel into the M*M matrix one by one to form the R, G, and B channels of the fused image O.

[0064] Let the sizes of the four input color images of arbitrary size be f*g*3, h*i*3, j*k*3, and l*m*3, respectively, the number of elements in a single channel be denoted as s, and the size of the fused image O be M*M*3.

[0065] One channel is randomly selected from the R, G, and B channels of each color image, and the image pixels of the selected channel are filled into an M*M matrix one by one to form the R channel of the fused image O. Then, one channel is randomly selected from the remaining two channels of each color image, and the image pixels of the selected channel are filled into an M*M matrix one by one to form the G channel of the fused image O. Finally, the image pixels of the remaining channel of each color image are filled into an M*M matrix one by one to form the B channel of the fused image O.

[0066] S and M are calculated as follows:

[0067] s=f*g+h*i+j*k+l*m

[0068] M = ceil(sqrt(s))

[0069] Here, ceil is the rounding function, and sqrt is the square root function.

[0070] Step 2: Image pixel scrambling

[0071] S2.1. The fused image O is processed using the SHA256 algorithm to obtain the key, and the initial values ​​X0, Y0, and Z0 of the grid multi-vortex chaotic system are obtained through group calculation. Then, the initial values ​​X0, Y0, and Z0 are substituted into the grid multi-vortex chaotic system to obtain three chaotic sequences X, Y, and Z.

[0072] Grid-based multi-vortex chaotic systems are a special type of multi-vortex chaotic system. They generate multiple vortex structures through system parameters, thereby forming more complex trajectories in phase space, making the system's behavior unpredictable and exhibiting better chaotic characteristics.

[0073] The mathematical model of the grid multi-vortex chaotic system is shown in equation (1):

[0074]

[0075] Where x, y, and z represent system state variables, and a, b ∈ R are system parameters. f(x) and g(y) are the summation parts of the symbolic function, and the formulas for f(x) and g(y) are shown in equation (2):

[0076]

[0077] Where r,e,A,C∈R are positive constants, and n1,n2∈Z are positive integers used to control the number of rolling axes generated by the system.

[0078] When a = 10, b = 18, r = 0.2857, e = 2, A = 2, d = 1, C = 1, (x0, y0, z0) = (0.2, 0, 0), n1 = 1, n2 = 0, the grid multi-vortex chaotic system has 5*3 vortices.

[0079] like Figure 2 As shown, based on the values ​​of the three Lyapounov exponents at any time in the grid multi-vortex chaotic system, it can be seen that at least one Lyapounov exponent is greater than zero, thus indicating that the system is in a chaotic state.

[0080] The method for obtaining the initial values ​​X0, Y0, and Z0 of a grid-based multi-vortex chaotic system using the SHA256 algorithm is as follows: Randomly select a channel from the fused image O, calculate the average pixel value of that channel, and use this average as input to the SHA256 algorithm to obtain a 256-bit hash value K, i.e., the key K. Divide the key K into 32 groups, denoted as K1, K2, ..., K... 32 Using grouping K1, K2, ..., K 32 The initial values ​​X0, Y0, and Z0 of the grid-based multi-vortex chaotic system are calculated using the following formulas:

[0081]

[0082] X0 = (x0 + y0) / 2

[0083] Y0 = (z0 + w0) / 2

[0084] Z0 = (x0 + y0 + z0 + w0) / 2

[0085] S2.2 Zero-filling operation

[0086] The fused image O is divided into three two-dimensional matrices, denoted as R, G, and B, respectively, and zero-padding is performed on the three two-dimensional matrices R, G, and B. The size of the zero-padding two-dimensional matrix is ​​denoted as M2*M2.

[0087] R = O(:,:,1)

[0088] G = O(:,:,2)

[0089] B = O(:,:,3)

[0090] Next, zero-padding is applied to the three two-dimensional matrices R, G, and B, and the calculation is performed as follows:

[0091] mod(M,t)=M1

[0092] R(M+1:M+t-M1,M+1:M+t-M1,1)=0

[0093] G(M+1:M+t-M1,M+1:M+t-M1,1)=0

[0094] B(M+1:M+t-M1,M+1:M+t-M1,1)=0

[0095] Where t is the size of the block matrix, preferably t = 8.

[0096] This step fills in the number of rows and columns of the image with a number that is divisible by t. The size of the two-dimensional matrix after zero-padding is denoted as M2*M2.

[0097] S2.3. Substitute the initial values ​​X0, Y0, and Z0 into the grid multi-vortex chaotic system to obtain three chaotic sequences X, Y, and Z. Then divide the chaotic sequence X into three parts: X1, X2, and X3, and the chaotic sequence Y into two parts: Y1 and Y2.

[0098] To avoid transient effects, the first 3001 terms of each sequence are discarded, resulting in three chaotic sequences: X, Y, and Z. Chaotic sequence X is then divided into three parts: X1, X2, and X3. Chaotic sequence X1 is used to select the initial position of the z-curve, chaotic sequence X2 is used to select the DNA coding rule, and chaotic sequence X3 is used to encode DNA in sequence Z. Chaotic sequence Y is divided into two parts: Y1 and Y2. Chaotic sequence Y1 is used to select the DNA operation rule, and chaotic sequence Y2 is used to select the DNA decoding rule. Chaotic sequence Z is used for DNA diffusion.

[0099] Specifically, the first to third (M2) lines of the chaotic sequence X... 2 / t 2 Let the position be denoted as chaotic sequence X1, and let the first (1+3)*(M2)th position of chaotic sequence X be... 2 / t 2 Up to the 1+3*(M2) 2 / t 2 Let +M2*M2*24 be the chaotic sequence X2, and let the first + 3*(M2)th bit of the chaotic sequence X be... 2 / t 2 +M2*M2*24 to the 1st+3*(M2) 2 / t 2Let the position +M2*M2*24+M2*M2*12 be denoted as chaotic sequence X3, let the position 1 to 24*M2*M2 of chaotic sequence Y be denoted as chaotic sequence Y1, let the position 1+24*M2*M2 to 1+24*M2*M2+12*M2*M2 of chaotic sequence Y be denoted as chaotic sequence Y2, and let chaotic sequence Z remain unchanged.

[0100] S2.4, Scramble Operation

[0101] Divide each two-dimensional matrix into M2*M2 / t. 2 Each sub-block is preprocessed with the chaotic sequence X1. The improved z-curve is used to scramble each sub-block. The Knuth-Durstenfeld Shuffle algorithm is used to further scramble each sub-block after z-curve scrambling. Finally, the sub-blocks are stored in the cell array in row order.

[0102] like Figure 3 As shown, the z-curve, as an important space-filling curve, makes it difficult for attackers to infer the content of the original image by analyzing features such as histograms and frequency distributions. Traditional z-curve scanning paths are relatively simple and easily cracked. Therefore, this invention improves upon the traditional z-curve, which has different scanning paths for image pixels located at different positions. The traditional z-curve can be described as follows: dividing a square into four equal smaller squares, starting from the center of the upper left square, moving right to the center of the upper right square, then moving left to the center of the lower left square, and finally moving right to the center of the lower right square.

[0103] like Figure 4 As shown, the improved z-curve is set as a closed loop curve, obtained by rotating the z-shaped curves by 90 degrees sequentially four times and then connecting them end to end. It includes the first to fourth z-shaped curves in a clockwise direction. Based on the starting position and direction of movement, four traversal modes are designed. Figure 3 It can be seen that traversal mode 1 is: starting from the lower left corner and traversing according to the first z-shaped curve; traversal mode 2 is: starting from the upper left corner and traversing according to the second z-shaped curve; traversal mode 3 is: starting from the upper right corner and traversing according to the third z-shaped curve; traversal mode 4 is: starting from the lower right corner and traversing according to the fourth z-shaped curve.

[0104] Within an 8x8 sub-block, the improved z-curve follows different scanning paths for image pixels located at different positions. Since the improved z-curve is a closed-loop curve, it can be combined with a chaotic sequence to select any initial position for scrambling, thus exhibiting a degree of randomness.

[0105] Specifically, each two-dimensional matrix is ​​divided into M2*M2 / t 2The chaotic sequence X1 is calculated as follows: each element is converted into a number between 1 and 64, and then each sub-block is scrambled according to a traversal pattern. When 43 is chosen as the initial position, the distribution of image pixels before and after scrambling is as follows: Figure 5 As shown.

[0106] X1 = mod(ceil(abs(X1)*10) 15 ),64)+1

[0107] Here, mod is the modulo function, ceil is the round-up function, and abs is the absolute value function.

[0108] Each sub-block is scrambled using an improved z-curve, resulting in a sub-block size of 1*t. 2 Then, the Knuth-Durstenfeld Shuffle algorithm is used to further scramble each sub-block after the z-curve is scrambled, and the resulting blocks are stored in the cell array.

[0109] Step 3: Dynamic DNA Encoding and Decoding

[0110] S3.1, DNA encoding

[0111] All elements in the cell array are concatenated into a row, and each element is converted into an 8-bit binary string to obtain the sequence hechengtu. The chaotic sequence X2 is preprocessed using the following equation, converting each element into a number between 1 and 8. According to the encoding rules in Table 1, the processed chaotic sequence X2 is used to dynamically encode the sequence hechengtu to obtain the first DNAbianma sequence.

[0112] The chaotic sequence X2 is calculated as follows:

[0113] X2 = mod(ceil(abs(X2)*10) 15 ),8)

[0114] Table 1 DNA Encoding

[0115]

[0116] S3.2, DNA Decoding

[0117] The chaotic sequences Y1, X3, Z, and Y2 are preprocessed according to the following calculation method.

[0118] Y1 = mod(ceil(abs(Y1)*10) 15 ),5)

[0119] X3 = mod(ceil(abs(X3)*10)15 ),8)

[0120] Z = mod(ceil(abs(Z)*10) 15 ),256)

[0121] Y2 = mod(ceil(abs(Y2)*10) 15 ),8)

[0122] Then, following step S3.1, the chaotic sequence Z is dynamically encoded using the chaotic sequence X3 to obtain the second sequence DNAbianma. Then, according to the DNA operation rules in Table 2, the pre-processed chaotic sequence Y1 is used to perform DNA operations on the first and second sequences. The bases in the first sequence DNAbianma correspond to the bases in the first row of Table 2, and the bases in the second sequence DNAbianma correspond to the bases in the first column of Table 2. The bases at the same positions in the first and second sequences are traversed. When Y1 is 0, addition is performed between the first and second sequences; when Y1 is 1, subtraction is performed; when Y1 is 2, XOR is performed; when Y1 is 3, XOR is performed; and when Y1 is 4, the first sequence DNAbianma is inverted. After the DNA operations, the sequence DNAyunsuan is obtained.

[0123] Table 2 DNA Operation Rules

[0124]

[0125] After the DNA operation is completed, the DNA sequence yunsuan is decoded using the preprocessed chaotic sequence Y2 according to the inverse operation of the DNA encoding rule in Table 1 to obtain the DNA sequence jiema.

[0126] Step 4: Image pixel diffusion

[0127] The DNA sequence is grouped, and the pixels are diffused using an improved center diffusion algorithm. The diffused binary numbers are then converted into decimal numbers, and the matrix is ​​converted into M2*M2*3 to obtain the encrypted image.

[0128] The DNA sequence can be divided into multiple subsequences. The center point of each subsequence group is selected as the starting point, and the sequence is compared and diffused bit by bit to achieve pixel diffusion in the image. The diffused binary number is converted into a decimal number, and the matrix is ​​transformed into M2*M2*3 to obtain the encrypted image.

[0129] Specifically, the DNA jiema sequence is divided into multiple subsequences of length 8. The fourth and fifth positions of each subsequence are selected as the starting point. The values ​​of the fourth and fifth positions are compared. If the values ​​are different, all positions are inverted. If the values ​​are the same, the values ​​of the third and sixth positions are compared. If the values ​​of the third and sixth positions are different, the first to third positions and the sixth to eighth positions are inverted. If the values ​​are the same, the values ​​of the second and seventh positions are compared. If the values ​​of the second and seventh positions are different, the first, second, seventh, and eighth positions are inverted. If the values ​​are the same, the values ​​of the first and eighth positions are compared. If the values ​​of the first and eighth positions are different, the first and eighth positions are inverted. If the values ​​are the same, the subsequence remains unchanged. This achieves the diffusion of image pixels. The diffused binary number is then converted into a decimal number, and the matrix is ​​converted into M2*M2*3 to obtain the encrypted image.

[0130] To verify the feasibility of the multi-image encryption method of the present invention, we conducted the following experiment:

[0131] like Figure 5 As shown, the simulation experiment used MATLAB 2019a as the simulation platform to read the original images. Test images of sizes 192×192×3 Pepper, 256×256×3 Baboon, 384×384×3 House, and 512×512×3 Plane were obtained. Figure 6 The diagram in (a) shows how the R channel of the fused image is formed by selecting the B channel of the House image, the B channel of the Baboon image, the R channel of the Plane image, and the R channel of the Peppers image; the G channel of the fused image is formed by selecting the R channel of the House image, the G channel of the Baboon image, the G channel of the Plane image, and the G channel of the Peppers image; the B channel of the fused image is formed by selecting the G channel of the House image, the R channel of the Baboon image, the B channel of the Plane image, and the B channel of the Peppers image; and the R channel of the fused image O is selected to generate the key. The encrypted image of the fused image is 720×720×3. Figure 6 The diagram corresponding to (b) is shown in the figure below, and its decryption result is as follows. Figure 6 The diagram in Figure (c) represents the image corresponding to the image before encryption. The decrypted image is identical to the original image, verifying that the designed algorithm can effectively encrypt and decrypt multiple images.

[0132] Key space is a crucial indicator of the security of an encryption algorithm; it represents the total number of possible keys in the encryption system. In this algorithm, the key space consists of two parts: chaotic system parameters and initial values. When the computational precision is 10-1... -15 At that time, the total key space is 2. 498 Far exceeding the required 2 128Therefore, the proposed algorithm can resist brute-force decryption. Table 3 shows a comparison of this algorithm with other algorithms in terms of key space. Among them, the Chen algorithm comes from the literature [Chen Xiao Yang, Mou Jun, Cao Ying Hong. Chaotic multiple-image encryption algorithm based on block scrambling and dynamic DNA coding. International Journal of Bifurcation and Chaos, 2023, 33(16): 2350190.], the Zuo algorithm comes from the literature [Zuo Jiang Gang, Wang Meng, Zhang Jie. Design of multi scroll chaotic attractor based on a novel multi-segmented memristor and its application in medical image encryption. Microelectronic Engineering, 2024, 287: 112156.], the Song algorithm comes from the literature [Song Wei, Fu Chong, Zheng Yu, et al. Batch image encryption using cross image permutation and diffusion. Journal of Information Security and Applications, 2024, 80(C): 103686.], and the Gokyildirim algorithm comes from the literature [Gokyildirim Abdullah, Cicek Serdar, Calgan Haris, et al.]. [al. Fractional-order Sprott K chaotic system and its application to biometric iris image encryption. Computers in Biology and Medicine, 2024, 179: 108864.]. The results show that the algorithm proposed in this invention has a large key space.

[0133] Table 3 Comparison of Key Spaces

[0134]

[0135] A histogram shows the distribution of pixel values ​​in an image. An ideal encrypted image histogram should exhibit a nearly uniform distribution, effectively concealing information about the pixel distribution of the original image. The histograms of four test images and the encrypted image are shown below. Figure 6 As shown.

[0136] In the analysis of encrypted images, the chi-square test can be used to detect whether the distribution of image pixel values ​​in each channel conforms to the expected random distribution. The chi-square test formula is shown in equation (3):

[0137]

[0138] Where hi and e represent the observed and suggested image pixel frequencies, respectively. When the significance level is at α = 0.05, the χ² of the encrypted image... 2 Below This demonstrates that the histogram has high flatness; Table 2 shows the calculation results. From Figure 6 As can be seen from Table 4, the histogram distribution of the encrypted image is uniform, and the pixel value distribution of each channel image is relatively random. The proposed multi-image encryption algorithm meets the requirements.

[0139] Table 4 Results of the chi-square test

[0140]

[0141]

[0142] Differential attacks introduce subtle changes into a plaintext image, resulting in significant changes in the encrypted image. When analyzing differential attacks, the percentage of pixel change (NPCR) and average pixel change intensity (UACI) are commonly used to measure resistance to differential attacks, as shown in equation (4):

[0143]

[0144] Among them, P E1 (i,j) and P E2 (i,j) represents the image pixel values. If the image pixels change... otherwise

[0145] Table 5 presents the comparison results of this multi-image encryption algorithm with other algorithms. The Yin algorithm is from the reference [Yin Hai, Xu YuLiang, Zhang YongKang. Image compression encryption algorithm combining two-dimensional modular hyperchaotic map and compressedsensing. Physica Scripta, 2024, 99(10): 105288.], and the Xu algorithm is from the reference [Xu WeiJie, LiuLingFeng. An image autonomous selection encryption algorithm based on the delay exponential logistic chaotic model. Nonlinear Dynamics, 2024, 112(13): 11501-11522.]. The results show that the algorithm proposed in this invention has strong resistance to differential attacks, and the NPCR and UACI values ​​are closer to the ideal values.

[0146] Table 5 Comparison of Differential Attacks

[0147]

[0148] Key sensitivity is the ability of an encrypted image to exhibit noticeable changes when the key is slightly altered. For example... Figure 7 As shown, when the offset of key x is set to 10-14, the correct image cannot be obtained during the decryption process. The analysis of key sensitivity is shown in Table 6. Among them, the Fang algorithm comes from the literature [Fang Jie, Zhao Kai Hui, Liang Wan Yong. A novel color image encryption scheme using elliptic curve cryptography and hyperchaotic system. Physica Scripta, 2023, 98(11): 115257.], and the Zhu algorithm comes from the literature [Zhu Shen Li, Deng Xiao Heng, Zhang Wen Dong, et al. Secure image encryption scheme based on a new robust chaotic map and strong S-box].

[0149] [Mathematics and Computers in Simulation, 2023, 207:322-346.] The results show that the algorithm proposed in this invention has strong key sensitivity.

[0150] Table 6 Key Sensitivity Analysis

[0151]

[0152] Typically, adjacent pixels in the original image exhibit high correlation, while effective encryption algorithms ensure that adjacent pixels in the encrypted image exhibit independence and randomness in the horizontal, vertical, and diagonal directions. The formula for the correlation between adjacent pixels is shown in equation (5):

[0153]

[0154] Where E(x), D(x), and cov(x,y) represent the mean, variance, and covariance, respectively, and x i ,y i These represent the image pixel values.

[0155] This invention randomly selects 10,000 pairs of image pixels from the image and calculates the correlation between adjacent pixels in the original image and the encrypted image. Table 7 shows a comparison of the specific values ​​of the correlation before and after encryption. The correlation between adjacent pixels is as follows: Figure 8 As shown, it can be seen that the correlation between the three directions of the image before encryption is very strong, while the correlation between the images after encryption is greatly reduced.

[0156] Table 7. Correlation between adjacent pixels in the original image and the encrypted image.

[0157]

[0158] The two-dimensional correlation coefficient (CC) between the original image and the encrypted and decrypted images is also an important metric for evaluating encryption algorithms. The formula for calculating CC is shown in equation (6):

[0159]

[0160] Where A and B represent two images, This represents the average pixel value of the two images.

[0161] The correlation between the original image, the encrypted image, and the decrypted image is shown in Table 8. Table 8 shows that the correlation between the encrypted image and the original image is low, while the decrypted image remains consistent with the original image.

[0162] Table 8 Correlation Coefficient Analysis

[0163]

[0164] Mean Squared Error (MSE) is used to measure the degree of difference between the original image and the encrypted image. The larger the MSE value, the better the encryption effect. The formula for calculating MSE is shown in equation (7):

[0165]

[0166] Here, f(i,j) and f0(i,j) represent the image pixel intensity functions at the corresponding positions.

[0167] The mean square error of the multi-image encryption algorithm is shown in Table 9. As can be seen from Table 9, the encrypted image differs significantly from the original image, while the decrypted image differs from the original image by zero.

[0168] Table 9 shows the MSE, PSNR, and SSIM between the original and decrypted images.

[0169]

[0170] Peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) are used to evaluate the quality and similarity of the encrypted image relative to the original image. The formula for calculating PSNR is shown in Equation (8). The PSNR and SSIM values ​​of this multi-image encryption algorithm are shown in Table 9.

[0171]

[0172] Shannon entropy reflects the randomness of the pixel value distribution in an encrypted image. The formula for calculating Shannon entropy is shown in equation (9):

[0173]

[0174] Where H(s) represents the Shannon entropy of the encrypted image, s i ,P(s i ) represent the pixel intensity and frequency of occurrence of the image pixels, respectively.

[0175] The Shannon entropy values ​​of the encrypted images are shown in Table 10. Among them, the Laiphrakpam algorithm comes from the literature [Laiphrakpam Dolendro Singh, Akash Lahoty, Chanubala Devi, et al. Image encryption using dynamic S-boxes generated using elliptic curve points and chaotic system. Journal of Information Security and Applications, 2024, 83: 103793.], the Demirtas algorithm comes from the literature [Demirtas Mehmet. Multiple-image encryption using sine quadratic polynomial mapping and u-shaped scanning techniques. Traitement Du Signal, 2024, 41(1): 99-113.], and the Li algorithm comes from the literature [LiLiZong. A novel chaotic map application in image encryption algorithm. Expert Systems with Applications, 2024, 252(Part B): 124316.]. Compared with other algorithms, the images encrypted by the algorithm designed in this invention have strong randomness and unpredictability.

[0176] Table 10 Shannon Entropy

[0177]

[0178]

[0179] During data transmission, image data may be partially lost or cropped due to signal instability, leading to data leakage. Therefore, encryption algorithms need to ensure that even if some parts of the image are lost or cropped during transmission, the image can still be decrypted to a certain extent, reflecting the robustness of the encryption algorithm.

[0180] Cropping was performed at four different locations on the encrypted image. The cropped encrypted image was then decrypted using the correct key. The test results are as follows. Figure 9 As shown. Figure 9 As shown, the original image can still be seen after decryption, indicating that the multi-image encryption algorithm has a good resistance to cropping attacks.

[0181] Similarly, noise attacks are a common threat. During image transmission or storage, random noise is introduced to disrupt the data structure of encrypted images, thereby compromising the quality of decrypted images. Therefore, multi-image encryption algorithms must possess sufficient noise resistance.

[0182] In a noise attack, noise with a strength of 0.05 is applied to an encrypted image, and then the noisy image is decrypted using the correct key. The decrypted image is as follows: Figure 10 As shown in Table 11, the PSNR values ​​of the decrypted images are as follows. Figure 10 As shown, the plaintext information can still be observed after decryption, indicating that the multi-image encryption algorithm has good noise resistance.

[0183] Table 11 PSNR values ​​from salt and pepper noise attack tests

[0184]

[0185] While specific embodiments of the present invention have been described above, those skilled in the art should understand that these are merely illustrative examples. Various changes or modifications can be made to these embodiments without departing from the principles and essence of the present invention. Therefore, the scope of protection of the present invention is defined by the appended claims.

Claims

1. A multi-image encryption method based on improved z-curves and chaotic signals, characterized in that... Includes the following steps: Step 1: By randomly selecting the R, G, and B color channels of the input image, merge four input images of different sizes into a single merged image O; Step 2: Use the SHA256 algorithm to process the fused image O to obtain the key, and calculate the initial values ​​X0, Y0, and Z0 of the grid multi-vortex chaotic system through group calculation. At the same time, perform zero-padding and block-division operations on the fused image O in sequence. Then, substitute the initial values ​​X0, Y0, and Z0 into the grid multi-vortex chaotic system to obtain three chaotic sequences X, Y, and Z, and divide the chaotic sequences into parts. Step 3: Combining the divided chaotic sequence, each sub-block is scrambled using the improved z-curve and the Knuth-DurstenfeldShuffle algorithm, and the scrambled sub-blocks are stored in the cell array. Step 4: By dividing the combined chaotic sequence, the elements in the cell array are dynamically encoded, processed, and decoded to obtain the sequence DNA jiema; Step 5: The sequenced DNA jiema is grouped and diffused using an improved center diffusion algorithm to finally obtain the encrypted image; The improved z-curve is set as a closed-loop curve. This is achieved by rotating the z-shaped curve by 90 degrees sequentially four times, denoted as the first, second, third, and fourth z-shaped curves respectively. These are then connected end-to-end to form the fourth z-shaped curve in a clockwise direction. Based on the starting position and direction of movement, four traversal modes are designed. Traversal mode 1 is: starting from the bottom left corner and traversing along the first z-shaped curve; traversal mode 2 is: starting from the top left corner and traversing along the second z-shaped curve; traversal mode 3 is: starting from the top right corner and traversing along the third z-shaped curve; traversal mode 4 is: starting from the bottom right corner and traversing along the fourth z-shaped curve. According to the improved center diffusion algorithm, the DNA jiema sequence is divided into multiple subsequences of length 8. The fourth and fifth positions of each subsequence are selected as the starting point. The values ​​of the fourth and fifth positions are compared. If the values ​​are different, all positions are inverted. If the values ​​are the same, the values ​​of the third and sixth positions are compared. If the values ​​of the third and sixth positions are different, the values ​​of the first to third positions and the sixth to eighth positions are inverted. If the values ​​are the same, the values ​​of the second and seventh positions are compared. If the values ​​of the second and seventh positions are different, the values ​​of the first, second, seventh, and eighth positions are inverted. If the values ​​are the same, the values ​​of the first and eighth positions are compared. If the values ​​of the first and eighth positions are different, the values ​​of the first and eighth positions are inverted. If the values ​​are the same, the subsequence remains unchanged. This achieves the diffusion of image pixels. The diffused binary number is then converted into a decimal number and reassembled into an encrypted image according to the image size and number of channels after zero padding.

2. The multi-image encryption method based on improved z-curve and chaotic signal according to claim 1, characterized in that: In step one, one channel is randomly selected from the R, G, and B channels of each input image, and the image pixels of the selected channel are filled into an M*M matrix one by one to form the R channel of the fused image O. Then, one channel is randomly selected from the remaining two channels of each input image, and the image pixels of the selected channel are filled into an M*M matrix one by one to form the G channel of the fused image O. Finally, the image pixels of the remaining channel of each input image are filled into an M*M matrix one by one to form the B channel of the fused image O, thus forming an M*M fused image O.

3. The multi-image encryption method based on improved z-curve and chaotic signal according to claim 2, characterized in that: In step two, a channel is randomly selected from the fused image O, and the average pixel value of that channel is calculated. This average value is used as the input to the SHA256 algorithm to obtain a 256-bit hash value K, which is the key K. The key K is divided into 32 groups, denoted as K1, K2, ..., K. 32 The initial values ​​X0, Y0, and Z0 of the grid multi-vortex chaotic system were calculated.

4. The multi-image encryption method based on the improved z-curve and chaotic signal according to claim 3, characterized in that: The initial values ​​X0, Y0, and Z0 of the grid-based multi-vortex chaotic system are calculated using the following equations. 。 5. The multi-image encryption method based on improved z-curve and chaotic signal according to claim 1, characterized in that: First, zero-padding is performed on the fused image O to obtain a matrix of size M2*M2*3. Then, block division is performed, with each sub-block corresponding to a matrix of size t*t. Next, the initial values ​​X0, Y0, and Z0 are substituted into the grid-based multi-vortex chaotic system to calculate the chaotic sequence X, Y, and Z. Then take the first to the second chaotic sequence X Let the position be denoted as chaotic sequence X1, and let the position of chaotic sequence X be denoted as chaotic sequence X1. To the Let the position be denoted as chaotic sequence X2, and let the position of chaotic sequence X be denoted as chaotic sequence X2. To the Let the position be denoted as chaotic sequence X3, and let the first to second positions of chaotic sequence Y be... Let the position be denoted as chaotic sequence Y1, and let the position of chaotic sequence Y be denoted as chaotic sequence Y1. To the The position is denoted as chaotic sequence Y2, and chaotic sequence Z remains unchanged.

6. The multi-image encryption method based on improved z-curve and chaotic signal according to claim 5, characterized in that: In step two, the fused image O is divided into three two-dimensional matrices, and each two-dimensional matrix is ​​padded with zeros. Each padded two-dimensional matrix has a size of M2 * M2. Then, each padded two-dimensional matrix is ​​divided into M2 * M2 / t. 2 A small block, For each sub-block, the improved z-curve is first used in conjunction with the chaotic sequence X1 to scramble the sub-block. Then, the Knuth-Durstenfeld Shuffle algorithm is used to further scramble the sub-block. Finally, the scrambled sub-blocks are stored in the cell array in row order.

7. The multi-image encryption method based on improved z-curve and chaotic signal according to claim 6, characterized in that: Using the following equation, each element in the chaotic sequence X1 can be converted into a number between 1 and 64. Take t=8, use the different values ​​in the transformed chaotic sequence X1 as the starting points of different sub-blocks, and scramble the 8*8 sub-blocks according to the traversal pattern.

8. The multi-image encryption method based on improved z-curve and chaotic signal according to claim 5, characterized in that, The method for obtaining the sequence DNA jiema in step four includes the following steps: Step I: First, convert each element in the cell array into an eight-bit binary string to form the sequence hechengtu. Then, use the following equation to convert each element in the chaotic sequence X2 into a number between 0 and 7. Then, according to the DNA encoding rules, use the converted chaotic sequence X2 to encode the sequence hechengtu into DNA to obtain the first sequence DNA encoding. Step II: Repeat Step I. According to the DNA coding rules, use the chaotic sequence X3 to encode the chaotic sequence Z to obtain the second sequence DNA code. Then, according to the DNA operation rules, use the chaotic sequence Y1 to perform DNA operations on the first and second sequence DNA codes to obtain the DNA sequence yunsuan. Among them, using equations Each element in the chaotic sequence X3 is processed into a number between 0 and 7; Step III: Following the inverse operation of DNA encoding rules, use the chaotic sequence Y2 to decode the DNA sequence yunsuan to obtain the DNA sequence jiema.

9. The multi-image encryption method based on improved z-curve and chaotic signal according to claim 8, characterized in that: In step II, each element in the chaotic sequence Y1 is first processed into a number between 0 and 4 using the following equation; Then, iterate through the bases at the same positions in the first and second DNA sequences. According to the DNA operation rules, when Y1 is 0, perform the addition operation between the first and second DNA sequences; when Y1 is 1, perform the subtraction operation between the first and second DNA sequences; when Y1 is 2, perform the XOR operation between the first and second DNA sequences; when Y1 is 3, perform the XOR operation between the first and second DNA sequences; and when Y1 is 4, perform the inversion operation of the first DNA sequence.