Chaotic image encryption method based on improved Josephus transform and Knight's Tour joint scrambling

Through the chaotic image encryption method of improved Josephus transform and Knight's Tour joint scrambling, the chaotic pseudo-random sequence is generated by the memristive chaotic system to scramble and diffuse the image, which solves the problems of poor global encryption effect and easy cracking of the Knight's Tour image encryption algorithm in the existing technology, and achieves higher security and global encryption effect.

CN119788785BActive Publication Date: 2025-10-03NAVAL UNIV OF ENG PLA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411817040.5
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

Technical Problem

The existing Knight's Tour image encryption algorithm has the problems of poor global encryption effect and easy cracking of encrypted images.

Method used

A chaotic image encryption method based on the improved Josephus transform and Knight's Tour joint scrambling is adopted. A chaotic pseudo-random sequence is generated through a memristive chaotic system, and the image is scrambled by Josephus and Knight's Tour. The image is then diffused using the XOR operation to improve the global encryption effect and security of the image.

Benefits of technology

It effectively reduces the correlation between adjacent pixels of the scrambled image, improves the global encryption effect of the image, and changes the pixel value through the diffusion of chaotic pseudo-random sequences, thereby improving the security of the encrypted image and resisting cracking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119788785B_ABST
    Figure CN119788785B_ABST
Patent Text Reader

Abstract

This paper proposes a chaotic image encryption method based on the combined scrambling of the improved Josephus transform and the Knight's Tour. First, a chaotic pseudo-random integer sequence is generated and integerized using a memristive chaotic system. Then, the pixel matrix is ​​divided into several small cell pixel matrices. Within each cell pixel matrix, the chaotic pseudo-random integer sequence is used to control the counting starting point, counting period, and counting direction, respectively. Block scrambling is performed using the improved Josephus scrambling algorithm. Subsequently, each cell pixel matrix after the improved Josephus block scrambling is treated as a checkerboard point, and the direction of the Knight's Tour is controlled using the chaotic pseudo-random integer sequence. The image is scrambled using the improved Knight's Tour algorithm and the improved Josephus scrambling algorithm, effectively reducing the correlation between adjacent pixels in the scrambled image and improving the global encryption effect of the image. Finally, the chaotic pseudo-random integer sequence generated and integerized by the memristive chaotic system is used to diffuse the pixels, enhancing the security of the encrypted image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image encryption, and in particular to a chaotic image encryption method based on improved Josephus transformation and Knight's Tour joint scrambling. Background Art

[0002] With the widespread use of smartphones, digital images have become increasingly popular as an intuitive and informative medium. Unfortunately, some images carrying private or confidential information pose a risk of being illegally accessed during transmission. Therefore, designing appropriate image encryption methods is crucial.

[0003] In existing research, image encryption mainly uses scrambling and / or diffusion methods. Scrambling is to encrypt by changing the position of each pixel of the image using some scrambling methods, and diffusion is to encrypt by changing the pixel values ​​of the image.

[0004] The Knight's Tour is a scrambling method that controls the starting point, end point, and direction of the Knight's Tour. Due to its advantages such as a large key space and aperiodicity, the Knight's Tour scrambling method has attracted academic attention and has achieved some good research results (see references [1-8]).

[0005] In image encryption, the Knight's Tour method can be used for image scrambling. The main method is to convert the original image into a pixel matrix, which corresponds to a chessboard, with each pixel in the matrix corresponding to each square on the chessboard. The knight traverses each square on the chessboard in a "day" manner, trying all possible move combinations and recording the squares that have been visited to avoid repeated visits. When the algorithm searches a certain position, if it has already been visited or does not meet the conditions for the Knight's Tour, it is necessary to backtrack, returning to the previous position and continuing to try other move combinations. These steps are repeated until all squares on the chessboard have been visited. Since the Knight's Tour path is not unique, the tour matrix also has multiple possibilities. This is the basis for the large key space of the Knight's Tour algorithm, which in turn ensures the security of the encryption.

[0006] However, as we delved deeper into the research, we discovered that the Knight's Tour scrambling method also has some flaws. First, the pixel positions of an image scrambled by the Knight's Tour are only shuffled between three adjacent columns and rows. This means that pixels in adjacent positions are highly correlated. This can result in Knight's Tour image encryption only hiding local details, while the image outline and content remain discernible, resulting in poor global encryption. Second, because the Knight's Tour only scrambles the pixel positions, not their values, the encryption level is weak. This makes the encrypted image vulnerable to cracking, posing a certain threat to image security.

[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 SA novel and efficient method based on knightmoves for securing the information contents of images A parallel approach[J].Journal of Information Security and Applications,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 and Applications,2018,42:57-70.

[0011] [4]Bansal A,Muttoo KS,Kumar V.Secure data hiding along randomlyselected closed Knight's tour[J].Journal of Applied Security Research,2016,11(1):90-100.

[0012] [5]Shashikiran BS, Shaila K, 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] 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.

[0017]

[10] Younes Q,Abdellah A,Mariem J,et al.Adaptation of a genetic operator and a dynamic S-box for chaotic encryption of medical and colorimages[J].Scientific African,2023,19:1-15.

[0018]

[11] 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.

[0019]

[12] Yang Shuting, Wu Zhaoxia. Research on color image encryption algorithm based on DNA and Latin square[J]. Cyberspace Security, 2022, 13(2): 37-42.

[0020]

[13] 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.

[0021]

[14] 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.

[0022]

[15] Moussa MI,El-Latif AEI,El-Atta AA H.Diagonalize three-dimensional nonlinear chaotic map to encrypt color image[J].EgyptianInformatics Journal,2023,24:1-11.

[0023]

[16] Shi Jinjing, Chen Tian, ​​Chen Shuhui, et al. Quantum image chaos encryption method based on Arnold transform[J]. Journal of Electronics & Information Technology, 2022, 44(12): 4284-4293.

[0024]

[17] Ren Hua, Niu Shaozhang, Ren Ruyong, et al. Research on meaningful image encryption algorithm based on two-dimensional compressed sensing [J]. Journal of Communications, 2022, 43(5): 45-57.

[0025]

[18] Belazi A,El-Latif A,Ahmed A,Belghith SA novel image encryption scheme based on substitution-permutation network and chaos[J].SignalProcessing,2016,128:155-170. Summary of the Invention

[0026] The present invention proposes a chaotic image encryption method based on improved Josephus transform and Knight's Tour joint 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.

[0027] The technical solution of the present invention is achieved as follows:

[0028] A first aspect of the present invention provides a chaotic image encryption method based on an improved Josephus transform and a Knight's Tour joint scrambling method, comprising the following steps:

[0029] Read the plaintext image and convert it into an M×N pixel matrix;

[0030] 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;

[0031] The M×N pixel matrix is ​​divided into several m×n cell pixel matrices, and each cell pixel matrix is ​​subjected to Josephus scrambling using the first set of chaotic pseudo-random integer sequences;

[0032] Treat each cell pixel matrix after Josephus scrambling as a chessboard point, randomly select a starting point on the chessboard as the starting position of the Knight's Tour, and use the first set of chaotic pseudo-random integer sequences to perform Knight's Tour scrambling on the image to obtain the scrambled matrix Z;

[0033] 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;

[0034] 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.

[0035] Specifically, the following memristor chaotic system is used to generate a chaotic pseudo-random sequence:

[0036]

[0037] Among them, x, y, z, and w are the state variables of the memristor chaotic system, and a, b, p, and q are the system parameters of the memristor chaotic system.

[0038] 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];

[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 method of using the first set of chaotic pseudo-random integer sequences to perform Josephus scrambling on each cell pixel matrix is ​​as follows:

[0044] First, perform Josephus row scrambling on the cell pixel matrix. The steps are as follows:

[0045] Arrange the m elements of each row of the cell pixel matrix into a circle in sequence;

[0046] The first set of chaotic pseudo-random integer sequence x i1 Substitute the following formula:

[0047] s=x i1 mod(m+1-i), (i=1,2,…,m);

[0048] Wherein, mod represents the modulo function, and s is used as the counting starting point of the Josephus row scrambling of the cell pixel matrix;

[0049] The first set of chaotic pseudo-random integer sequence y i1 Substitute the following formula:

[0050] p=y i1 mod(m+1-i), (i=1,2,…,m);

[0051] Take p as the counting period of Josephus row scrambling of cell pixel matrix;

[0052] The first set of chaotic pseudo-random integer sequence z i1 Substitute the following formula:

[0053] d=z i1 mod 2;

[0054] Take d as the counting direction of Josephus row scrambling of the cell pixel matrix. When d = 1, count in the clockwise direction; when d = 0, count in the counterclockwise direction.

[0055] Repeat the Josephus row scrambling of the cell pixel matrix until every row of the cell pixel matrix has been scrambled;

[0056] Then perform Josephus column scrambling on the cell pixel matrix. The steps are as follows:

[0057] Arrange the n elements of each column of the cell pixel matrix after Josephus row scrambling into a circle in order;

[0058] The first set of chaotic pseudo-random integer sequence x i1 Substitute the following formula:

[0059] s=x i1 mod(n+1-i), (i=1,2,…,n);

[0060] Use s as the counting starting point for Josephus row scrambling of the cell pixel matrix;

[0061] The first set of chaotic pseudo-random integer sequence y i1 Substitute the following formula:

[0062] p=y i1 mod(n+1-i), (i=1, 2,...,n);

[0063] Take p as the counting period of Josephus column scrambling of the cell pixel matrix;

[0064] The first set of chaotic pseudo-random integer sequence z i1 Substitute the following formula:

[0065] d=z i1 mod 2;

[0066] Take d as the counting direction of the Josephus column scrambling of the cell pixel matrix. When d = 1, count in the clockwise direction; when d = 0, count in the counterclockwise direction.

[0067] Repeat the Josephus column scrambling of the cell pixel matrix until every column of the cell pixel matrix has been scrambled.

[0068] Specifically, the method of using the first set of chaotic pseudo-random integer sequences to perform Knight's Tour scrambling on an image is as follows:

[0069] The first set of chaotic pseudo-random integer sequence w i1 Substitute the following formula:

[0070] T 1i =w i1 mod 8;

[0071] Among them, mod represents the remainder function, according to T 1i Control the knight's next patrol position;

[0072] 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;

[0073] If T 1i If the position pointed to has been passed, it will advance to the next position in clockwise or counterclockwise direction;

[0074] 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;

[0075] 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.

[0076] 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];

[0077] 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′ i2 , w′ i2 ;

[0078] 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 ;

[0079]

[0080] Where floor(·) represents the floor function.

[0081] Specifically, the second set of chaotic pseudo-random integer sequences is substituted into the following formula to obtain:

[0082]

[0083] in, Represents exclusive OR operation;

[0084] 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.

[0085] The second aspect of the present invention provides a chaotic image decryption method based on the improved Josephus transform and the Knight's Tour joint 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.

[0086] 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.

[0087] 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.

[0088] Compared with the prior art, the present invention has the following beneficial effects:

[0089] The present invention first uses a chaotic pseudo-random integer sequence to improve the Knight's Tour scrambling algorithm and the Josephus scrambling algorithm, and then combines the improved Josephus scrambling algorithm and the improved Knight's Tour 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 values ​​of the image, and improve the security of the encrypted image. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] 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.

[0091] Figure 1 Schematic diagram of the process of plaintext image encryption in an embodiment of the present invention;

[0092] Figure 2 Schematic diagram of the process of decrypting a ciphertext image in an embodiment of the present invention;

[0093] Figure 3 Schematic diagram of the Josephus scrambling in an embodiment of the present invention;

[0094] Figure 4 A schematic diagram of the Knight's Tour scrambling process according to an embodiment of the present invention;

[0095] Figure 5A comparison diagram of a plaintext image, a ciphertext image, and a decrypted image in an embodiment of the present invention; Figure 5 In the figure, (a) is the plaintext image, (b) is the ciphertext image, and (c) is the decrypted image;

[0096] Figure 6 A comparison chart of key sensitivity test results in an embodiment of the present invention; Figure 6 In this figure, (a) is the image decrypted by the correct key, and (b) is the image decrypted by the wrong key;

[0097] Figure 7 is a histogram of a plaintext image and a ciphertext image in an embodiment of the present invention; Figure 7 In the figure, (a) is the histogram of the plaintext image, and (b) is the histogram of the ciphertext image;

[0098] Figure 8 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 8 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

[0099] 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.

[0100] Reference Figure 1 In a first aspect, an embodiment of the present invention provides a chaotic image encryption method based on an improved Josephus transform and a Knight's Tour joint scrambling method, comprising the following steps:

[0101] Read the plaintext image and convert it into an M×N pixel matrix;

[0102] 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;

[0103] The M×N pixel matrix is ​​divided into several m×n cell pixel matrices, and each cell pixel matrix is ​​subjected to Josephus scrambling using the first set of chaotic pseudo-random integer sequences;

[0104] Each cell pixel matrix after Josephus scrambling is regarded as a chessboard point. A starting point r is randomly selected on the chessboard as the starting position of the Knight's Tour. The image is scrambled using the first set of chaotic pseudo-random integer sequences to obtain the scrambled matrix Z.

[0105] 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;

[0106] 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.

[0107] Specifically, the following memristor chaotic system (see reference [9]) is used to generate a chaotic pseudo-random sequence:

[0108]

[0109] Among them, x, y, z, and w are the state variables of the memristor chaotic system, and a, b, p, and q are the system parameters of the memristor chaotic system.

[0110] Specifically, the key k1 = (a, b, o, 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];

[0111] 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 ;

[0112] 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 ;

[0113]

[0114] Where floor(·) represents the floor function.

[0115] The Josephus problem is a famous theoretical problem that describes a group of people sitting in a circle. The first person starts counting, and the person who reports a certain number steps out. Then the next person starts counting again until everyone steps out. This process forms a specific order of stepping out.

[0116] When Josephus transform scrambling is used in image encryption, the image pixels are typically arranged in a specific order into a ring structure. A starting point and a step size are then randomly selected, and the image pixels are scrambled by simulating the dequeueing process of the Josephus problem. This way, after multiple Josephus transform scrambling operations, the pixel positions of the original image are completely disrupted, thus achieving image encryption.

[0117] Josephus transform scrambling can be described as a mathematical model:

[0118] q = Josephus(n, s, p);

[0119] Among them, n represents the total number, s represents the counting starting point, and p represents the counting period. Count in clockwise direction and rearrange the numbers to scramble them. For example, Figure 3 As shown in FIG, assuming n=8, s=1, p=4, the original sequence q={1, 2, 3, 4, 5, 6, 7, 8} is scrambled to q={4, 8, 5, 2, 1, 3, 7, 6}.

[0120] However, the traditional Josephus transform has fixed counting starting points, counting periods, and counting directions. Therefore, the generated sequence has relatively little variation, lacks randomness, and has poor scrambling effects. This invention utilizes a memristive chaotic system to generate a chaotic pseudo-random integer sequence to control the counting starting point, counting period, and counting direction of the Josephus transform, thereby improving the randomness of the Josephus scrambling and enhancing the scrambling effect.

[0121] Specifically, the method of using the first set of chaotic pseudo-random integer sequences to perform Josephus scrambling on each cell pixel matrix is ​​as follows:

[0122] First, perform Josephus row scrambling on the cell pixel matrix. The steps are as follows:

[0123] Arrange the m elements of each row of the cell pixel matrix into a circle in sequence;

[0124] The mathematical model for Josephus row scrambling of the cell pixel matrix is ​​as follows:

[0125] q1=Josephus(m,s,p,d);

[0126]

[0127] Where m represents the total number of columns of the cell pixel matrix;

[0128] The first set of chaotic pseudo-random integer sequence x i1 Substitute the following formula:

[0129] s=x i1 mod(m+1-i), (i=1,2,…,m);

[0130] Wherein, mod represents the modulo function, and s is used as the counting starting point of the Josephus row scrambling of the cell pixel matrix;

[0131] The first set of chaotic pseudo-random integer sequence y i1 Substitute the following formula:

[0132] p=y i1 mod(m+1-i), (i=1, 2,..., m);

[0133] Take p as the counting period of Josephus row scrambling of cell pixel matrix;

[0134] The first set of chaotic pseudo-random integer sequence Z i1 Substitute the following formula:

[0135] d=z i1 mod 2;

[0136] Take d as the counting direction of Josephus row scrambling of the cell pixel matrix. When d = 1, count in the clockwise direction; when d = 0, count in the counterclockwise direction.

[0137] Repeat the Josephus row scrambling of the cell pixel matrix until every row of the cell pixel matrix has been scrambled;

[0138] Then perform Josephus column scrambling on the cell pixel matrix. The steps are as follows:

[0139] Arrange the n elements of each column of the cell pixel matrix after Josephus row scrambling into a circle in order;

[0140] The mathematical model for performing Josephus column scrambling on the cell pixel matrix is ​​as follows:

[0141] q2=Josephus(n,s,p,d);

[0142]

[0143] Where n represents the total number of rows in the cell pixel matrix;

[0144] The first set of chaotic pseudo-random integer sequence x i1 Substitute the following formula:

[0145] s=x i1 mod(n+1-i), (i=1,2,…,n);

[0146] Use s as the counting starting point for Josephus row scrambling of the cell pixel matrix;

[0147] The first set of chaotic pseudo-random integer sequence y i1 Substitute the following formula:

[0148] p=y i1 mod(n+1-i), (i=1, 2,...,n);

[0149] Take p as the counting period of Josephus column scrambling of the cell pixel matrix;

[0150] The first set of chaotic pseudo-random integer sequence z i1 Substitute the following formula:

[0151] d=z i1 mod 2;

[0152] Take d as the counting direction of the Josephus column scrambling of the cell pixel matrix. When d = 1, count in the clockwise direction; when d = 0, count in the counterclockwise direction.

[0153] Repeat the Josephus column scrambling of the cell pixel matrix until every column of the cell pixel matrix has been scrambled.

[0154] Specifically, the method of using the first set of chaotic pseudo-random integer sequences to perform Knight's Tour scrambling on an image is as follows:

[0155] Substitute the first set of chaotic pseudo-random integer sequences into the following formula:

[0156] T 1i =w i1 mod 8;

[0157] Among them, mod represents the remainder function, according to T 1i Control the knight's next patrol position;

[0158] like Figure 4 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;

[0159] T 1iThe values ​​of are (0, 1, 2, 3, 4, 5, 6, 7), corresponding to the 8 chessboard points around the knight's current position;

[0160] If T 1i If it is 0, the knight will patrol to Figure 4 The position of 0 in the middle;

[0161] If T 1i If it is 1, the knight will patrol to Figure 4 The position of 1 in the middle;

[0162] If T 1i If it is 2, the knight will patrol to Figure 4 The position of 2 in the middle;

[0163] If T 1i If it is 3, the knight will patrol to Figure 4 The position of 3 in the middle;

[0164] If T 1i If it is 4, the knight will patrol to Figure 4 The position of 4 in the middle;

[0165] If T 1i If it is 5, the knight will patrol to Figure 4 The position of 5 in the middle;

[0166] If T 1i If it is 6, the knight will patrol to Figure 4 The position of the middle 6;

[0167] If T 1i If it is 7, the knight will patrol to Figure 4 The position of 7 in the middle;

[0168] 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 4 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.

[0169] 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;

[0170] 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.

[0171] 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];

[0172] 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 ;

[0173] 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 ;

[0174]

[0175] Where floor(·) represents the floor function.

[0176] Specifically, the second set of chaotic pseudo-random integer sequences is substituted into the following formula to obtain:

[0177]

[0178] in, Represents exclusive OR operation;

[0179] 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.

[0180] like Figure 2 As shown, the second aspect of the embodiment of the present invention provides a chaotic image decryption method based on the improved Josephus transform and the Knight's Tour joint scrambling. During the decryption process, the ciphertext image is decrypted using the same chaotic pseudo-random integer sequence as used 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:

[0181] 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.

[0182] Specifically, the key k1 = (a, b, o, 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];

[0183] 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 ;

[0184] 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 .

[0185] 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.

[0186] 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];

[0187] 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 ;

[0188] 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 .

[0189] 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.

[0190] The fourth step is to divide the M×N scrambled matrix Z into several m×n cell pixel matrices, and regard each cell pixel matrix as a chessboard point. The same starting point r as in the encryption process is selected on the chessboard as the starting position of the Knight's Tour, and the first group of chaotic pseudo-random integer sequences w is used as the starting point of the chessboard. i1 Substitute into the scrambled matrix Z to perform the inverse scrambling of the improved Knight's Tour and obtain the inverse scrambled matrix.

[0191] Step 5: Substitute the first set of chaotic pseudo-random integer sequence x i1 、y i1 、z i1 Substitute the inverse scrambled pixels into each cell pixel matrix and perform improved Josephus inverse scrambling to obtain the plaintext matrix, which is then converted into a plaintext image.

[0192] 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.

[0193] 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.

[0194] 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.

[0195] from Figure 5 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.

[0196] Obviously, from Figure 5In (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.

[0197] 1) Key sensitivity analysis

[0198] In order to verify the key sensitivity of the algorithm of the present invention, the ciphertext image is decrypted using the correct key and the wrong key with slight differences, such as Figure 6 As shown. Figure 6 It can be clearly observed that the ciphertext image cannot be correctly decrypted using the wrong key.

[0199] 2) Key space analysis

[0200] The practical key of the algorithm of the present invention is:

[0201] k1=(a,b,p,q,[x(0),y(0),z(0),w(0)])

[0202] 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];

[0203] k2=(a, b, o, q, [x(0), y(0), z(0), w(0)])

[0204] 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];

[0205] System parameters are accurate to 10 -4 , the pseudo-random sequence is accurate to 10 -15 ;

[0206] Therefore, the key space is (10 4 ) 5 ×(10 15 ) 8 =10 140 ≈2 465 , 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:

[0207] Table 1 Key space comparison table

[0208]

[0209] 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 the encryption algorithms proposed in references

[10] ,

[11] , and

[12] in terms of key space, and can better enhance the image encryption effect.

[0210] 3) Histogram analysis

[0211] 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.

[0212] from Figure 7 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.

[0213] 4) Information entropy analysis

[0214] 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.

[0215] 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:

[0216] Table 2 Information entropy comparison table

[0217]

[0218] It can be seen from Table 2 that compared with the encryption algorithms proposed in references

[13] ,

[14] , and

[15] , the information entropy of the algorithm of the present invention is closer to the ideal value of 8. Therefore, the encryption algorithm of the present invention has better image pixel scrambling effect and superior performance.

[0219] 5) Correlation analysis of adjacent pixels

[0220] 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 8 This 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:

[0221] Table 3 Comparison of adjacent pixel correlation coefficients

[0222]

[0223] Depend on Figure 8As 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.

[0224] 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 chaotic image encryption method based on improved Josephus transform and Knight's Tour joint 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; Will M × N The pixel matrix is ​​divided into several m × n The cell pixel matrix of is subjected to Josephus scrambling on each cell pixel matrix using the first set of chaotic pseudo-random integer sequences; Each cell pixel matrix after Josephus scrambling is regarded as a chessboard point. A starting point is randomly selected on the chessboard as the starting position of the Knight's Tour. The image is scrambled by the first set of chaotic pseudo-random integer sequences to obtain the scrambled 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 memristor chaotic system, a 、 b 、 p 、 q are the system parameters of the memristor chaotic system.

2. The chaotic image encryption method based on improved Josephus transform and Knight's Tour joint scrambling as claimed in 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 chaotic image encryption method based on improved Josephus transform and Knight's Tour joint scrambling as claimed in claim 2, characterized in that: The method of using the first set of chaotic pseudo-random integer sequences to perform Josephus scrambling on each cell pixel matrix is ​​as follows: First, perform Josephus row scrambling on the cell pixel matrix. The steps are as follows: Each row of the cell pixel matrix m Elements are arranged in a circle in order; The first set of chaotic pseudo-random integer sequences Substitute the following formula: ; Among them, mod represents the remainder function, s As the counting starting point for Josephus row scrambling of the cell pixel matrix; The first set of chaotic pseudo-random integer sequences Substitute the following formula: ; by p As the counting cycle of Josephus row scrambling of cell pixel matrix; The first set of chaotic pseudo-random integer sequences Substitute the following formula: ; by d As the counting direction of the Josephus row scrambling of the cell pixel matrix, when d = 1, count in clockwise direction; when d = 0, count in counterclockwise direction; Repeat the Josephus row scrambling of the cell pixel matrix until every row of the cell pixel matrix has been scrambled; Then perform Josephus column scrambling on the cell pixel matrix. The steps are as follows: Each column of the cell pixel matrix after Josephus row scrambling n Elements are arranged in a circle in order; The first set of chaotic pseudo-random integer sequences Substitute the following formula: ; by s As the counting starting point for Josephus row scrambling of the cell pixel matrix; The first set of chaotic pseudo-random integer sequences Substitute the following formula: ; by p As the counting cycle of Josephus column scrambling of cell pixel matrix; The first set of chaotic pseudo-random integer sequences Substitute the following formula: ; by d As the counting direction of the Josephus column scrambling of the cell pixel matrix, when d = 1, count in clockwise direction; when d = 0, count in counterclockwise direction; Repeat the Josephus column scrambling of the cell pixel matrix until every column of the cell pixel matrix has been scrambled.

4. The chaotic image encryption method based on improved Josephus transform and Knight's Tour joint scrambling as claimed in claim 2, characterized in that: The method of using the first set of chaotic pseudo-random integer sequences to perform Knight's Tour scrambling on an image is as follows: 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.

5. The chaotic image encryption method based on improved Josephus transform and Knight's Tour joint scrambling as claimed in 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 chaotic image encryption method based on improved Josephus transform and Knight's Tour joint scrambling as claimed in 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 chaotic image decryption method based on improved Josephus transform and Knight's Tour joint 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

  • Image encryption method based on improved magic cube transformation and memristor chaos

    CN113129195A

  • Method and system for generating an image and use thereof to encode and encrypt information

    WO2024089567A1