Cryptanalysis of an Image Encryption Algorithm Based on Two-Dimensional Hyperchaotic Map

This paper analyzes the security of an image encryption algorithm based on a two-dimensional hyperchaotic map. This encryption algorithm generated chaotic sequences through a combination of two one-dimensional chaotic maps and used them as the permutation and diffusion key. Then, the image was encrypted by using the structure of row–column permutation, forward-diffusion, and backward-diffusion. The proposer claimed that the above algorithm was secure. However, it was found through cryptanalysis that the algorithm cannot withstand the chosen plaintext attack. Although the forward-diffusion and backward-diffusion of the original algorithm use two different diffusion keys and there is a ciphertext feedback mechanism, the analysis of the diffusion by iterative optimization showed that it can be equivalent to global diffusion. In addition, the generation of chaotic sequences in the encryption process is independent of the plaintext image, so the equivalent diffusion and permutation key stream can be obtained by adjusting the individual pixel values of the chosen plaintexts. Aiming at the security loopholes in the encryption algorithm, the theoretical and experimental results are presented to support the efficiency of the proposed attack and suggestions for improvement are given. Finally, compared with the performance analysis of the existing cracking algorithm, our cryptanalysis greatly improved the cracking efficiency without increasing the complexity of the data.


Introduction
With the rapid development of computer and communication technology, multimedia information, such as images, has become the main carrier of network information with its characteristics of carrying large amounts of information. The following problem is how to ensure the security of image data in the process of transmission. In recent years, due to the ergodicity, unpredictability, and initial-value sensitivity of chaotic systems [1][2][3][4], people have combined them with cryptography and gradually applied them to the field of multimedia information security, which has improved the security of multimedia information transmission to a certain extent.
Since the permutation-diffusion encryption structure was proposed, researchers have designed many novel chaotic image encryption schemes based on this structure [5,6]. For example, DNA encoding and decoding technology combined with a chaotic system was used for image encryption [7][8][9][10]; chaotic image encryption schemes based on double S-boxes were proposed [11][12][13][14]; the image compression technology was applied to chaotic image encryption [15][16][17][18]. Furthermore, in addition to designing relatively new chaotic encryption algorithms, researchers are paying more and more attention to the security of the algorithm itself. Therefore, in order to resist various attacks, various methods have been proposed to improve the security of encryption algorithms [19][20][21][22]. In [23], a dynamic key chaotic image encryption algorithm related to the plaintext was proposed, which improved the plaintext sensitivity of the encryption algorithm. In [24], a chaotic system based on a PWLCM map and an image encryption algorithm of dynamic DNA were proposed, then the chaotic sequences were used to dynamically select corresponding DNA encoding and decoding rules, making the encryption process more flexible. In [25], an image encryption scheme based on the generalized Arnold transform and RSA algorithm was proposed, which improved security by introducing the RSA algorithm. Moreover, improving new chaotic systems is also a common means [26,27]. Neural networks have been favored by academia and industry because of the diversity of their dynamics. A chaotic image encryption algorithm improved by a neural network had strong practicability in the medical field [28,29]. No matter how complex the encryption algorithm is, its purpose is to combine the chaotic system to conduct a series of permutations and diffusions of image pixels to ensure the security of image transmission.
Currently, image encryption algorithms are also becoming more and more diversified. Cryptographic designers often claim that the proposed encryption algorithm has good security based on a series of statistical test results. However, strict cryptanalysis shows that some chaotic encryption algorithms still have certain security loopholes, causing them to be cracked by attackers [30][31][32][33]. In the process of analyzing the security of the encryption algorithm, attackers try various methods to crack the algorithm and gradually develop some classic cryptanalysis methods. In [34], an encryption scheme based on a random walk matrix and a hyperchaotic system was cracked by the chosen plaintext attack method, and relevant suggestions were given for its security loopholes to improve the anti-attack capability; in [35], an image encryption algorithm combining DNA coding and a spatiotemporal chaotic system was analyzed; its equivalent key can be obtained by the chosen ciphertext attack method according to its defects, and it recovered the plaintext image; in [36], when a chaotic image encryption algorithm based on information entropy was cryptanalyzed for the effectiveness of quantifiable security measures, the differential attack method can be used to recover the equivalent key of each basic operation of the encryption algorithm.
Among many cryptanalysis methods, the chosen plaintext attack is a commonly used method. For example, the equivalent key can be obtained by selecting the corresponding special plaintext in different encryption stages for the encryption scheme of a chaotic system combined with an image block, that is the whole encryption algorithm can crack the different stages one by one [37]. Aiming at the color image encryption scheme of chaos and DNA encoding, the chosen plaintext attack could also be used to disclose its equivalent secret key [38]. In 2022, an image encryption algorithm based on a two-dimensional hyperchaotic map was proposed [39]. The encryption algorithm included two rounds of permutation and two rounds of diffusion. The permutation key and diffusion key were generated through the new coupled two-dimensional hyperchaotic map. There was a ciphertext feedback mechanism in the two-round diffusion process. According to the statistical test results, the original paper claimed that the algorithm had high security. However, the loopholes in the encryption algorithm were analyzed, and the chosen plaintext attack was used to crack it; however, the efficiency of the cracking algorithm was very low, and it took nearly 2 h to crack a 256 × 256 image, which obviously does not meet the actual needs [40]. By analyzing the security loopholes of the original encryption algorithm, this paper proposes a new cracking method, which greatly improves the cracking efficiency without increasing the complexity of the data.
The rest of this paper is arranged as follows: Section 2 briefly describes the image encryption algorithm proposed in [39]. In Section 3, the original encryption algorithm is analyzed as a whole, and then, the plaintext attack method is used to crack its security. In Section 4, numerical simulation experiments are carried out based on the security analysis method proposed in this paper, and the attack complexity is discussed. Finally, improvement suggestions are given for the existing security loopholes. Section 5 compares the performance of the cracking algorithm in this paper with that in [40]. The last section summarizes the content of this paper.

Description of Original Image Encryption Algorithm
This section introduces the chaotic system used in the original encryption algorithm and its specific encryption process. In [39], an image encryption algorithm based on a two-dimensional hyperchaotic map was proposed. In the original encryption algorithm, a series of chaotic sequences was generated by given initial key parameters for subsequent encryption operations based on the proposed new two-dimensional hyperchaotic system. The modified chaotic sequences were firstly used to exchange the whole row and column of the pixel value of the image and, secondly, used to carry out forward-diffusion and backward-diffusion on the pixel values to achieve the combination of chaos and the encryption algorithm.

Description of the Original Encryption Algorithm
According to the original encryption algorithm in [39], the block diagram of image encryption is shown in Figure 1, and the detailed process is described in the following: (1) Selection of initial key parameters: According to Figure 1, the original encryption algorithm includes four initial key parameters, h, r, x(0), and y(0), and the values were taken as h = 5, r = 5, x(0) = 0.5, and y(0) = 0.5 for the image encryption.
(2) Generation of permutation index sequences: Substitute the initial key parameters into Equation (1)  Then, the first N sequences of the chaotic sequences X and Y are intercepted and quantified according to Equation (2) to obtain the permutation index sequences R = {r(i)} N i=1 and T = {t(i)} N i=1 for image row-column permutation.
where floor(·) represents the rounding-down operation, |·| represents the absolute operation, and mod represents the modular operation.
(3) Generation of diffusion matrix: Similarly, the chaotic sequences X and Y are quantified according to Equation (3) to obtain the integer sequences , which make the values in the range of [0, 255].
In order to facilitate subsequent diffusion operations, the sequences X g and Y g need to be written as matrices with the same size as the plaintext image matrix by scanning it in the raster order (from left to right and then from top to bottom). Finally, two diffusion matrices with a size of H × W are obtained, which are used for forward-diffusion and backward-diffusion, respectively.
(4) Encryption process: The gray image P with a size of H × W can be represented by a positive integer matrix with H rows and W columns, and its value range is [0, 255]. According to [39], the steps of the encryption algorithm are as follows: Step 1. Row-column permutation: For the permutation operation, the row permutation operation is carried out according to the previously generated sequences X and R, and the column permutation operation is carried out according to the sequences Y and T.
For the row permutation operation, from i = 1 to N, when x(i) ≥ 0, the r(i)-th row of the image matrix P is inserted into the (H − r(i) + 1)-th row, and the (r(i) + 1)th to the (H − r(i) + 1)-th rows are moved up one row as a whole; when x(i) < 0, the (H − r(i) + 1)-th row of the image matrix P is inserted into the r(i)-th row, and the r(i)-th to the (H − r(i))-th rows are moved down one row as a whole. The row permutation operation is repeated N times, and finally, the matrix B is obtained after row permutation.
For the column permutation operation, from i = 1 to N, when y(i) ≥ 0, the t(i)th column of the image matrix B is inserted into the (W − t(i) + 1)-th column, and the (t(i) + 1)-th to the (W − t(i) + 1)-th columns are shifted to the left as a whole; when y(i) < 0, the (W − t(i) + 1)-th column of the image matrix B is inserted into the t(i)-th column, and the t(i)-th to the (W − t(i))-th columns are shifted to the right as a whole. The column permutation operation is repeated N times, and finally, the matrix I is obtained after column permutation.
Step 2. Forward-diffusion and backward-diffusion: For the diffusion operation, the forward-diffusion is carried out according to the generated diffusion key D 1 , and S = {S(i, j)} H,W i=1,j=1 is the matrix after the forward-diffusion. According to the generated diffusion key D 2 , the backward-diffusion is carried out, and C = {C(i, j)} H,W i=1,j=1 is the matrix after the backward-diffusion. For the forward-diffusion, the following diffusion methods are adopted: where i = 1, 2, · · · , H and j = 1, 2, · · · , W.

Overall Analysis
In cryptanalysis, the entire encryption algorithm can be cracked if the initial key parameters or equivalent key are obtained. Generally, the difficulty of cracking the initial key parameters is greater than that of cracking the equivalent key. If only the equivalent key can be solved, there is no need to crack the initial key parameters, because this will not only increase the difficulty and workload of cracking, but may even fail to crack. For the open-loop system, the generation of the encryption sequence is independent of the plaintext, that is the equivalent key is independent of the plaintext. It only needs to crack the equivalent key, and the cracking is relatively simple; for the closed-loop system, the generation of the encryption sequence is related to the plaintext, that is the equivalent key is related to the plaintext, so that the encryption sequence corresponding to different plaintexts is different, and the plaintext is not known in advance, so cracking the equivalent key will lose its generality. In this case, only the initial key parameters can be cracked.
According to the block diagram of the encryption algorithm shown in Figure 1, the initial key parameters of the chaotic map are independent of the plaintext image. When the initial key parameters remain unchanged and different plaintext images are encrypted, the permutation sequences R and T used for the two rounds of row-column permutation and the two diffusion matrices D 1 and D 2 are all unchanged, so it is easy to find the equivalent permutation key and equivalent diffusion key of the original algorithm by the chosen plaintext attack, thus cracking the entire encryption algorithm, that is to say, by selecting some plaintext information P 1 , P 2 , · · · , P N and the corresponding ciphertext information C 1 , C 2 , · · · , C N that is beneficial to the cracking, then deducing the secret key or equivalent key (represented by the symbol K) according to the encryption algorithm E K through these plaintext-ciphertext pairs, or finding an algorithm to derive P N+1 from C N+1 = E K (P N+1 ).
The whole encryption process can be equivalent to a round of global permutation and a round of global diffusion through the equivalent permutation key and the equivalent diffusion key. As shown in Figure 2, P is the plaintext gray image, C is the final ciphertext image, I is the image after global permutation, K s is the equivalent permutation key, and K d is the equivalent diffusion key.
After the above analysis, the original encryption algorithm has some defects in its structure. As shown in Figure 2, the forward-diffusion process is preprocessed by iterative optimization, and the iterative results are substituted into the backward-diffusion process to find the relationship between the two rounds of diffusion, so the equivalent diffusion key stream can be obtained by adjusting the individual pixel values of the chosen plaintext to crack the entire diffusion process. Then, on the basis of this analysis, the chosen plaintext attack is also used to crack the two rounds of the permutation process. The whole encryption algorithm can be finally cracked by carrying out cryptanalysis on each process of encryption.

Pre-Analysis of Diffusion Process
According to the above overall analysis, the key to cracking the two-round diffusion process of the original encryption algorithm is to find the equivalent diffusion key and make it equivalent to one round of global diffusion. Therefore, this section mainly pre-analyzes the diffusion process. According to Equation (4), when 1 < i ≤ H and i < j ≤ W, the pixel value S(i, j) is related to S(i, j − 1) and S(i − 1, j). Considering the characteristics of this kind of matrix, the following propositions are given.  Figure 3a, that is where k and l represent the row number and column number in the matrix A, respectively. Then, the element value A(k, l) in the k-th row and l-th column of this matrix can be expressed as Since the distribution of element values in matrix A is symmetric, the element value A(k, l) in the k-th row and l-th column of the matrix is equal to the element value A(l, k) in the l-th row and k-th column of the matrix, namely (1) Each number in Pascal's triangle is equal to the sum of its left and right numbers in the previous line.
(2) The q-th number in row p of Pascal's triangle is equal to the (p − q + 1)-th number in row p. ( p−1 represents the operations of permutation and combination in mathematics, namely The positions referred to the above properties all correspond to the positions in Pascal's triangle. Therefore, in order to obtain each value in matrix A, the corresponding relationship between the values in matrix A and Pascal's triangle are required. Figure 4 shows the corresponding relationship between the values in matrix A and Pascal's triangle. The left side represents the position of each element in matrix A, and the right side corresponds to the row number of Pascal's triangle in Figure 4. Because the row and column descriptions of matrix A and Pascal's triangle are different in the analysis process, therefore, to show the difference, a( * , * ) is used to represent the element values in Pascal's triangle and A( * , * ) is used to represent the element values of matrix A. Analyzing the corresponding relationship in Figure 4, it is seen that the row number of Pascal's triangle corresponds to the sum of the row number and column number of the elements in matrix A. This sum is a fixed value. The corresponding fixed value of the first row of Pascal's triangle is (i + j), and then, as the row increases, the sum value will decrease gradually with a tolerance of 1, so the element at position (k, l) in matrix A is in row p (p = i − k + j − l + 1) of Pascal's triangle. The first element of the p-th row of Pascal's triangle is a(i − p + 1, j); the row number of the element a increases with a tolerance of 1, and the column number decreases with a tolerance of 1, Therefore, the element in the position (k, l) of the matrix A corresponds to the q-th (q = j − l + 1) position of Pascal's triangle. It can also be seen from the symmetry of Pascal's triangle that A(k, l) is also equal to the value of the (i − k + 1)-th position of the k-th row.
According to the one-to-one correspondence between the two positions in the above analysis and Property (3) of Pascal's triangle, substitute Proposition 1 is proven.

Proposition 2.
In the original encryption algorithm, the two-round diffusion encryption represented by the forward-diffusion encryption Equation (4) and the backward-diffusion encryption Equation (5) can be equivalent to one-round global diffusion encryption, namely where f 1 (I, i, j) represents the value related to plaintext image I, and its specific expression is as follows: represents the value related to the forward-diffusion key D 1 and the backward-diffusion key D 2 , and Proof. For the forward-diffusion process, Equation (4) is preprocessed step by step and iteratively: (1) When i = 1, j = 1, there is (2) When i = 1, j = 2, 3, · · · , W, there is (3) When i = 2, 3, · · · , H, j = 1, there is (4) When i = 2, 3, · · · , H, j = 2, 3, · · · , W, there is After substituting the expressions of S(i, j − 1) and S(i − 1, j), there is Arrange the pixel values in the same matrix into the same row: The constant coefficients corresponding to the pixel values of each position obviously meet the properties in Proposition 1, and the coefficients are replaced by the elements of Pascal's triangle: By analyzing the above iterative rule, the pixel value of matrix S(i, j) can be cyclically iterated to S(1, 1). According to the forward-diffusion formula, it can be known that S(1, 1) = mod(I(1, 1) + D 1 (1, 1), 256), so the pixel value of matrix S can be eliminated in the end, and the iteration is as follows: . At this point, the above equation can be summarized and simplified as follows: where C i−k i−k+j−l represents the constant coefficient of the pixel value. After the above preprocessing, the iterative result of the forward-diffusion process is determined by Equations (7)-(10), and the final iterative result is only associated with the plaintext image I and forward-diffusion key D 1 . For the convenience of further derivation and processing, it is suggested to uniformly set them as where f 1 (I, i, j) and f 2 (D 1 , i, j), respectively, represent the value related to the intermediate ciphertext image I and the value related to forward-diffusion key D 1 . Their specific expression is as follows: In order to obtain the equivalent diffusion key, it is also necessary to substitute the forward-diffusion process into the backward-diffusion process, analyze the relationship between them, and convert the two-round diffusion to the one-round diffusion. By substituting Equation (11) into Equation (5), the following formula can be obtained as The analysis of the above formula shows that, in the iterative process, the intermediate value S was eliminated, and the entire global diffusion process is only associated with plaintext image I, ciphertext image C, and the two-round diffusion keys D 1 and D 2 . Since D 1 and D 2 are constants, then f 2 (D 1 , i, j) + D 2 (i, j) is a constant. The related parts of the two-round diffusion keys D 1 and D 2 can be regarded as a whole, and the equivalent diffusion key K d = f 2 (D 1 , i, j) + D 2 (i, j), then Equation (14) can be simplified as According to the above analysis, there is an equivalent diffusion key K d , and Equation (15) clearly indicates that there is a fixed relationship between output C and input I through the equivalent diffusion key K d . Therefore, the two-round diffusion encryption represented by forward-diffusion encryption and backward-diffusion encryption in the original encryption algorithm can be equivalent to the one-round global diffusion encryption.

The Equivalent Diffusion Key
To further crack the diffusion process, the equivalent diffusion key K d of the diffusion process is reversely obtained according to Equation (15) as where i = H, H − 1, · · · , 1, j = W, W − 1, · · · , 1, and n ∈ N.
Further analysis shows that the equivalent diffusion key K d is subsequently used for backward-diffusion to obtain the plaintext image, which requires modulo to 256, so the influence of 256n can be ignored in Equation (16), namely where i = H, H − 1, · · · , 1 and j = W, W − 1, · · · , 1.
According to the above analysis, the algorithm to crack the equivalent diffusion key K d is shown in Algorithm 1.

Algorithm 1
The procedure of cracking the equivalent diffusion key K d .  for j = W − 1 to 1 do 12:

Cracking Diffusion Encryption Process Using Equivalent Diffusion Key
Based on the equivalent diffusion key K d , backward-diffusion is carried out according to Equation (15) and the intermediate ciphertext image before diffusion is reversely calculated. The process of backward-diffusion is as follows: where i = H, H − 1, · · · , 1, j = W, W − 1, · · · , 1, and n ∈ N.
Further analysis showed that, in order to offset the influence of 256n in Equation (19), the modulo method of 256 was also adopted to obtain the single pixel of the intermediate ciphertext image I. Therefore, Equation (19) can be simplified as follows: where i = H, H − 1, · · · , 1 and j = W, W − 1, · · · , 1.
According to Equation (20), the sum of pixels f 1 (I, i, j) related to the intermediate ciphertext image I before diffusion can be obtained by using the equivalent diffusion key K d for backward-diffusion. To recover the intermediate ciphertext image I before diffusion, the specific pixel value I(i, j) of each position of the image needs to be obtained. According to the previous analysis process, the relationship between the sum of pixels f 1 (I, i, j) related to the intermediate ciphertext and the pixel value I(i, j) of each position is determined by Equation (12). Now, Equation (12) is used to obtain the pixel value I(i, j) of the intermediate ciphertext. The process is as follows: (1) When i = 1, j = 1, there is (2) When i = 1, j = 2, 3, · · · , W, there is That is, when j = W, When 1 < j < W, (3) When i = 2, 3, · · · , H, j = 1, there is That is, when i = H, 2)), 256).
The pixel values I(i, j) of each position of the intermediate ciphertext image I can be determined according to Equations (21)- (24). However, when the sum of pixels f 1 (I, i, j) related to the intermediate ciphertext is obtained according to Equation (20), the influence of 256n is ignored for the convenience of calculation and derivation. Therefore, when restoring the pixel values at each position of the intermediate ciphertext, the modulo of 256 can be taken to offset the influence, and the range of each pixel value is guaranteed to be [0, 255]. When the value of P is determined, then I will be determined, and we can set the matrix . Therefore, the formula for calculating the pixel value I(i, j) of each position of the intermediate ciphertext image can be optimized as follows: where i = H, H − 1, · · · , 1, j = W, W − 1, · · · , 1, then without the help of the sum of pixels According to the above analysis process, the equivalent diffusion key K d is used to crack the diffusion encryption process, as shown in Algorithm 2.

Cracking the Permutation Process
On the basis of cracking the equivalent diffusion key K d , the structure of the tworound equivalent encryption algorithm shown in Figure 2 is degenerated to the one-round permutation encryption structure. It is noted that the two-round permutation encryption algorithm is only used to change the coordinate position of pixels without changing the pixel value at the coordinate position, which can be equivalent to one round of global permutation. Therefore, the equivalent permutation key K s can be solved with the help of the position difference of special plaintext-ciphertext pairs. According to the analysis, the chosen plaintext attack can be used to crack the equivalent permutation key K s , namely by constructing N c = log L (H × W) plaintext images and their corresponding ciphertext image, the symbol · indicates the rounding-up operation, H and W are the height and width of the plaintext image, respectively, L is the total number of pixel values of all possible plaintext images, and for the 8-bit plaintext image, L = 256.

The Construction Method of N c Plaintext Images
The steps of constructing N c plaintext images by the chosen plaintext attack are as follows: Step 1. Construct a special plaintext image Q = {Q(i, j)} H,W i=1,j=1 with the same size as the original plaintext image P = {P(i, j)} H,W i=1,j=1 , and write the non-negative integers 0, 1, 2, · · · , and H × W − 1 sequentially by scanning in the raster order (from left to right and top to bottom), that is the pixel value of the special plaintext image Q is Q(i, j) = (i − 1) × W + (j − 1), where i = 1, 2, · · · , H and j = 1, 2, · · · , W. Since the range of the pixel values is [0, L − 1], Q needs to be decomposed into N c sub-matrices with pixel values in the range of [0, L − 1].
Step 2. Calculate the number of special plaintext image required N c = log L (H × W) , and build N c special plaintext images as Q 1 , Q 2 , · · · , Q N c .
Step 3. The pixel values of N c plaintext images Q 1 , Q 2 , · · · , Q N c are written by using the constructed special plaintext image Q. According to the mode of raster scanning, the writing rule of the l-th plaintext image Q l is where l = 1, 2, · · · , N c , L = 256, and · represents the rounding-down operation.

The Equivalent Permutation Key
Based on the special plaintext image constructed in Section 3.3.1, the steps to crack the equivalent permutation key are as follows: Step 1. Create N c special plaintext images Q l = {Q l (i, j)} H,W i=1,j=1 (l = 1, 2, · · · , N c ) according to the method in Section 3.3.1. According to the chosen plaintext attack, these N c special plaintext images are encrypted, respectively, and the corresponding ciphertext is C l = {C l (i, j)} H,W i=1,j=1 (l = 1, 2, · · · , N c ).
Step 2. N c ciphertext images C l = {C l (i, j)} H,W i=1,j=1 (l = 1, 2, · · · , N c ) are processed by the equivalent diffusion key K d for backward-diffusion to offset the effect of diffusion encryption, and N c intermediate ciphertext images I l = {I l (i, j)} H,W i=1,j=1 (l = 1, 2, · · · , N c ) are obtained.
Step 4. By comparing the position difference with the same pixel value in the special plaintext matrix Q and the permutation-only matrix Q index , the equivalent permutation key of the global permutation encryption link can be obtained.
According to the above cracking steps, the detailed cracking process of equivalent permutation key K s is shown in Algorithm 3.

Cracking Permutation Encryption Process by Using Equivalent Permutation Key
Based on the equivalent permutation key K s obtained in Section 3.3.2, the two-round permutation process is equivalent to one round of global permutation, and the attacker can recover the corresponding plaintext image from any given permutation image on the premise of unknown key parameters. The specific process is shown in Algorithm 4.
According to the whole process of cryptographic security analysis, for a plaintext image with a size of H × W, using the chosen plaintext attack only requires 1 + log L (H × W) special plaintext images, and the corresponding ciphertext images can crack the encryption algorithm.

Experimental Results
The experimental hardware platform was a PC equipped with an Intel(R) Core(TM) i7 processor; the main frequency was 2.59 GHz; the memory (RAM) was 16 GB; the operating system was the Windows10 Professional 64-bit operating system; the software was MATLAB R2020a. In order to be consistent with the experiment of the original encryption algorithm on the dataset, the key parameters were selected from the original encryption algorithm, namely h = 5, r = 5, x(0) = 0.5, and y(0) = 0.5. Meanwhile, the same images from the USC-SIPI image database [39] were selected in the experiment. Here, two plaintext gray images, 5.1.09 and 5.1.10, with a size of 256 × 256, were selected as the test images. In order to facilitate a unified description, they were named according to the Description in the image database, namely Moon surface and Aerial. In addition, in order to verify the reliability of the cracking algorithm in this paper, test diagrams of different sizes should be selected. In this paper, Lena and cameraman with a size of 512 × 512 were selected for the experimental testing.

Experimental Results of Cracking Image by Chosen Plaintext Attack
According to the chosen plaintext attack method proposed in this paper, numerical experiments were carried out on the plaintext images with different sizes of 256 × 256 and 512 × 512. First of all, for the diffusion process, no matter how big the image size is, according to the analysis, it only needs to select an all-zero plaintext image P 0 = {P 0 (i, j)} H,W i=1,j=1 = 0 and obtain its corresponding ciphertext image through encryption, as shown in Figure 5. Secondly, for the permutation process, according to the special plaintext construction method proposed in Section 3.3.1, for images with a size of 256 × 256, the number of plaintexts to be constructed is N c = log 256 (256 × 256) = 2. Therefore, to crack the permutation process of images with a size of 256 × 256, it is necessary to select two special plaintext images Q 1 and Q 2 and obtain their corresponding ciphertext images C 1 and C 2 through encryption, as shown in Figure 6. For a 512 × 512 image, the number of plaintexts that need to be constructed is N c = log 256 (512 × 512) = 3. Therefore, to crack the permutation process of 512 × 512 images, three special plaintexts Q 3 , Q 4 , and Q 5 need to be selected, whose corresponding ciphertext is C 3 , C 4 , and C 5 , as shown in Figure 7. Finally, the equivalent permutation key and equivalent diffusion key were used to crack and recover the plaintext image from the ciphertext image. For the plaintext gray images Moon surface and Aerial with a size of 256 × 256, the test results are shown in Figure 8. This includes the original gray image, the ciphertext image, the permutation-only image after cracking the diffusion process, and the equivalent cracking plaintext image. For the plaintext gray images Lena and cameraman with a size of 512 × 512, the corresponding plaintext image can also be completely recovered from the ciphertext image. The results of the cracking test are shown in Figure 9, including the original gray image, the ciphertext image, the permutation-only image after the cracking diffusion process, and the equivalent cracked plaintext image.

Suggestions for Improvement
According to the security analysis of this paper, the original encryption algorithm had security defects and could not withstand the chosen plaintext attack. The following suggestions are given to fix the loopholes of the original encryption algorithm in the process of cryptanalysis: (1) The two-round diffusion process should avoid operation composition. The iterative analysis process of forward-diffusion and backward-diffusion is actually the process of operation compounding, which makes the two rounds of diffusion able to be equivalent to one round of global diffusion, and its equivalent diffusion key can be cracked by the analysis of only one plaintext image. In the design process of the encryption algorithm, the operation compounding should be avoided, so as to avoid the invalidation of the round number for diffusion.
(2) The permutation and diffusion structure of the original algorithm should be improved. Although the permutation and diffusion processes of the original encryption algorithm are relatively complex, the structure of the whole encryption algorithm is relatively simple, which makes the whole structure equivalent to a single-round permutation-diffusion structure. It is suggested to improve the complexity of the algorithm structure to make all parts closely connected, thereby improving the security of the encryption algorithm.

Comparison and Performance Analysis of Cracking Algorithms
According to the previous analysis, the attack method proposed in this paper can efficiently and quickly obtain the equivalent key and then effectively crack the original encryption algorithm. This paper made a comprehensive comparison of the chosen plaintext attack methods proposed in [40] and analyzed the differences in their performance.

Comparison of Cracking Diffusion Processes
In [40], for the diffusion part, according to the similarity of the two rounds of the diffusion formula structure, a conclusion is given: the pixel value after diffusion was obtained modulo 256 by the sum of the pixel value before diffusion and the element value of the equivalent key matrix, that is where f p (i, j) represents the variable related to the plaintext and its position and K(i, j) represents the equivalent diffusion key related to the diffusion key. According to Equation (28), all the values related to the diffusion key in the two-round diffusion formula can be extracted and made uniformly equivalent with an equivalent diffusion key. In this case, there is no quantity related to the diffusion key in the two-round diffusion formula, so the two-round diffusion process will be weakened into an ordinary equation operation. The diffusion formula after weakening is as follows.
According to the above analysis, the whole diffusion process can be equivalent to the structure shown in Figure 10. The equivalent processing method is obviously different from the equivalent processing method used in this paper. The equivalent structure in this paper is shown in Figure 2. The above equivalent processing method skillfully utilizes the similarity of the structure of the two rounds of diffusion formulas and combines the properties of the mathematical operations to extract the two diffusion keys into an equivalent diffusion key K, so as to crack the original encryption algorithm. However, if the structure of the two-round diffusion formula is not similar, the method will fail, so it is not universal. The method proposed in this paper does not need to extract the two equivalent keys, but combines the two rounds of the diffusion process by eliminating the intermediate ciphertext S, which is equivalent to the classical round of the permutation-diffusion structure, and the analysis of this kind of encryption algorithm can be widely applied.

Comparison of Cracking Permutation Process
In [40], the method of the chosen plaintext attack was adopted for the cracking of the permutation process. Firstly, according to the analysis, it can be known that, for an image with a size of H × W and the same L different pixel values, N c ≥ log L (H × W) special plaintext-ciphertext pairs are required to obtain the equivalent diffusion key.
In order to illustrate the above process of selecting special information to crack the permutation key, a 2 × 2 matrix is used to demonstrate the process of obtaining the equivalent permutation key.
For the case of H = W = L = 2, a matrix with element values increasing from 0 should be constructed according to the L-base (binary here), then decomposed into N c special plaintext bit by bit. The corresponding ciphertext images should be obtained by permutation encryption, and the pixel values in plaintext-ciphertext pairs before and after permutation encryption are compared. Analyze and judge the possible source of pixel value of each position. Finally, it is necessary to take the intersection of all possible situations in the N c matrix to obtain the equivalent permutation key.
The above method to crack the equivalent permutation key has a big defect. When comparing the pixel values in plaintext-ciphertext pairs before and after permutation encryption and analyzing and determining the possible source of the pixel value at each position, all pixels of the entire image matrix need to be traversed repeatedly, which requires a large amount of memory resources and consumes a long time, which greatly reduces the entire cracking efficiency. According to the simulation experiment results in [40], it takes nearly 2 h to crack images with a size of 256 × 256, and the time consumed increases exponentially with the increase of the image size.
In contrast, with the method proposed in this paper, it is unnecessary to repeatedly traverse all the pixel values in the image, so the equivalent permutation key can be obtained efficiently without increasing the number of special plaintexts, and it only takes 0.63178 s to crack an image of size 256 × 256, while it takes 8.03338 s to crack an image of size 512 × 512. The performance of the proposed attack method has higher superiority.

Comparison of Attack Complexity
The attack complexity mainly includes the time complexity and the data complexity. The following is a comparison of cracking methods from these two aspects.
In terms of the data complexity, according to the attack method proposed in this paper, the number of plaintext-ciphertext pairs required to crack the entire encryption algorithm is 1 + log 256 (H × W) , while the attack method in [40] requires at least the same number of plaintext-ciphertext pairs. Therefore, the data complexity of both decoding algorithms is O(log(H × W)).
In terms of the time complexity, according to the test for pictures of different sizes in [40], the same tests were also conducted for the cracking algorithm proposed in this paper. For the convenience of comparison, the test images in the USC-SIPI image dataset provided in [40] were uniformly used. In addition, in order to ensure the accuracy of the data, the experimental data in [40] are directly quoted here. At the same time, the experimental hardware platform with the same configuration (equipped with an Intel (R) Core (TM) i7 processor; the main frequency was 2.59 GHz; the memory was 16 GB) was used to crack images of different sizes many times, and multiple sets of test results were obtained. Finally, the average value of the test results was taken as the final test results. The running time is shown in Table 1. The broken line graphs in Figure 11, respectively, show the growth trend of the running time of the two cracking methods. With the increase of the size of the test image, the running time of both cracking algorithms grew. However, the running time of this paper was generally far lower than that of the cracking algorithm in [40]. Therefore, the cracking algorithm proposed in this paper had a high running efficiency and could recover the plaintext image at a very fast speed without increasing the data complexity.
(a) (b) Figure 11. The running time of the two cracking algorithms: (a) the cracking algorithm in [40] ; (b) our cracking algorithm.

Conclusions
In this paper, the security of an image encryption algorithm based on a two-dimensional hyperchaotic map was analyzed in detail. Through the security analysis, it was found that the encryption algorithm cannot withstand the chosen plaintext attack. The key used in the two-round permutation and two-round diffusion of the original encryption algorithm was independent of the plaintext image. Through further theoretical derivation and analysis, it was found that there was an equivalent key for this algorithm structure, which can be simplified into the one-round global permutation and one-round global diffusion structure. Therefore, the method of the chosen plaintext attack was proposed to crack the algorithm. Theoretical analysis and numerical simulation results showed that, according to the chosen plaintext attack method proposed in this paper, for the plaintext gray image with a size of H × W, only 1 + log 256 (H × W) special plaintext images and their corresponding ciphertext images needed to be selected to obtain the equivalent permutation and diffusion key, so as to realize the cracking of the original encryption algorithm. In the analysis method of this paper, the number of special plaintext images needed to crack the original encryption algorithm was small, and the attack complexity was not high, while the effectiveness of the attack algorithm was verified by the simulation test. Compared with the existing cracking algorithms, the chosen plaintext attack method in this paper consumed less time and was more efficient in cracking the original encryption algorithm without increasing the data complexity.