Image encryption and decryption method based on light chaos and DNA magic cube scrambling
By combining optical chaos and DNA cube scrambling methods, images are encrypted in a multi-layered and multi-angle manner, solving the problem that image encryption is easily cracked in existing technologies and achieving a highly secure and complex image encryption effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2026-03-27
AI Technical Summary
In existing technologies, image encryption schemes are simple and easily cracked, making it difficult to meet high security requirements.
Combining optical chaos and DNA cube scrambling methods, images are encrypted in a multi-layered and multi-angle manner, including optical chaotic recombination, cube scrambling, and DNA encoding, and double encryption is performed using optical chaotic sequences and DNA operations.
It improves the complexity and security of image encryption, increases the key space, enhances robustness against brute-force and differential attacks, and ensures the randomness and unpredictability of images.
Smart Images

Figure CN116436589B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of information security, and particularly relates to an image encryption and decryption method based on optical chaos and DNA magic cube scrambling. BACKGROUND
[0002] With the increasing demand for image information transmission, people have higher requirements for the security of image information transmission. Compared with text information, image has the characteristics of large data volume and strong correlation between adjacent pixels, and has always been the focus of the information security field. Chaotic signals have been widely concerned in the field of image encryption due to their non-periodic, noise-like and non-predictable characteristics. Compared with traditional electrical chaotic signals, optical chaos has the advantages of high complexity, high bandwidth and low attenuation, so optical chaos has higher encryption capability. DNA encoding can encrypt data by taking advantage of the low power and high parallelism of DNA, so as to ensure the security of information sequences. However, there is a risk that a single encryption scheme can be easily cracked, so it is necessary to improve it. SUMMARY
[0003] In view of the above situation, the application combines optical chaos and DNA encoding, and uses the magic cube scrambling method to scramble the DNA encoding, so that the image encryption is more secure, and an image encryption and decryption method based on optical chaos and DNA magic cube scrambling is designed.
[0004] To achieve the above purpose, the application provides the following technical scheme:
[0005] An image encryption method based on chaos and DNA magic cube scrambling, comprising the following steps:
[0006] S1: input a key;
[0007] S2: recombine and encrypt the optical chaos generated by optical injection by using the key;
[0008] S3: scramble the image at the pixel level;
[0009] S4: perform secondary scrambling on the bit plane by using DNA encoding, block magic cube scrambling and DNA operation, and convert the image into a pixel value image after scrambling by DNA decoding.
[0010] S5: diffuse the image by using the optical chaos sequence to obtain a ciphertext image.
[0011] Further, in the above image encryption method based on optical chaos and DNA magic cube scrambling, it is assumed that the size of the plaintext image is [M, N], in step S1, a 64-bit decimal number is input as a key k user , and the sum srows The sum of the ordinates s cols The two keys required for encryption: key_A, key_B are obtained after SHA-512 is calculated again after the combination of the decimal SHA-512 values with a length of 64;
[0012] The calculation formula is shown as follows:
[0013]
[0014] The obtained key_A and key_B sequences with a length of 512 bits are converted into decimals, wherein the length of key_A is related to the size of the plaintext image, and the value range is [1, 16]; the length of key_B is 64, and the value range is [1, 256]. Key_A and Key_B are transmitted to the receiving end through a secure channel for user decryption.
[0015] Further, in the above image encryption method based on optical chaos and DNA Rubik's cube scrambling, in step S2, key_B is converted into a binary sequence with a length of 512. Similarly, after the optical chaos is quantized, the two optical chaos sequences CH_1 and CH_2 with a length of M*N are evenly divided into 512 segments, and if it cannot be evenly divided, the last segment is not required to have the same length as the previous evenly divided length. When key_B(i) = 0, CH_en1(i) = CH_1(i), CH_en2(i) = CH_2(i); when key_B(i) = 1, CH_en1(i) = CH_2(i), CH_en2(i) = CH_1(i). After encryption by key_B, the optical chaos sequences CH_en1 and CH_en2 with double encryption of the physical layer and the application layer are obtained, and the length is M*N, and the value range is [1, 256].
[0016] Further, in the above image encryption method based on optical chaos and DNA Rubik's cube scrambling, in step S3, the plaintext image is rearranged into a three-dimensional image, assuming (M*N) 1 / 3 = H, if the cube root of M*N cannot be evenly divided, zero is added in the row and column of the image until it can be evenly divided. The first H / 4*3 keys in key_A are the keys required for encryption in s3, and after being converted into binary, three control parameters: choice_x, choice_y, choice_z are obtained for the x, y, z axes of the three-dimensional image, and the length of each control parameter is H, which consists of 0 and 1.
[0017] Further, in the image encryption method based on optical chaos and DNA Rubik's cube scrambling described above, in step S3, for the three-dimensional arrangement of the plaintext image, analogously to the Rubik's cube of H*H*H, when choice_x(i) = 0, the [H, H] size matrix corresponding to the i-th column of the image in the x-axis is rotated 90 degrees counterclockwise; when choice_x(i) = 1, the [H, H] size matrix corresponding to the i-th column of the image in the x-axis is rotated 90 degrees clockwise. Similarly, choice_y and choice_z also perform the same steps on the y-axis and z-axis of the image. The encrypted image after step S3 is denoted as P1.
[0018] Further, in the image encryption method based on optical chaos and DNA Rubik's cube scrambling described above, in step S4, the key key_mode is composed of the first and second bits of the value multiplied by CH_en1 after the four keys key_A(H / 4*3+1:H / 4*3+4) are XORed with each other, with a size of [M, N] and a value range of [1, 4]; the key key_en is composed of the third and fourth bits of the value multiplied by CH_en1 after the four keys key_A(H / 4*3+5:H / 4*3+8) are XORed with each other, with a size of [M, N] and a value range of [1, 4]; similarly, the key key_sel is composed of the fifth, sixth, and seventh bits of the value combined after key_A(H / 4*3+9:H / 4*3+12) and CH_en1, with a size of [M, N] and a value range of [1, 8]; the key key_magic is composed of the eighth bit of the value combined after key_A(H / 4*3+13:H / 4*3+16) and CH_en1, taking the first M / 4*N / 4*12 bits of CH_en1, with a size of [M / 4, N / 4, 12] and composed of binary.
[0019] At the same time, in the image encryption method based on optical chaos and DNA Rubik's cube scrambling described above, in step S4, the image P1 is reshaped into an image with a size of [M, N]. The pixel value in P1 is composed of 8 bits, and a DNA sequence with a length of 4 is used to represent each pixel value in P1, and the DNA representation method is determined by key_sel, when key_sel(i, j) = 1, then the encoding method 1 is selected to encode the bits, and so on. The selection method of DNA is shown in Table 1:
[0020] Table 1: DNA encoding rules
[0021]
[0022] Further, in the image encryption method based on optical chaos and DNA Rubik's cube scrambling described above, in step S4, the image is divided into sub-blocks of size 4*4, and the sub-block coordinate range is [M / 4, N / 4], and the DNA distribution in the sub-block is of size 4*4*4. The bits are encrypted by the magic cube algorithm using key_magic. When key_magic(i,j,h) = 0, the [4, 4] size matrix corresponding to the hth column of the x-axis of the sub-block with coordinates (i,j) is rotated 90 degrees counterclockwise; when key_magic(i,j,h) = 1, the [4, 4] size matrix corresponding to the hth column of the x-axis of the sub-block with coordinates (i,j) is rotated 90 degrees clockwise. Similarly, the same transformation is performed on the y-axis and z-axis. It should be noted that h∈[1,4] represents the column number on the x-axis; h∈[5,8] represents the column number on the y-axis, and the h-4th column on the y-axis is transformed; h∈[9,12] represents the column number on the z-axis, and the h-8th column on the z-axis is transformed.
[0023] Further, in the image encryption method based on optical chaos and DNA Rubik's cube scrambling described above, in step S4, the image is divided into sub-blocks of size 4*4, and the sub-block coordinate range is [M / 4, N / 4], and the DNA distribution in the sub-block is of size 4*4*4. The bits are encrypted by the magic cube algorithm using key_magic. When key_magic(i,j,h) = 0, the [4, 4] size matrix corresponding to the hth column of the x-axis of the sub-block with coordinates (i,j) is rotated 90 degrees counterclockwise; when key_magic(i,j,h) = 1, the [4, 4] size matrix corresponding to the hth column of the x-axis of the sub-block with coordinates (i,j) is rotated 90 degrees clockwise. Similarly, the same transformation is performed on the y-axis and z-axis. It should be noted that h∈[1,4] represents the column number on the x-axis; h∈[5,8] represents the column number on the y-axis, and the h-4th column on the y-axis is transformed; h∈[9,12] represents the column number on the z-axis, and the h-8th column on the z-axis is transformed.
[0024] Table 2: DNA addition
[0025]
[0026] Table 3: DNA subtraction
[0027]
[0028] Table 4: DNA XOR
[0029]
[0030] Table 5: DNA XOR
[0031]
[0032] Further, in the image encryption method based on optical chaos and DNA Rubik's cube scrambling, in step S5, the optical chaos sequence CH_en2 generated in step S2 is used to diffuse the encrypted image P2.
[0033]
[0034] Wherein, i represents the i-th element in the array after the image data is changed into a one-dimensional array, C represents the diffused data, and P2 represents the image data before diffusion. After diffusion, C is reshaped into a two-dimensional image with a size of [M, N].
[0035] Further, in the image encryption method based on optical chaos and DNA Rubik's cube scrambling, the optical chaos sequences CH_1, CH_2 and the chaos synchronization sequences CH_3, CH_4 used in the technical scheme of the application are realized by synchronization optical chaos generated by optical injection, wherein CH_1 is synchronized with the optical chaos synchronization sequence CH_3, and CH_2 is synchronized with the optical chaos synchronization sequence CH_4.
[0036] The application further discloses an image decryption method based on optical chaos and DNA Rubik's cube scrambling. The receiving end generates various control parameters required for decryption through a key and synchronized optical chaos sequences. Since the proposed image encryption algorithm is symmetrical, the image can be restored through inverse diffusion and decryption steps opposite to the encryption steps. The specific steps are as follows: (1) receiving key_A and key_B transmitted through a secure channel at the receiving end; (2) recombining CH_en3 synchronized with CH_en1 and CH_en4 synchronized with CH_en2 through key_B and the optical chaos sequences CH_3 and CH_4 synchronized at the receiving end; (3) performing inverse diffusion on the ciphertext image using CH_en4; (4) performing DNA encoding on the ciphertext image through the DNA expression mode selected in step S4; (5) performing DNA inverse operation and block Rubik's cube inverse scrambling on the image using CH_en3 and the key key_A; (6) performing DNA decoding on the DNA image to convert it into a pixel value image using CH_en3 and key_A; and (7) performing inverse Rubik's cube scrambling on the image at the pixel level to restore the image using CH_en3 and key_A.
[0037] Compared with the prior art, the application has the beneficial effects that:
[0038] 1. The chaos employed in this invention is an optically injected chaotic sequence, which has higher dynamic complexity than electrical chaos. Furthermore, during the encryption process, in addition to encrypting the image at the application layer, the generated optically chaotic sequence is also recombined by converting it into a binary sequence. While the optically chaotic sequence is encrypted using physical parameters at the physical layer, it is also encrypted at the application layer, thus expanding the key space of the optically chaotic sequence and increasing the difficulty of decryption.
[0039] 2. This invention designs an encryption method based on DNA and Rubik's Cube scrambling. By scrambling the image at both the pixel and bit levels using a Rubik's Cube rotation method, the scrambled image becomes more random. DNA encoding is also introduced during bit-level scrambling, ensuring three-dimensional equality of the scrambled elements during encryption within sub-blocks and increasing encryption complexity. Performance tests of this encryption method demonstrate that, compared to the plaintext image, the encrypted image exhibits a more uniform grayscale distribution; near-zero correlation between adjacent pixels; high plaintext and key sensitivity; a large key space; and strong robustness against brute-force attacks and differential attacks. Attached Figure Description
[0040] Figure 1 This is a flowchart illustrating a preferred embodiment of the image encryption / decryption method of the present invention.
[0041] Figure 2 This is a system block diagram corresponding to a preferred embodiment of the image encryption / decryption method of the present invention.
[0042] Figure 3 This is a schematic diagram illustrating the image encryption effect of a preferred embodiment of the present invention.
[0043] Figure 4 This is a schematic diagram of the grayscale histogram of the image to be encrypted and the encrypted image according to a preferred embodiment of the present invention.
[0044] Figure 5 This is a schematic diagram showing the correlation distribution between the image to be encrypted and the encrypted image in a preferred embodiment of the present invention.
[0045] Appendix: Figure 3 In (a), (b), (c), and (d), the left side is the image to be encrypted, and the right side is the encrypted image; Figure 4 In (a), (b), (c), and (d), the left side is the grayscale histogram of the image to be encrypted, and the right side is the grayscale histogram of the encrypted image; Figure 5 In (a), (b), and (c), the left side represents the horizontal correlation, vertical correlation, and diagonal correlation of the image Lena to be encrypted, respectively, while the right side represents the horizontal correlation, vertical correlation, and diagonal correlation of the encrypted image. Detailed Implementation
[0046] In order to better illustrate the technical solutions of the present application, the encryption and decryption process will be described clearly and completely below in combination with a preferred embodiment and the accompanying drawings.
[0047] Referring to Figures 1-5 The present embodiment provides an image encryption method and decryption method based on optical chaos and DNA Rubik's cube scrambling, specifically comprising the following steps:
[0048] S1: the user inputs a key;
[0049] S2: the optical chaos generated by light injection is recombined and encrypted using the key;
[0050] S3: the image is scrambled at the pixel level;
[0051] S4: the bit plane is scrambled twice using DNA encoding, block Rubik's cube scrambling and DNA operation at the bit plane, and after scrambling, the image is converted back to a pixel value image through DNA decoding;
[0052] S5: the image is diffused using the optical chaos sequence to obtain a ciphertext image;
[0053] S6: the receiving end recovers the image pixels using the key and the synchronized optical chaos sequence to obtain the original image.
[0054] The steps will be described in detail below.
[0055] Assuming that the image size is a 512*512 plaintext image, in step S1, the user inputs a 64-bit decimal number as the key k user , which is combined with the length of 64 decimal SHA-512 values of the sum s rows and the sum s cols of the horizontal and vertical coordinates of the plaintext image, respectively, and then SHA-512 is calculated again to obtain two key groups required for encryption: key_A and key_B;
[0056] The calculation formula is as follows:
[0057]
[0058] The obtained key_A and key_B are converted to decimal sequences with a length of 512 bits, wherein the length of key_A is related to the size of the plaintext image, and the value range is [1, 16]; the length of key_B is 64, and the value range is [1, 256]. Key_A and Key_B are transmitted to the receiving end through a secure channel for user decryption.
[0059] In step S2, key_B is converted into a binary sequence with length of 512. Similarly, after the light chaos is quantized, two light chaos sequences CH_1 and CH_2 with length of 512*512 are divided into 512 segments, when key_B(i) = 0, CH_en1(i) = CH_1(i), CH_en2(i) = CH_2(i); when key_B(i) = 1,
[0060] CH_en1(i) = CH_2(i), CH_en2(i) = CH_1(i). After the encryption of key_B, the light chaos sequences CH_en1 and CH_en2 with length of 512*512 and value range of [1, 256] are obtained, which are double-encrypted by physical layer and application layer.
[0061] In step S3, the plaintext image is rearranged into a three-dimensional image, (512*512) 1 / 3 = 64, the first 48 keys in key_A are the keys required for encryption in step S3, which are converted into binary, and three control parameters: choice_x, choice_y, choice_z are obtained corresponding to the x, y, z axes of the three-dimensional image, each control parameter has a length of 64 and is composed of 0 and 1.
[0062] At the same time, for the three-dimensionally arranged plaintext image, it is analogous to a 64*64*64 Rubik's Cube, when choice_x(i) = 0, the [H, H] matrix corresponding to the ith column of the x axis of the image is rotated 90 degrees counterclockwise; when choice_x(i) = 1, the [64, 64] matrix corresponding to the ith column of the x axis of the image is rotated 90 degrees clockwise. Similarly, choice_y and choice_z also perform the same steps on the y axis and z axis of the image. The encrypted image after step S3 is denoted as P1.
[0063] In step S4, the key key_mode is composed of the first and second bits of the value of the four keys key_A(49:52) after being XORed with each other multiplied by CH_en1, with a size of [512,512] and a value range of [1,4]; the key key_en is composed of the third and fourth bits of the value of the four keys key_A(53:56) after being XORed with each other multiplied by CH_en1, with a size of [512,512] and a value range of [1,4]; similarly, the key key_sel is composed of the fifth, sixth and seventh bits of the value of the combination of key_A(57:60) and CH_en1, with a size of [512,512] and a value range of [1,8]; the key key_magic is composed of the eighth bit of the value of the combination of key_A(61:64) and CH_en1, with the first 128*128*12 bits of CH_en1, with a size of [128,128,12] and composed of binary.
[0064] In step S4, the image P1 is reshaped into an image with a size of [512,512]. The pixel value in P1 is composed of 8 bits, and a DNA sequence with a length of 4 is used to represent each pixel value in P1, and the DNA representation is determined by key_sel.
[0065] Meanwhile, in step S4, the image with a size of M*N is divided into sub-blocks with a size of 4*4, and the sub-block coordinate range is [128,128], and the DNA distribution in the sub-block is 4*4*4 in size. The bits are encrypted by magic cube scrambling using key_magic. When key_magic(i,j,h) = 0, the [4,4] size matrix corresponding to the hth column of the x-axis of the sub-block with coordinates (i,j) is rotated 90 degrees counterclockwise; when key_magic(i,j,h) = 1, the [4,4] size matrix corresponding to the hth column of the x-axis of the sub-block with coordinates (i,j) is rotated 90 degrees clockwise. Similarly, the same transformation is performed on the y-axis and z-axis. It should be noted that h∈[1,4] represents the column number on the x-axis; h∈[5,8] represents the column number on the y-axis, and the h-4th column on the y-axis is transformed; h∈[9,12] represents the column number on the z-axis, and the h-8th column on the z-axis is transformed.
[0066] Further, the image information converted into DNA sequence is encrypted by DNA calculation using key_mode and key_en. The quaternary number in key_mode represents the calculation method of selecting two DNA sequences, and when key_mode(i,j) = 0, the calculation method of the two DNA sequences is addition, and when key_mode(i,j) = 1, the calculation method of the two DNA sequences is subtraction, and when key_mode(i,j) = 2, the calculation method of the two DNA sequences is multiplication, and when key_mode(i,j) = 3, the calculation method of the two DNA sequences is division.
[0067] j) = 1, 2, 3, 4, respectively, represent the DNA sequence on the (i, j) pixel points to add, subtract, XOR and XOR operation, the object is the key_en in the quaternary representation of DNA sequence value. After encryption, the DNA information of the image is converted into a pixel value image P2 by selecting one of the expression ways of DNA.
[0068] In step S5, the encrypted image is diffused by the light chaos sequence CH_en2 generated in step S2. The diffusion method is as follows:
[0069]
[0070] Where i represents the i-th element in the array after the image data is changed into a one-dimensional array, C represents the diffused data, and P2 represents the image data before diffusion. After diffusion, C is reshaped into a two-dimensional image with a size of [512, 512].
[0071] In step S6, the receiving end generates various control parameters required for decryption by the key and the synchronized light chaos sequence. Since the proposed image encryption algorithm is symmetric, the image can be restored by inverse diffusion and decryption steps opposite to the encryption steps. The decryption steps are as follows: (1) receiving key_A and key_B transmitted through the secure channel at the receiving end; (2) recombining CH_en3 synchronized with CH_en1 and CH_en4 synchronized with CH_en2 by key_B and the light chaos sequences CH_3 and CH_4 synchronized at the receiving end; (3) performing inverse diffusion on the ciphertext image by CH_en4; (4) performing DNA encoding on the ciphertext image by the DNA expression method selected in step S4; (5) performing DNA inverse operation and block magic cube inverse permutation on the image by CH_en3 and the key key_A; (6) performing DNA decoding on the DNA image to convert it into a pixel value image by CH_en3 and key_A; (7) performing inverse magic cube permutation on the image at the pixel level to restore the image by CH_en3 and key_A.
[0072] Referring to Figures 3-5 For a specific embodiment, the encryption effect of the image is analyzed from the aspects of gray scale histogram, correlation between adjacent pixels, pixel change rate, and normalized average change intensity, etc.
[0073] 1. Gray scale histogram analysis: The statistical characteristics of the encrypted image are mainly represented by the gray scale histogram. The distribution of the pixel gray scale values of the image is analyzed to reflect the relationship between the pixel value and the number of pixels. When the distribution of the image gray scale histogram is more uniform, it is more difficult for the attacker to obtain information from the encrypted image. As can be seen from the figure, the distribution of the gray scale histogram of the plaintext image has very obvious characteristics, while after encryption, the distribution of the gray scale histogram of the ciphertext image is very uniform, and it is difficult to analyze the effective statistical characteristics.
[0074] 2. Adjacent pixel correlation analysis: The image information has the characteristic that the correlation between adjacent pixels is strong, which means that the value of a part of the pixels can be derived from the value of another part of the pixels, which greatly tests the security of the image information. In the encryption process, it is hoped that the redundancy of the correlation between adjacent pixels can be eliminated as much as possible to improve the security of the encryption. The calculation formula of the correlation is as follows:
[0075]
[0076] wherein, N c represents the number of randomly selected pixels, and in the embodiment, N c = 8000. E(x) is the mean value, and D(x) is the variance. In the embodiment, the plaintext image and the ciphertext image of the Lena image are selected to calculate the pixel value correlation in the horizontal, vertical and diagonal directions according to the correlation calculation formula, and the adjacent pixel correlation distribution graph of the Lena image is obtained.
[0077] 3. Plaintext sensitivity analysis: In order to reflect whether the ciphertext image will change greatly after the plaintext image changes slightly to resist differential attack, the pixel change rate (NPCR) and the normalized average change intensity (UACI) can be used to analyze the change between the ciphertext images of the two plaintext images after the plaintext image changes slightly. The definitions of NPCR and UACI are as follows:
[0078]
[0079] wherein, M, N represent the width and height of the image respectively, and D(i,j) represents the pixel value of the image at the coordinate point. C1(i,j) and C2(i,j) represent the ciphertext images before and after the plaintext changes. The ideal values of NPCR and UACI are 99.6094% and 33.4635% respectively. The closer the calculated value is to the ideal value, the better the plaintext sensitivity of the algorithm. Table 6 is the NPCR and UACI values between the ciphertext images after randomly adding 1 to a pixel value of a pixel point in the plaintext image of four different images. It can be seen that the calculated value is very close to the ideal value.
[0080] Table 6: plaintext sensitivity
[0081]
[0082] 4. Key sensitivity analysis: analysis whether the ciphertext image changes greatly when the key changes slightly to resist the chosen plaintext attack. Similarly, NPCR and UACI can be used for analysis, and the closer the calculated value is to the ideal value, the better the key sensitivity of the algorithm. Table 7 shows the NPCR and UACI values of the ciphertext images before and after the first digit of the key of four different images is increased by 1. It can be seen that the calculated value is very close to the ideal value.
[0083] Table 7: Key sensitivity
[0084]
[0085] Obviously, the above-described embodiments are only preferred examples of the present application, and for those skilled in the art, other embodiments can be obtained from these preferred embodiments without creative labor.
Claims
1. An image encryption method based on optical chaos and DNA Rubik's cube scrambling, characterized in that, The method comprises the following steps: S1: inputting a key; S2: re-encrypting light chaos generated by light injection using the key; S3: performing magic cube scrambling on the image at the pixel level; S4: performing secondary scrambling on the bit plane using DNA encoding, block magic cube scrambling and DNA operation, and converting the image into a pixel value image after scrambling through DNA decoding; S5: performing diffusion on the image using a light chaos sequence to obtain a ciphertext image; Let the size of the plaintext image be M*N, in step S1, input 64-bit decimal number as the key k user , respectively, with the horizontal coordinate sum s rows and the vertical coordinate sum s cols Length of 64 decimal SHA-512 value combination, calculate SHA-512 again to get two key groups required for encryption: key_A, key_B; The calculation formula is as follows: The obtained key_A and key_B are converted into a 512-bit long sequence in decimal, wherein the length of key_A is related to the size of the plaintext image, and the value range is [1, 16]; the length of key_B is 64, and the value range is [1, 256]; In step S2, key_B is converted into a binary sequence with a length of 512; after light chaos quantization, two light chaos sequences CH_1 and CH_2 with a length of M*N are divided into 512 segments, when key_B(i)=0, CH_en1(i)=CH_1(i), CH_en2(i)=CH_2(i); when key_B(i)=1, CH_en1(i)=CH_2(i), CH_en2(i)=CH_1(i); after encryption by key_B, the light chaos sequences CH_en1 and CH_en2 with physical layer and application layer double encryption are obtained, with a length of M*N, and the value range is [1, 256]; In step S3, the plaintext image is rearranged into a three-dimensional image, set (M*N) 1 / 3 =H, if M*N cannot be divided by the cubic root, zero is added in the row and column of the image until it can be divided; the first H / 4*3 keys in key_A are the keys required for encryption in step S3, after being converted into binary, three control parameters: choice_x, choice_y, choice_z are obtained corresponding to the x, y, z axes of the three-dimensional image, and the length of each control parameter is H, which consists of 0 and 1; In step S3, for the three-dimensional arrangement of the plaintext image, analogizing to the magic cube of H*H*H, when choice_x(i)=0, the [H,H] size matrix corresponding to the i-th column of the x-axis of the image is rotated by 90 degrees counterclockwise; when choice_x(i)=1, the [H,H] size matrix corresponding to the i-th column of the x-axis of the image is rotated by 90 degrees clockwise; similarly, when choice_y(i)=0, the [H,H] size matrix corresponding to the i-th column of the y-axis of the image is rotated by 90 degrees counterclockwise; when choice_y(i)=1, the [H,H] size matrix corresponding to the i-th column of the y-axis of the image is rotated by 90 degrees clockwise; when choice_z(i)=0, the [H,H] size matrix corresponding to the i-th column of the z-axis of the image is rotated by 90 degrees counterclockwise; when choice_z(i)=1, the [H,H] size matrix corresponding to the i-th column of the z-axis of the image is rotated by 90 degrees clockwise; the encrypted image after step S3 is denoted as P1; In step S4, the key key_mode is composed of the first and second bits of the value of the four keys key_A(H / 4*3+1:H / 4*3+4) after being multiplied by CH_en1, with a size of [M, N] and a value range of [1, 4]; the key key_en is composed of the third and fourth bits of the value of the four keys key_A(H / 4*3+5:H / 4*3+8) after being multiplied by CH_en1, with a size of [M, N] and a value range of [1, 4]; similarly, the key key_sel is composed of the fifth, sixth and seventh bits of the value of key_A(H / 4*3+9:H / 4*3+12) combined with CH_en1, with a size of [M, N] and a value range of [1, 8]; the key key_magic is composed of the eighth bit of the value of key_A(H / 4*3+13:H / 4*3+16) combined with CH_en1, with a size of [M / 4, N / 4, 12] and composed of binary; In step S4, the image P1 is reshaped into an image with a size of [M, N], and the pixel value in P1 is composed of 8 bits, and a DNA sequence with a length of 4 is used to represent each pixel value in P1, and the DNA representation method is determined by key_sel; In step S4, the image with a size of M*N is divided into sub-blocks with a size of 4*4, and the coordinate range of the sub-blocks is [M / 4, N / 4], and the DNA distribution in the sub-blocks is 4*4*4 in size; the bits are encrypted by magic cube scrambling using key_magic, in the case of h∈[1, 4], when key_magic(i, j, h)=0, the [4, 4] size matrix corresponding to the hth column of the x-axis of the sub-block with coordinates (i, j) is rotated 90 degrees counterclockwise; when key_magic(i, j, h)=1, the [4, 4] size matrix corresponding to the hth column of the x-axis of the sub-block with coordinates (i, j) is rotated 90 degrees clockwise; in the case of h∈[5, 8], when key_magic(i, j, h)=0, the [4, 4] size matrix corresponding to the h-4th column of the y-axis of the sub-block with coordinates (i, j) is rotated 90 degrees counterclockwise; when key_magic(i, j, h)=1, the [4, 4] size matrix corresponding to the h-4th column of the y-axis of the sub-block with coordinates (i, j) is rotated 90 degrees clockwise; in the case of h∈[9, 12], when key_magic(i, j, h)=0, the [4, 4] size matrix corresponding to the h-8th column of the z-axis of the sub-block with coordinates (i, j) is rotated 90 degrees counterclockwise; when key_magic(i, j, h)=1, the [4, 4] size matrix corresponding to the h-8th column of the z-axis of the sub-block with coordinates (i, j) is rotated 90 degrees clockwise; In step S4, the image information converted into DNA sequence is encrypted by DNA computing with key_mode and key_en; the quaternary number in key_mode represents the computing mode of two DNA sequences, when key_mode(i, j)=1, 2, 3, 4, it respectively represents the addition, subtraction, XOR and XNOR operation of the DNA sequence on (i, j) pixel point, and the computing object is the DNA sequence value represented by quaternary in key_en; after encryption, the DNA information of the image is converted into pixel value image P2 by selecting one of the DNA expression modes.
2. The image encryption method based on optical chaos and DNA Rubik's cube scrambling according to claim 1, characterized in that: In step S5, the encrypted image is diffused by using the light chaotic sequence CH_en2 generated in step S2, and the diffusion mode is as follows: Wherein, i represents the i-th element in the array after the image data is changed into a one-dimensional array, C represents the diffused data, and P2 represents the image data before diffusion; after diffusion, C is reshaped into a two-dimensional image with a size of [M, N].