Memristive chaotic image encryption method based on Knight's Tour and Rubik's Cube scrambling
By improving the Knight's Tour and Rubik's Cube scrambling algorithms and combining them with the memristive chaotic system to generate chaotic pseudo-random sequences, the problems of poor global encryption effect and easy cracking of the Knight's Tour image encryption algorithm in the existing technology are solved, achieving higher security and global encryption effect.
Patent Information
- Application Number
- CN202411817574.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-12-10
AI Technical Summary
The existing Knight's Tour image encryption algorithm has poor global encryption effect, the image is easy to be cracked, the adjacent pixels have high correlation, and the security is insufficient.
Combined with the memristive chaotic system to generate chaotic pseudo-random sequences, the Knight's Tour and Rubik's Cube scrambling algorithms are improved, the Knight's Tour and Rubik's Cube scrambling are controlled by chaotic pseudo-random integer sequences, and the XOR operation is used to generate ciphertext images.
It effectively reduces the correlation between adjacent pixels of the scrambled image, improves the global encryption effect of the image, enhances the security of the encrypted image, and resists cracking attacks.
Smart Images

Figure CN119835373B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image encryption, and in particular to a memristive chaos image encryption method based on knight's tour and magic cube scrambling. Background Art
[0002] In recent years, with the widespread adoption of the internet and the rapid development of information technology, images, due to their intuitive nature, have become a popular medium for information dissemination and are gaining popularity. However, the privacy information contained in images is often threatened by malicious attacks, illegal tampering, and theft. Furthermore, traditional text encryption algorithms, due to their inadequate use of the key space, high correlation between adjacent pixels, and a single algorithm, cannot fully meet the security requirements of image encryption. Therefore, it is crucial to design image encryption algorithms with improved scrambling performance and greater security to ensure the security of these images during transmission.
[0003] Knight's Tour scrambling has the advantages of large key space and non-periodicity, and has great advantages in image encryption processing. It has attracted the attention of the academic community in recent years and has achieved some good research results (see references [1-8]). Lan Hong et al. improved the Knight's Tour scrambling and combined it with the Arnold transform to obtain a new image encryption algorithm, which accelerated the encryption and decryption speed while enhancing the encryption performance of the algorithm (see reference 1). Kumar et al. designed a parallel image encryption algorithm based on Knight's Tour scrambling, which protected the content of the image in a short time (see reference [2]). Mahmood et al. used Knight's Tour as a tool to generate pseudo-random sequences, and used the discrete diagonal SCAN method to scramble the image with the generated key (see reference [3]). It has been verified that the algorithm has good robustness and high sensitivity. Bansal et al. proposed an information hiding technology based on Knight's Tour, which achieves the effect of information hiding by randomly selecting closed Knight's Tour paths (see reference [4]). It has been verified that the capacity of this method is very high. Shashikiran et al. generated multiple 5×5 matrices for image encryption through Knight’s Tour, then embedded the encrypted image into another image and achieved image information encryption by “shuffling” (see reference [5]). Jose et al. achieved image encryption by controlling the number of turns and crosses in Knight’s Tour (see reference [6]). Pan Yingli et al. first divided the image into blocks, performed Knight’s Tour scrambling on the blocks, and then performed XOR processing on the image pixels (see reference [7]). This method is short in duration, highly efficient, and has good encryption effect. Younus et al. proposed a video steganographic encryption algorithm based on Knight’s Tour and LSB. By using Knight’s Tour to randomly select pixels within the frame where secret information is embedded, the defect of the traditional LSB method of serially selecting pixels is overcome, and the robustness and security of the algorithm are improved (see reference [8]).
[0004] The Knight's Tour Problem (KTP) originated from chess and is used to find Hamiltonian paths on the chessboard (see reference [9]). With the development of computer science and artificial intelligence, the Knight's Tour algorithm has gradually become a classic search algorithm and has been widely used in various problems. In image encryption, the combination of the Knight's Tour algorithm and image data is usually performed through a method called Knight's Tour Transformation. This transformation matches the original image data with the tour matrix and rearranges the image data according to the path order in the tour matrix. In this way, the information of the original image is scrambled, achieving the encryption effect. The core of the Knight's Tour algorithm is that a knight moves on an M×N chessboard according to the "sun" pattern in chess, and is required to traverse each small square without repetition. In the algorithm implementation, the original image is usually converted into a pixel matrix, which corresponds to the chessboard, and each pixel in the matrix corresponds to each square on the chessboard. The knight traverses each square on the chessboard in a "sun" manner, trying all possible move combinations and recording the squares that have been visited to avoid repeated visits. When the algorithm reaches a position that has already been visited or doesn't meet the Knight's Tour criteria, it backtracks, returning to the previous position and trying other combinations. This process repeats until all squares on the board have been visited. Because the Knight's Tour path is not unique, the tour matrix also has multiple possibilities. This forms the basis for the Knight's Tour algorithm's large key space, thereby ensuring encryption security.
[0005] Typically, a simulated coordinate system is established with the first pixel in the upper left corner of the chessboard as the origin (0,0). The knight begins his patrol from a starting position I = (x,y), with a patrol rule of R = (i,j). This means that the knight starts at I = (x,y) and moves i and j squares horizontally and vertically, respectively. In the knight's patrol algorithm, the knight can only move in a square-shaped pattern, meaning that the next possible patrol position is limited to eight: (x+1,y+2), (x+2,y+1), (x+2,y-1), (x+1,y-2), (x-1,y-2), (x-2,y-1), (x-2,y+1), and (x-1,y+2).
[0006] According to research, the number of closed-loop knight patrol routes on an 8×8 chessboard can reach 1.327×10 13(Refer to reference
[10] ), which has the characteristic of a large key space. However, in existing research results, the Knight’s Tour scrambling algorithm still has the following defects: the pixels of the image are only scrambled between three adjacent columns and three rows, and the correlation between adjacent pixels is high. The Knight’s Tour image encryption can only hide local details of the image, and the image outline and content can still be distinguished. The global encryption effect is poor and the encryption degree is not high. Moreover, since the Knight’s Tour only scrambles the positions of the pixels and does not change the pixel values, the encrypted image is easy to be cracked, which poses a certain threat to the security of the image.
[0007] References are as follows:
[0008] [1] Lan Hong, Fang Yi. Improved Knight's Tour image encryption algorithm based on Arnold transform[J]. Communications Technology, 2018, 51(7): 1663-1670.
[0009] [2]Kumar J,Nirmala S.A novel and efficient method based on knight moves for securing the information contents of images A parallel approach[J].Journal of Information Security andApplications,2016,30:105-117.
[0010] [3]Mahmood SA,Rahim MS M.Novel method for image security systembased on improved SCAN method and pixel rotation technique[J].Journal ofInformation Security andApplications,2018,42:57-70.
[0011] [4]BansalA,Muttoo KS,KumarV.Secure data hiding along randomlyselected closed Knight's tour[J].Journal ofApplied Security Research,2016,11(1):90-100.
[0012] [5]Shashikiran BS, ShailaK,Venugopal K R.Minimal block Knight's tourand edge with LSB pixel replacement based encrypted image steganography[J]. SNComputer Science, 2021, 2(139):1-9.
[0013] [6]Jose JB,Timothy J,Nil M,et al.Taming the knight's tour:minimizingturns and crossings[J].Theoretical Computer Science,2022,90:21-20.
[0014] [7] Pan Yingli, He Bing, Wang Ying. Improved image encryption algorithm based on Knight's Tour[J]. Computer and Digital Engineering, 2016, 44(1): 136-140.
[0015] [8]Younus SZ,Younus T G.Video steganography using Knight touralgorithm and LSB method for encrypted data[J].Journal of IntelligentSystems,2019,29(1):1216-1225.
[0016] [9] Mou Yufei, Zhang Wenpu, Wang Zhizhong, et al. Research on image compression encryption algorithm based on fractal and Knight's Tour [J]. Television Technology, 2014, 38(1): 30-33.
[0017]
[10] Hou Qibin, Yang Xiaofan, Wang Yangsheng, et al. An image scrambling algorithm based on wavelet transform and Knight's Tour [J]. Computer Research and Development, 2004, 41(2): 369-375.
[0018]
[11] Qin Minghong, Lai Qiang, Wu Yonghong. Analysis and implementation of a simple memristor chaotic system with infinite coexisting attractors[J]. Acta Physica Sinica, 2022, 71(16): 1-11.
[0019]
[12] Younes Q,AbdellahA,Mariem J,et al.Adaptation of a genetic operator and a dynamic S-box for chaotic encryption of medical and color images[J].Scientific African,2023,19:1-15.
[0020]
[13] Deng Wenbo, Liu Shuai, Liu Fucai, et al. Image encryption algorithm based on compressed sensing and DNA coding[J]. Computer Engineering and Science, 2022, 44(9): 1574-1582.
[0021]
[14] Yang Shuting, Wu Zhaoxia. Research on color image encryption algorithm based on DNA and Latin square[J]. Cyberspace Security, 2022, 13(2): 37-42.
[0022]
[15] Zhao Yu, Yang Zhen, Yong Jiangping, et al. Research on image encryption algorithm based on chaotic mapping[J]. Journal of East China Jiaotong University, 2022, 39(6): 26-36.
[0023]
[16] Guan Zhixuan, Wu Di, Liu Lingjuan. An image encryption method based on Markov process and one-dimensional logistics mapping[J]. Journal of Zunyi Normal University, 2022, 24(6):90-94.
[0024]
[17] Moussa MI,El-LatifA EI,El-Atta AA H.Diagonalize three-dimensional nonlinear chaotic map to encrypt color image[J].EgyptianInformatics Journal,2023,24:1-11. Summary of the Invention
[0025] The present invention proposes a memristive chaotic image encryption method based on Knight's Tour and Rubik's Cube scrambling, which solves the problems of poor global encryption effect and easy cracking of encrypted images in the Knight's Tour image encryption algorithm in the prior art.
[0026] The technical solution of the present invention is achieved as follows:
[0027] A first aspect of the present invention provides a memristive chaotic image encryption method based on Knight's Tour and Rubik's Cube scrambling, comprising the following steps:
[0028] Read the plaintext image and convert it into an M×N pixel matrix;
[0029] Selecting a key k1 to iterate the memristor chaotic system multiple times to obtain a first set of chaotic pseudo-random sequences, which are then integerized to obtain a first set of chaotic pseudo-random integer sequences;
[0030] A starting point is randomly selected on the chessboard corresponding to the pixel matrix as the starting position of the knight's tour, and the first set of chaotic pseudo-random integer sequences is used to control the position of the knight's next tour until all the pixels in the pixel matrix are traversed;
[0031] Map the image pixels after the Knight's Tour scrambling to the six faces of the Rubik's Cube, and use the first set of chaotic pseudo-random integer sequences to control the scrambling of the Rubik's Cube to obtain the scrambling matrix Z;
[0032] Selecting the key k2 to iterate the memristor chaotic system multiple times to obtain a second set of chaotic pseudo-random sequences, which are then integerized to obtain a second set of chaotic pseudo-random integer sequences;
[0033] The second set of chaotic pseudo-random integer sequences is converted into an M×N chaotic matrix H, and an XOR operation is performed on the chaotic matrix H and the scrambling matrix Z to obtain the ciphertext image.
[0034] Specifically, the following memristor chaotic system is used to generate a chaotic pseudo-random sequence:
[0035]
[0036] Among them, x, y, z, and w are the state variables of the memristor chaotic system, and w(w)=p+qw 2 , a, b, p, q are the system parameters of the memristor chaotic system.
[0037] Specifically, the method for obtaining the first set of chaotic pseudo-random integer sequences is:
[0038] The key k1 = (a, b, p, q, [x(0), y(0), z(0), w(0)]) is selected as the parameters and initial values of the memristive chaotic system; where a = 0.7, b = 0.5, p = 0.3, q = 0.3; [x(0), y(0), z(0), w(0)] = [0.1, 0.1, 0.2, 0.2];
[0039] The key k1 is used to iterate the memristor chaotic system multiple times to obtain the chaotic sequence. The first 600 items of the chaotic sequence are discarded to obtain the first set of chaotic pseudo-random sequence x′. i1 , y′ i1 、z′ i1 , w′ i1 ;
[0040] The first set of chaotic pseudo-random integer sequences x is obtained by integerizing the first set of chaotic pseudo-random integer sequences x i1 、y i1 、z i1 、w i1 ;
[0041]
[0042] Where floor(·) represents the floor function.
[0043] Specifically, the scrambling algorithm of the improved Knight's Tour is:
[0044] The first set of chaotic pseudo-random integer sequence x i1 Substitute the following formula:
[0045] T 1i =x i1 mod 8;
[0046] Among them, mod represents the remainder function, according to T 1i Control the knight's next patrol position;
[0047] T 1i The values of are (0, 1, 2, 3, 4, 5, 6, 7), corresponding to the 8 chessboard points around the knight's current position;
[0048] If T 1i If the position pointed to has been passed, it will advance to the next position in clockwise or counterclockwise direction;
[0049] When the knight patrols to the edge of the board, if T 1i If the position pointed to is outside the chessboard, it will advance to the next position clockwise or counterclockwise;
[0050] If all eight chessboard grid points around the knight's current position have been traversed, the knight returns to the previous position and uses the previous position as the new starting position to perform the knight's tour steps until all grid points on the chessboard have been traversed.
[0051] Specifically, the method for improving the Rubik's Cube scrambling is:
[0052] The image after the Knight's Tour scrambling is divided into 6 sub-images of the same size and without overlap, and the 6 sub-images are mapped to the sides of On the Rubik's Cube, is the ceiling function;
[0053] The first set of chaotic pseudo-random integer sequence y i1 Substitute the following formula:
[0054] T2i =y i1 mod 3;
[0055] Among them, mod represents the remainder function, according to T 2i The value of controls the rotation axis of the Rubik's Cube;
[0056] If T 2i The value of is 0, then the y-axis is the rotation axis; if T 2i The value of is 1, then the x-axis is the rotation axis; if T 2i If the value is 2, the z axis is the rotation axis;
[0057] The first set of chaotic pseudo-random integer sequence Z i1 Substitute the following formula:
[0058]
[0059] Determine the number of layers of the Rubik's Cube rotation to be T 3i layer;
[0060] The first set of chaotic pseudo-random integer sequence w i1 Substitute the following formula:
[0061]
[0062] Determine the step size of the Rubik's Cube rotation as T 4i ;
[0063] The rotation direction is clockwise, and the Rubik's Cube is executed After the rotation, the Rubik's Cube scrambling is completed and the scrambled matrix Z is obtained.
[0064] Specifically, the method for obtaining the first set of chaotic pseudo-random integer sequences is:
[0065] The key k2 = (a, b, p, q, [x(0), y(0), z(0), w(0)]) is selected as the parameters and initial values of the memristive chaotic system; where a = 0.7, b = 0.5, p = 0.3, q = 0.3; [x(0), y(0), z(0), w(0)] = [0.1, 0.1, 0.21, 0.2];
[0066] The key k2 is used to iterate the memristor chaotic system multiple times to obtain a chaotic sequence. The first 600 items of the chaotic sequence are discarded to obtain the second set of chaotic pseudo-random sequence x′. i2 , y′ i2 ,z′x2,w′ i2 ;
[0067] The second set of chaotic pseudo-random integer sequences x is obtained by integerizing the second set of chaotic pseudo-random integer sequences x i2 、y i2、Z i2 、w i2 ;
[0068]
[0069] Where floor(·) represents the floor function.
[0070] Specifically, the second set of chaotic pseudo-random integer sequences is substituted into the following formula to obtain:
[0071]
[0072] in, Represents exclusive OR operation;
[0073] will a i 、b i The cross arrangement is transformed into an M×N chaotic matrix H, and the chaotic matrix H is XORed with the scrambling matrix Z to obtain the ciphertext matrix, which is finally output as a ciphertext image.
[0074] The second aspect of the present invention provides a memristive chaotic image decryption method based on Knight's Tour and Rubik's Cube scrambling. During the decryption process, the ciphertext image is decrypted using the same chaotic pseudo-random integer sequence as in the encryption step to obtain the plaintext image. The decryption process of the ciphertext image is the inverse process of the plaintext image encryption process.
[0075] A third aspect of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor implements the steps of the image encryption method when executing the computer program.
[0076] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image encryption method are implemented.
[0077] Compared with the prior art, the present invention has the following beneficial effects:
[0078] The present invention first uses a chaotic pseudo-random integer sequence to improve the Knight's Tour scrambling algorithm and the Rubik's Cube scrambling algorithm, and then combines the improved Knight's Tour scrambling algorithm and the improved Rubik's Cube scrambling algorithm to scramble the image, which can effectively reduce the correlation between adjacent pixels of the scrambled image and improve the global encryption effect of the image; the present invention also uses a chaotic pseudo-random integer sequence to diffuse the scrambled image, change the pixel value of the image, and improve the security of the encrypted image. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0080] Figure 1 Schematic diagram of the process of plaintext image encryption in an embodiment of the present invention;
[0081] Figure 2 Schematic diagram of the process of decrypting a ciphertext image in an embodiment of the present invention;
[0082] Figure 3 A schematic diagram of the Knight's Tour scrambling process according to an embodiment of the present invention;
[0083] Figure 4 A comparison diagram of a plaintext image, a ciphertext image, and a decrypted image in an embodiment of the present invention; Figure 4 In the figure, (a) is the plaintext image, (b) is the ciphertext image, and (c) is the decrypted image;
[0084] Figure 5 is a histogram of a plaintext image and a ciphertext image in an embodiment of the present invention; Figure 5 In the figure, (a) is the histogram of the plaintext image, and (b) is the histogram of the ciphertext image;
[0085] Figure 6 This is a comparison diagram of the correlation between adjacent pixels of a plaintext image and a ciphertext image in an embodiment of the present invention; Figure 6 In the figure, (a) is a schematic diagram of the correlation of adjacent pixels in the horizontal direction of the plaintext image; (b) is a schematic diagram of the correlation of adjacent pixels in the horizontal direction of the ciphertext image; (c) is a schematic diagram of the correlation of adjacent pixels in the vertical direction of the plaintext image; (d) is a schematic diagram of the correlation of adjacent pixels in the vertical direction of the ciphertext image; (e) is a schematic diagram of the correlation of adjacent pixels in the diagonal direction of the plaintext image; (f) is a schematic diagram of the correlation of adjacent pixels in the diagonal direction of the ciphertext image. DETAILED DESCRIPTION
[0086] The following will clearly and completely describe the technical solutions of the present invention in conjunction with the embodiments of the present invention. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0087] Reference Figure 1 In a first aspect, an embodiment of the present invention provides a memristive chaotic image encryption method based on Knight's Tour and Rubik's Cube scrambling, comprising the following steps:
[0088] Read the plaintext image and convert it into an M×N pixel matrix;
[0089] Selecting a key k1 to iterate the memristor chaotic system multiple times to obtain a first set of chaotic pseudo-random sequences, which are then integerized to obtain a first set of chaotic pseudo-random integer sequences;
[0090] A starting point is randomly selected on the chessboard corresponding to the pixel matrix as the starting position of the knight's tour, and the first set of chaotic pseudo-random integer sequences is used to control the position of the knight's next tour until all the pixels in the pixel matrix are traversed;
[0091] Map the image pixels after the Knight's Tour scrambling to the six faces of the Rubik's Cube, and use the first set of chaotic pseudo-random integer sequences to control the scrambling of the Rubik's Cube to obtain the scrambling matrix Z;
[0092] Selecting the key k2 to iterate the memristor chaotic system multiple times to obtain a second set of chaotic pseudo-random sequences, which are then integerized to obtain a second set of chaotic pseudo-random integer sequences;
[0093] The second set of chaotic pseudo-random integer sequences is converted into an M×N chaotic matrix H, and an XOR operation is performed on the chaotic matrix H and the scrambling matrix Z to obtain the ciphertext image.
[0094] Specifically, the following memristor chaotic system (see reference
[11] ) is used to generate a chaotic pseudo-random sequence:
[0095]
[0096] Among them, x, y, z, and w are the state variables of the memristor chaotic system, and w(w)=p+qw 2 , a, b, p, q are the system parameters of the memristor chaotic system.
[0097] Specifically, the method for obtaining the first set of chaotic pseudo-random integer sequences is:
[0098] The key k1 = (a, b, p, q, [x(0), y(0), z(0), w(0)]) is selected as the parameters and initial values of the memristive chaotic system; where a = 0.7, b = 0.5, p = 0.3, q = 0.3; [x(0), y(0), z(0), w(0)] = [0.1, 0.1, 0.2, 0.2];
[0099] The key k1 is used to iterate the memristor chaotic system multiple times (using the Runge-Kutta method with an iteration step of 0.1) to obtain a chaotic sequence. The first 600 items of the chaotic sequence are discarded to obtain the first set of chaotic pseudo-random sequence x′. i1 , y′ i1、z′ i1 , w′ i1 ;
[0100] The first set of chaotic pseudo-random integer sequences x is obtained by integerizing the first set of chaotic pseudo-random integer sequences x i1 、y i1 、z i1 、w i1 ;
[0101]
[0102] Where floor(·) represents the floor function.
[0103] Specifically, the scrambling algorithm of the improved Knight's Tour is:
[0104] The first set of chaotic pseudo-random integer sequence x i1 Substitute the following formula:
[0105] T 1i =x i1 mod 8;
[0106] Among them, mod represents the remainder function, according to T 1i Control the knight's next patrol position;
[0107] like Figure 3 As shown, the position of the white horse head is the knight's initial position, and the positions of numbers 0-7 are the positions that the knight can reach in the next patrol;
[0108] T 1i The values of are (0, 1, 2, 3, 4, 5, 6, 7), corresponding to the 8 chessboard points around the knight's current position;
[0109] If T 1i If it is 0, the knight will patrol to Figure 3 The position of 0 in the middle;
[0110] If T 1i If it is 1, the knight will patrol to Figure 3 The position of 1 in the middle;
[0111] If T 1i If it is 2, the knight will patrol to Figure 3 The position of 2 in the middle;
[0112] If T 1i If it is 3, the knight will patrol to Figure 3 The position of 3 in the middle;
[0113] If T 1i If it is 4, the knight will patrol to Figure 3 The position of 4 in the middle;
[0114] If T 1i If it is 5, the knight will patrol to Figure 3 The position of 5 in the middle;
[0115] If T 1i If it is 6, the knight will patrol to Figure 3 The position of the middle 6;
[0116] If T 1i If it is 7, the knight will patrol to Figure 3 The position of 7 in the middle;
[0117] If T 1i If the position pointed to has been passed, it will advance to the next position in a clockwise direction; for example, T 1i The location pointed to is Figure 3 In 2, if grid point 2 has been patrolled, the knight skips grid point 2 and patrols grid point 3. If grid point 3 has also been patrolled, the knight continues to skip grid point 3 and patrol grid point 4 until it reaches a grid point that has not been patrolled.
[0118] When the knight patrols to the edge of the board, if T 1i If the position pointed to is outside the chessboard, it will advance clockwise to the next position that has not been patrolled;
[0119] If all eight chessboard grid points around the knight's current position have been traversed, the knight returns to the previous position and uses the previous position as the new starting position to perform the knight's tour steps until all grid points on the chessboard have been traversed.
[0120] Specifically, the method for improving the Rubik's Cube scrambling is:
[0121] The image after the Knight's Tour scrambling is divided into 6 sub-images of the same size and without overlap, with a length of M / 3 and a width of N / 2. The 6 sub-images are mapped to the sides of On the six faces of the Rubik's Cube, is the ceiling function;
[0122] The first set of chaotic pseudo-random integer sequence y i1 Substitute the following formula:
[0123] T 2i =y i1 mod 3;
[0124] Among them, mod represents the remainder function, according to T 2i The value of controls the rotation axis of the Rubik's Cube;
[0125] If T 2i The value of is 0, then the y-axis is the rotation axis; if T 2iThe value of is 1, then the x-axis is the rotation axis; if T 2i If the value is 2, the z axis is the rotation axis;
[0126] The first set of chaotic pseudo-random integer sequence Z i1 Substitute the following formula:
[0127]
[0128] Determine the number of layers of the Rubik's Cube rotation to be T 3i layer;
[0129] The first set of chaotic pseudo-random integer sequence w i1 Substitute the following formula:
[0130]
[0131] Determine the step size of the Rubik's Cube rotation as T 4i , the step size of the Rubik's Cube rotation corresponds to the rotation angle;
[0132] The rotation direction is clockwise, and the Rubik's Cube is executed After the rotation, the Rubik's Cube scrambling is completed and the scrambled matrix Z is obtained.
[0133] Specifically, the method for obtaining the first set of chaotic pseudo-random integer sequences is:
[0134] The key k2 = (a, b, p, q, [x(0), y(0), z(0), w(0)]) is selected as the parameters and initial values of the memristive chaotic system; where a = 0.7, b = 0.5, p = 0.3, q = 0.3; [x(0), y(0), z(0), w(0)] = [0.1, 0.1, 0.21, 0.2];
[0135] The key k2 is used to iterate the memristor chaotic system multiple times (using the Runge-Kutta method with an iteration step of 0.1) to obtain a chaotic sequence. The first 600 items of the chaotic sequence are discarded to obtain the second set of chaotic pseudo-random sequence x′. i2 , y′ i2 、z′ i2 , w′ i2 ;
[0136] The second set of chaotic pseudo-random integer sequences x is obtained by integerizing the second set of chaotic pseudo-random integer sequences x i2 、y i2 、Z i2 、w i2 ;
[0137]
[0138] Where floor(·) represents the floor function.
[0139] Specifically, the second set of chaotic pseudo-random integer sequences is substituted into the following formula to obtain:
[0140]
[0141] in, Represents exclusive OR operation;
[0142] will a i 、b i The cross arrangement is transformed into an M×N chaotic matrix H, and the chaotic matrix H is XORed with the scrambling matrix Z to obtain the ciphertext matrix, which is finally output as a ciphertext image.
[0143] like Figure 2 As shown, the second aspect of the embodiment of the present invention provides a memristive chaotic image decryption method based on Knight's Tour and Rubik's Cube scrambling. During the decryption process, the ciphertext image is decrypted using the same chaotic pseudo-random integer sequence as in the encryption step to obtain the plaintext image. The decryption process of the ciphertext image is the inverse process of the plaintext image encryption process. The decryption process steps are as follows:
[0144] In the first step, a key k1 is selected to iterate the memristor chaotic system multiple times to obtain the first set of chaotic pseudo-random sequences, which are then integerized to obtain the first set of chaotic pseudo-random integer sequences.
[0145] Specifically, the key k1 = (a, b, p, q, [x(0), y(0), z(0), w(0)]) is selected as the parameters and initial values of the memristive chaotic system; where a = 0.7, b = 0.5, p = 0.3, q = 0.3; [x(0), y(0), z(0), w(0)] = [0.1, 0.1, 0.2, 0.2];
[0146] The key k1 is used to iterate the memristor chaotic system multiple times (using the Runge-Kutta method with an iteration step of 0.1) to obtain a chaotic sequence. The first 600 items of the chaotic sequence are discarded to obtain the first set of chaotic pseudo-random sequence x′. i1 , y′ i1 、z′ i1 , w′ i1 ;
[0147] The first set of chaotic pseudo-random sequences is integerized to obtain the first set of chaotic pseudo-random integer sequences x i1 、y i1 、z i1 、w i1 .
[0148] In the second step, the key k2 is selected to iterate the memristor chaotic system multiple times to obtain a second set of chaotic pseudo-random sequences, which are then integerized to obtain a second set of chaotic pseudo-random integer sequences.
[0149] Specifically, the key k2 = (a, b, p, q, [x(0), y(0), z(0), w(0)]) is selected as the parameters and initial values of the memristive chaotic system; where a = 0.7, b = 0.5, p = 0.3, q = 0.3; [x(0), y(0), z(0), w(0)] = [0.1, 0.1, 0.21, 0.2];
[0150] The key k2 is used to iterate the memristor chaotic system multiple times (using the Runge-Kutta method with an iteration step of 0.1) to obtain a chaotic sequence. The first 600 items of the chaotic sequence are discarded to obtain the second set of chaotic pseudo-random sequence x′. i2 , y′ i2 , Z′ i2 , w′ i2 ;
[0151] The second set of chaotic pseudo-random sequences is integerized to obtain the second set of chaotic pseudo-random integer sequences x i2 、y i2 、Z i2 、w i2 .
[0152] The third step is to convert the second set of chaotic pseudo-random integer sequences into an M×N chaotic matrix H after XOR operation, and then perform XOR operation on the chaotic matrix H and the ciphertext image to obtain the scrambling matrix Z.
[0153] The fourth step is to map the scrambled matrix Z to the six faces of the Rubik's Cube in the same way as in the encryption process, using the first set of chaotic pseudo-random integer sequence y i1 、z i1 、w i1 Control the Rubik's Cube to perform inverse scrambling, and then transform it into a matrix;
[0154] Step 5: Substitute the first set of chaotic pseudo-random integer sequence x i1 Substitute the inverse scrambled matrix into the improved Knight's Tour inverse scrambling to obtain the plaintext matrix, and then convert the plaintext matrix into a plaintext image.
[0155] A third aspect of an embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor implements the steps of the image encryption method when executing the computer program.
[0156] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image encryption method are implemented.
[0157] This example uses MATLAB R2023b software to conduct a comprehensive analysis of the algorithm's performance, combining key sensitivity and other performance indicators. The algorithm is compared with existing algorithms to verify its advancedness. The specific operating environment is as follows: AMD Ryzen 5 7530U with Radeon Graphics @ 2.00GHz, 16GB of memory, and a 64-bit Windows 11 operating system.
[0158] from Figure 4 It can be seen that the encrypted image presents the characteristics of random noise, and the decrypted image is completely consistent with the original image. The image encryption and decryption algorithm proposed in the present invention can effectively realize image encryption and decryption.
[0159] Obviously, from Figure 4 In (b), no information related to the plaintext is visible. The image encryption algorithm of the present invention does improve the security of image information. Next, the performance of this method is studied using various image encryption performance indicators.
[0160] 1) Key space analysis
[0161] The practical key of the algorithm of the present invention is:
[0162] k1=(a, b, o, q, [x(0), y(0), z(0), w(0)])
[0163] Among them, a=0.7, b=0.5, p=0.3, q=0.3; [x(0), y(0), z(0), w(0)]=[0.1, 0.1,0.2, 0.2]; k2=(a, b, p, q, [x(0), y(0), z(0), w(0)])
[0164] Among them, a=0.7, b=0.5, p=0.3, q=0.3; [x(0), y(0), z(0), w(0)]=[0.1, 0.1, 0.21, 0.2];
[0165] System parameters are accurate to 10 -4 , the pseudo-random sequence is accurate to 10 -15 ;
[0166] Therefore, the key space is (10 4 ) 5 ×(10 15 ) 8 =10 140 ≈2465 , far exceeding the current brute force attack limit2 100 , which means that under the current conditions, it is impossible to find the system parameters and keys used by brute force, which can effectively resist exhaustive attacks. The key space comparison of different algorithms is shown in Table 1 below:
[0167] Table 1 Key space comparison table
[0168]
[0169] As can be seen from Table 1, the algorithm of the present invention has the characteristic of a large key space and is significantly superior to many algorithms in terms of key space, and can better enhance the image encryption effect.
[0170] 2) Histogram analysis
[0171] The grayscale histogram can be used to visually visualize the distribution of pixel values. If the distribution is uneven, attackers can analyze and obtain image information. Therefore, an excellent image encryption algorithm needs to ensure a uniform distribution of the grayscale histogram.
[0172] from Figure 5 It can be seen that the image encrypted by the algorithm of the present invention presents a uniformly distributed grayscale histogram. Therefore, the algorithm of the present invention is able to resist grayscale statistical attacks.
[0173] 3) Information entropy analysis
[0174] In image encryption, information entropy is used to describe the amount of information contained in an image. The closer the information entropy is to 8, the less information the image contains and the better the image encryption.
[0175] The information entropy of the ciphertext image obtained by the encryption algorithm of the present invention is compared with that of the Lena color plaintext image and the encryption algorithms in other related image encryption literature. The information entropy comparison results are shown in Table 2 below:
[0176] Table 2 Information entropy comparison table
[0177]
[0178] It can be seen from Table 2 that the information entropy of the algorithm of the present invention is closer to the ideal value of 8, so the encryption algorithm of the present invention has better image pixel scrambling effect and superior performance.
[0179] 4) Correlation analysis of adjacent pixels
[0180] In image encryption, the size of the correlation between adjacent pixels is used to measure the security of the encryption algorithm. The closer the absolute value of the adjacent coefficient of adjacent pixels is to 0, the better. Figure 6This is a comparison chart of the correlation between adjacent pixels of the ciphertext image and the original image obtained by the algorithm of the present invention. At the same time, the correlation coefficients of adjacent pixels of the algorithm of the present invention and the image encryption algorithms of other documents are compared in Table 3:
[0181] Table 3 Comparison of adjacent pixel correlation coefficients
[0182]
[0183] Depend on Figure 6 As can be seen from Table 3, the correlation coefficient of adjacent pixels of the ciphertext image encrypted by the algorithm of the present invention is much lower than that of the plaintext image, and higher than the correlation coefficients of other literatures. Therefore, the algorithm has better encryption performance.
[0184] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A memristive chaotic image encryption method based on Knight's Tour and Rubik's Cube scrambling, characterized in that: The following steps are involved: Read the plaintext image and convert it into M × N The pixel matrix of Select Key k 1. Perform multiple iterations on the memristor chaotic system to obtain a first set of chaotic pseudo-random sequences, which are then integerized to obtain a first set of chaotic pseudo-random integer sequences; A starting point is randomly selected on the chessboard corresponding to the pixel matrix as the starting position of the knight's tour, and the first set of chaotic pseudo-random integer sequences is used to control the position of the knight's next tour until all the pixels in the pixel matrix are traversed; Map the image pixels after the Knight's Tour scrambling to the six faces of the Rubik's Cube, and use the first set of chaotic pseudo-random integer sequences to control the scrambling of the Rubik's Cube to obtain the scrambling matrix Z ; Select Key k 2. Iterate the memristor chaotic system multiple times to obtain a second set of chaotic pseudo-random sequences, and perform integer processing on the second set of chaotic pseudo-random integer sequences; Convert the second set of chaotic pseudo-random integer sequences into M × N Chaos Matrix H , the chaotic matrix H With scrambled matrix Z Perform XOR operation to obtain the ciphertext image; The following memristor chaotic system is used to generate chaotic pseudo-random sequences: ; in, x 、 y 、 z 、 w is the state variable of the memristive chaotic system, , a 、 b 、 p 、 q are the system parameters of the memristor chaotic system.
2. The memristive chaotic image encryption method based on Knight's Tour and Rubik's Cube scrambling according to claim 1, characterized in that: Select Key k 1=( a , b , p , q ,[ x (0), y (0), z (0), w (0)]) as the parameters and initial values of the memristive chaotic system; where, a = 0.7, b = 0.5, p = 0.3, q = 0.3; [ x (0), y (0), z (0), w (0)] = [0.1,0.1,0.2,0.2]; Utilizing the key k 1. Perform multiple iterations on the memristor chaotic system to obtain a chaotic sequence. Discard the first 600 items of the chaotic sequence to obtain the first set of chaotic pseudo-random sequences. ; The first set of chaotic pseudo-random integer sequences is integerized by the following formula: ; ; in, floor (·) represents the floor function.
3. The memristive chaotic image encryption method based on Knight's Tour and Rubik's Cube scrambling as claimed in claim 2, characterized in that: The first set of chaotic pseudo-random integer sequences Substitute the following formula: ; Among them, mod represents the remainder function, according to Control the knight's next patrol position; The values of are (0, 1, 2, 3, 4, 5, 6, 7), which correspond to the 8 chessboard points around the knight's current position; like If the position pointed to has been passed, it will advance to the next position in clockwise or counterclockwise direction; When the knight patrols to the edge of the board, if If the position pointed to is outside the chessboard, it will advance to the next position clockwise or counterclockwise; If all eight chessboard grid points around the knight's current position have been traversed, the knight returns to the previous position and uses the previous position as the new starting position to perform the knight's tour steps until all grid points on the chessboard have been traversed.
4. The memristive chaotic image encryption method based on Knight's Tour and Rubik's Cube scrambling according to claim 2, characterized in that: The image after the Knight's Tour scrambling is divided into 6 sub-images of the same size and without overlap, and the 6 sub-images are mapped to the sides of On the Rubik's Cube, is the ceiling function; The first set of chaotic pseudo-random integer sequences Substitute the following formula: ; Among them, mod represents the remainder function, according to The value of controls the rotation axis of the Rubik's Cube; like The value of is 0, then y Axis is the axis of rotation; if The value of is 1, then x Axis is the axis of rotation; if The value of is 2, then z The axis is the axis of rotation; The first set of chaotic pseudo-random integer sequences Substitute the following formula: ; Determine the number of layers of the Rubik's Cube rotation layer; The first set of chaotic pseudo-random integer sequences Substitute the following formula: ; Determine the step size of the Rubik's Cube rotation ; The rotation direction is clockwise, and the Rubik's Cube is executed After the rotation, the Rubik's Cube scrambling is completed and the scrambled matrix is obtained. Z .
5. The memristive chaotic image encryption method based on Knight's Tour and Rubik's Cube scrambling according to claim 1, characterized in that: Select Key k 2=( a , b , p , q ,[ x (0), y (0), z (0), w (0)]) as the parameters and initial values of the memristive chaotic system; where, a = 0.7, b = 0.5, p = 0.3, q = 0.3; [ x (0), y (0), z (0), w (0)] = [0.1,0.1,0.21,0.2]; Utilizing the key k 2. Perform multiple iterations on the memristor chaotic system to obtain a chaotic sequence. Discard the first 600 items of the chaotic sequence to obtain the second set of chaotic pseudo-random sequences. ; The second set of chaotic pseudo-random integer sequences is integerized by the following formula: ; ; in, floor (·) represents the floor function.
6. The memristive chaotic image encryption method based on Knight's Tour and Rubik's Cube scrambling according to claim 5, characterized in that: Substituting the second set of chaotic pseudo-random integer sequences into the following formula yields: ; in, Represents exclusive OR operation; Will Cross-arrangement into M × N Chaos Matrix H , the chaotic matrix H With scrambled matrix Z Perform an XOR operation to obtain the ciphertext matrix, and finally output the ciphertext matrix as a ciphertext image.
7. A memristive chaotic image decryption method based on Knight's Tour and Rubik's Cube scrambling, characterized in that: The ciphertext image is decrypted using the chaotic pseudo-random integer sequence in the image encryption method according to any one of claims 1 to 6 to obtain a plaintext image. The decryption process of the ciphertext image is the inverse process of the plaintext image encryption process.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, wherein: When the processor executes the computer program, the steps of the image encryption method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the image encryption method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Data de-clustering and disordering as well as recovering method based on three-dimensional space structure
CN102193877A
Image encryption method based on improved magic cube transformation and memristor chaos
CN113129195A