# A Hyperchaotic Color Image Encryption Algorithm and Security Analysis

Authors: Chenghai Li; Fangzheng Zhao; Chen Liu; Lei Lei; Jie Zhang
Journal: Security and Communication Networks
 (2019)

---

## Abstract

The current common color image encryption algorithms applying “scrambling-diffusion” have some problems, such as the small key space, the cumbersome encryption process, and the security vulnerability. Aiming at these problems, this paper proposes a new color image encryption algorithm based on the hyperchaotic system and applying “transforming-scrambling-diffusion” model. Before scrambling, in accordance with the plaintext itself attributes, the number of iterations was calculated, all the pixel values of color image were transformed into gray code iteratively, and then the chaotic sequence was generated from the four-dimensional hyperchaotic system. Pixel matrix after gray code transformation was converted to one-dimensional matrix. The chaotic sequence was sorted and the one-dimensional matrix was changed positions correspondingly to complete the whole domain scrambling. And then, bit-operation was executed for image diffusion. The ciphertext can be obtained by matrix transformation. The key sensitivity, histogram, information entropy, correlation, and other evaluation indexes were calculated and analyzed through the simulation experiment. Compared with other algorithms, it can be proved that the encryption algorithm has the strong antiattack ability.


---

## Body

## 1. Introduction

With the rapid development of multimedia information industry, the security requirements of information are gradually improved [1]. In multimedia security, image encryption is playing a more and more essential role and has become one of hot issues in military, medical, meteorological, and other fields [2]. Due to the strong initial value and parameter sensitivity, chaotic systems which show good randomness have been widely used in image encryption [3]. Karan Nair, Janhavi Kulkarni et al. proposed an image encryption using logistic and rectangular chaotic maps [4]. However, the process of the algorithm was quite simple which resulted in the ciphertext distribution not being uniform which made it difficult to resist statistical attacks. Abbas A. M. proposed an image encryption algorithm, based on independent component analysis and Arnold’s Cat Map [5], which was easy to be realized and provide an effective and safe way for image encryption. However, only square images could be encrypted in this algorithm; the range of application was remarkably restrained. Ran Wei et al. proposed an image encryption algorithm combining DNA encoding and various chaotic maps [6]. The simulation experiments showed that the sensitivity of plaintext and keys and the scramble effect could be greatly enhanced. But the process was complex and the requirements to hardware were comparatively high. Besides, compared with low-dimensional chaos, high-dimensional chaos has stronger dynamic characteristics and randomness. Nazira Shaikh, Santosh Chapaneri et al. proposed a single round color image encryption scheme based hyperchaotic system [7], and Chai Xiuli et al. proposed a color image encryption algorithm based on Chen's hyperchaotic system [8]; both algorithms achieved good encryption results. This paper proposes a new color image encryption algorithm based on four-dimensional hyperchaotic system and improved encryption process. This algorithm was different from the traditional “scrambling-diffusion” encryption mode. Before scrambling, the pixel values were firstly converted into gray codes. On that basis, a new “transformation-scrambling-diffusion” mode was formed that can expand the key space and improve the security of encryption. During the scrambling process, the global pixel positions were scrambled according to the chaotic sequence generated by the hyperchaotic system. The scrambling procedure can reduce the correlation of adjacent elements and each color component. The scrambled sequences and chaotic sequences were bitwise manipulated to complete image diffusion. After the whole encryption process was iterated, the ciphertext image would be obtained by matrix transformation. With this algorithm, the security and cryptography characteristics of the encrypted color image were improved.


## 2. Hyperchaotic System

The equation of state of the 4-dimensional autonomous hyperchaotic system used in this paper is [9](1)x˙=ay-xy˙=bx-xz-uz˙=-cz+xyu˙=mx+ywherex,y,z, andu are the state variables of system (1) and a,b,c, and m are the real value parameters. The dynamic characteristics of the chaotic system depend on the change of parameters above all. When a=33.4,b=33.6,c=2.3, and m=9.1, chaotic attractors exist in system (1), as shown in Figure 1.Figure 1
Chaotic attractors of system (1).
(a)
x-y-z (b)
x-uCompared with low-dimensional chaotic systems, high-dimensional hyperchaotic systems have more complex phase space and dynamic characteristics. At this time, system (1) has no less than two positive Lyapunov exponentials; thus it has hyperchaotic characteristics [10]. The randomness of the system is greatly increased [11] which means it has a better performance in color image encryption.


## 3. Image Encryption and Decryption Algorithm

The common image encryption algorithms mostly apply the model of “scrambling-diffusion” [12, 13]. Before scrambling, this algorithm firstly converts the pixel value of the image into gray code to expand the key space and improve the security.


### 3.1. Gray Code Conversion

Gray code is a typical binary communication coding format [14]. Its encoding rule is that there is only one-bit difference between two adjacent codes. The method of converting the natural binary code of bit j into a typical gray code is as follows:(2)Gi=Bii=j-1Gi=Bi+1⨁Bi0≤i<j-1Among them,Gi is typical gray code and Bi is natural binary code of the ith; ⨁ means exclusive or (XOR) operation. The method to convert a typical n-bit gray code into a natural binary code is as follows:(3)Bi=Gii=N-1Bi=Gi⨁Bi+10≤i<N-1In this algorithm, the first encrypted gray code iteration conversion times are calculated according to the size of the color imager0:(4)r0=modL+W,7+1whereL and W represent the length and width in pixels.


### 3.2. Position Scrambling

Based on the chaotic sequence generated by hyperchaotic system, this algorithm can scramble the pixel positions of n-by-m color images. The steps of pixel position scrambling are as follows:(1)
According to the given system parametersa,b,c,m and initial values x0,y0,z0,u0, Runge-Kutta algorithm is used to iterate the chaotic system (1), and the four chaotic real value sequences of x,y,z, and u were obtained.(2)
Four chaos real value sequences are converted into a one-dimensional matrix. To reduce the impact of the initial value on the system, the previousn0 results are given up and a one-dimensional chaos sequence Ci could be generated (i=1,2,…,N×M×3),(5)n0=R-+G-+B-×r0Among them,R-, G-, and B- are the average pixel values of three-color components and[·] represents the fetch operation.(3)
3D matrix which has been converted to gray code is converted to a one-dimensional matrixPi; then, the one-dimensional chaotic matrix Ci in step (2) is sorted and Pi changes positions synchronously. This step completes the whole-field pixel scrambling.For color images, there is a strong correlation between adjacent pixels and each color component. The whole-field pixel scrambling method not only disrupts the correlation between adjacent pixels, but also changes the correlation among R, G, and B color components to achieve a better scrambling effect. Although the histogram statistics of each color component have changed to some extent, the histogram statistics of the image as a whole have not been changed. The histogram statistics of each component are not uniform; hence the further encryption is still needed.


### 3.3. Value Diffusion

In order to improve the security of image encryption, especially to equalize the histogram and hide the statistical information of plaintext, this algorithm uses the sequence generated by hyperchaotic system to diffuse the pixel value of image. The hyperchaotic sequence transforming into one dimension is discretized as follows to obtain the key flowDi:(6)Di=modroundabsCi,256The matrix generated by the XOR operation of scrambled image sequence with the key flowDi is converted as the final output sequence.Decryption algorithm is the inverse process of encryption algorithm, decryption image can be obtained by the whole decryption process according to the key:r,a,b,c,m,x0,y0,z0, and u0.


## 3.1. Gray Code Conversion

Gray code is a typical binary communication coding format [14]. Its encoding rule is that there is only one-bit difference between two adjacent codes. The method of converting the natural binary code of bit j into a typical gray code is as follows:(2)Gi=Bii=j-1Gi=Bi+1⨁Bi0≤i<j-1Among them,Gi is typical gray code and Bi is natural binary code of the ith; ⨁ means exclusive or (XOR) operation. The method to convert a typical n-bit gray code into a natural binary code is as follows:(3)Bi=Gii=N-1Bi=Gi⨁Bi+10≤i<N-1In this algorithm, the first encrypted gray code iteration conversion times are calculated according to the size of the color imager0:(4)r0=modL+W,7+1whereL and W represent the length and width in pixels.


## 3.2. Position Scrambling

Based on the chaotic sequence generated by hyperchaotic system, this algorithm can scramble the pixel positions of n-by-m color images. The steps of pixel position scrambling are as follows:(1)
According to the given system parametersa,b,c,m and initial values x0,y0,z0,u0, Runge-Kutta algorithm is used to iterate the chaotic system (1), and the four chaotic real value sequences of x,y,z, and u were obtained.(2)
Four chaos real value sequences are converted into a one-dimensional matrix. To reduce the impact of the initial value on the system, the previousn0 results are given up and a one-dimensional chaos sequence Ci could be generated (i=1,2,…,N×M×3),(5)n0=R-+G-+B-×r0Among them,R-, G-, and B- are the average pixel values of three-color components and[·] represents the fetch operation.(3)
3D matrix which has been converted to gray code is converted to a one-dimensional matrixPi; then, the one-dimensional chaotic matrix Ci in step (2) is sorted and Pi changes positions synchronously. This step completes the whole-field pixel scrambling.For color images, there is a strong correlation between adjacent pixels and each color component. The whole-field pixel scrambling method not only disrupts the correlation between adjacent pixels, but also changes the correlation among R, G, and B color components to achieve a better scrambling effect. Although the histogram statistics of each color component have changed to some extent, the histogram statistics of the image as a whole have not been changed. The histogram statistics of each component are not uniform; hence the further encryption is still needed.


## 3.3. Value Diffusion

In order to improve the security of image encryption, especially to equalize the histogram and hide the statistical information of plaintext, this algorithm uses the sequence generated by hyperchaotic system to diffuse the pixel value of image. The hyperchaotic sequence transforming into one dimension is discretized as follows to obtain the key flowDi:(6)Di=modroundabsCi,256The matrix generated by the XOR operation of scrambled image sequence with the key flowDi is converted as the final output sequence.Decryption algorithm is the inverse process of encryption algorithm, decryption image can be obtained by the whole decryption process according to the key:r,a,b,c,m,x0,y0,z0, and u0.


## 4. Simulation Experiment

In this experiment, color image “lena.jpg” of size 256 by 256 was selected as the encrypted plaintext image. The parameter values of the four-dimensional hyperchaotic system (1) were a=33.4,b=33.6,c=2.3, and m=9.1, and the initial values were x0=6.2,y0=7.5,z0=19.7, and u0=16.3. The total number of iterations in the image encryption process is t=5. According to (4) and (5), the first round of encryption, and the times of gray code conversion of iterations is r0=2 and the selection of chaotic sequence starts from n0=768. In each subsequent iteration, ri=ri-1+1,ni=ni-1+ri2.The encryption key includes a,b,c,m,x0,y0,z0,u0,t, and n0; the decryption key is the same as the encryption key. The encryption and decryption results of the image are shown in Figure 2. The ciphertext image is disordered and the decrypted image is exactly the same as the plaintext image.Figure 2
Plaintext, ciphertext, and decrypted image.
(a)
Plaintext (b)
Ciphertext (c)
Decrypted image


## 5. Analysis of Simulation Results

### 5.1. Key Sensitivity

To detect the key sensitivity of the algorithm, only one key was changed during decryption. The initial value of the chaotic system, the number of iterations and the order number selected at the beginning of the chaotic sequence are changed, respectively, and slightly. In proper order, letu0=16.3000001, t=6, and n0=769; the decrypted images are shown in Figure 3.Figure 3
3 Error decrypted images.
(a)
u 0 = 16.3 000001 (b)
t = 6 (c)
n 0 = 76 9Although only one key was changed imperceptibly during every round, the ciphertext could not be decrypted precisely, therefore, this algorithm can be proved to have a strong key sensitivity.


### 5.2. Histogram

Histogram shows the frequency of different pixel values appearing in images. It has been widely used in image retrieval, classification, and other fields [15]. One of the aims of image encryption is to increase the difficulty of extracting image histogram features by histogram equalization or generalization [16]. The histograms of the images before and after encryption are shown in Figure 4.Figure 4
Histogram of plaintext and ciphertext.
(a)
Plaintext-R (b)
Plaintext-G (c)
Plaintext-B (d)
Ciphertext-R (e)
Ciphertext-G (f)
Ciphertext-BThe histogram of color components tends to be uniform distribution, which is completely different from the plaintext distribution. Figure4 shows that the transformation-scrambling-diffusion mode of the algorithm has good scrambling and statistical characteristics and meets the requirements of image encryption.


### 5.3. Relevance of Adjacent Elements

There is often a high correlation between adjacent pixels in plaintext which is the inherent feature of the image. Therefore, the encryption algorithm should try to reduce the correlation between adjacent pixels. In this paper, 10,000 pixels are randomly extracted from plaintext and ciphertext. The correlation coefficients in horizontal, vertical, and diagonal directions are calculated according to the following equations:(7)Ex=1N∑i=1Nxi(8)Dx=1N∑i=1Nxi-Ex2(9)covx,y=1N∑i=1Nxi-Exyi-Ey(10)rxy=covx,yDxDyxand y represent the pixel values of the two adjacent pixels, and rxy is the correlation coefficient. The results are shown in Table 1.Table 1
Adjacent element correlation.
Correlation Coefficient Horizontal Vertical Diagonal Plaintext 0.9372 0.9458 0.9681 Ciphertext 0.0013 0.0015 -0.0024 Ciphertext [17] -0.0102 0.0076 -0.0153 Ciphertext [18] 0.0129 0.0065 0.0013 Ciphertext [19] 0.0034 0.0050 0.0056 Ciphertext [20] 0.0173 -0.0112 -0.01252500 pixels were randomly selected from the three primary color components of the original image and the encrypted image, respectively. The element distribution in the diagonal direction is shown in Figure5.Figure 5
Correlation of pixel components in the diagonal direction of plaintext and ciphertext.
(a)
Plaintext-R (b)
Plaintext-G (c)
Plaintext-B (d)
Ciphertext-R (e)
Ciphertext-G (f)
Ciphertext-BAdjacent elements of plaintext images tend to have a strong correlation, and the distribution of elements and their adjacent elements is concentrated aroundx=y, as shown in Figures 5(a)–5(c). The scrambling and diffusion operation are aimed at reducing this correlation, which is shown as nearly uniform distribution in the region [0,255], as shown in Figures 5(d)–5(f).In fact, pixel values at the same relative position of different color components in color images are often highly correlated. Therefore, in the process of color image encryption, attention should be paid to reducing the correlation between pixel values at the same relative position of different components.Some random points are randomly selected in plaintext and ciphertext. The pixel values of the three-color components R, G, and B represent the X, Y, and Z axis coordinates, the adjacent elements in the diagonal direction are plotted as the relationship diagram of the adjacent elements. The scatter diagram is shown in Figure6, where the red points are the selected random points and the blue points are the pixels in the diagonal direction of the random points. For color plaintext images, the pixel values of components at the same relative position are highly correlated; as shown in Figure 6(a), the scattered points are distributed centrally around the line x=y=z, and the overlap degree between red and blue points is high; in Figure 6(b), the scattered points selected from ciphertext are randomly distributed in space and the overlap degree is low. As can be seen from Figure 6, plaintext images show obvious characteristics of centralized distribution, while ciphertext images show strong randomness.Figure 6
RGB components are represented by the distribution of adjacent elements diagonally.
(a)
Plaintext-diagonal (b)
Ciphertext-diagonalTable1 and Figures 5 and 6 show that this encryption algorithm has good diffusion characteristics.


### 5.4. Robustness

In the process of image transmission or decoding, pepper and salt noise, Gaussian noise, and other noises as well as image clipping are often generated [21]. Therefore, the image encryption and decryption algorithm should adapt to clipping and noise to a certain extent. Figure 7 shows the images decrypted after a 1/4 clipping, adding 0.20 pepper noise, 0.1 Gaussian noise, Poisson noise, and speckle noise.Figure 7
Decrypted images of 1/4 clipping and noises.
(a)
1/4 tailoring (b)
0.20 pepper noise (c)
0.1 Gaussian noise (d)
Poisson noise (e)
Speckle noise (f)
Decryption (a) (g)
Decryption (b) (h)
Decryption (c) (i)
Decryption (d) (j)
Decryption (e)According to Figure7, ciphertexts have been recovered well and plaintext information can be basically restored. Figure 7 indicates that this algorithm has good robustness.


## 5.1. Key Sensitivity

To detect the key sensitivity of the algorithm, only one key was changed during decryption. The initial value of the chaotic system, the number of iterations and the order number selected at the beginning of the chaotic sequence are changed, respectively, and slightly. In proper order, letu0=16.3000001, t=6, and n0=769; the decrypted images are shown in Figure 3.Figure 3
3 Error decrypted images.
(a)
u 0 = 16.3 000001 (b)
t = 6 (c)
n 0 = 76 9Although only one key was changed imperceptibly during every round, the ciphertext could not be decrypted precisely, therefore, this algorithm can be proved to have a strong key sensitivity.


## 5.2. Histogram

Histogram shows the frequency of different pixel values appearing in images. It has been widely used in image retrieval, classification, and other fields [15]. One of the aims of image encryption is to increase the difficulty of extracting image histogram features by histogram equalization or generalization [16]. The histograms of the images before and after encryption are shown in Figure 4.Figure 4
Histogram of plaintext and ciphertext.
(a)
Plaintext-R (b)
Plaintext-G (c)
Plaintext-B (d)
Ciphertext-R (e)
Ciphertext-G (f)
Ciphertext-BThe histogram of color components tends to be uniform distribution, which is completely different from the plaintext distribution. Figure4 shows that the transformation-scrambling-diffusion mode of the algorithm has good scrambling and statistical characteristics and meets the requirements of image encryption.


## 5.3. Relevance of Adjacent Elements

There is often a high correlation between adjacent pixels in plaintext which is the inherent feature of the image. Therefore, the encryption algorithm should try to reduce the correlation between adjacent pixels. In this paper, 10,000 pixels are randomly extracted from plaintext and ciphertext. The correlation coefficients in horizontal, vertical, and diagonal directions are calculated according to the following equations:(7)Ex=1N∑i=1Nxi(8)Dx=1N∑i=1Nxi-Ex2(9)covx,y=1N∑i=1Nxi-Exyi-Ey(10)rxy=covx,yDxDyxand y represent the pixel values of the two adjacent pixels, and rxy is the correlation coefficient. The results are shown in Table 1.Table 1
Adjacent element correlation.
Correlation Coefficient Horizontal Vertical Diagonal Plaintext 0.9372 0.9458 0.9681 Ciphertext 0.0013 0.0015 -0.0024 Ciphertext [17] -0.0102 0.0076 -0.0153 Ciphertext [18] 0.0129 0.0065 0.0013 Ciphertext [19] 0.0034 0.0050 0.0056 Ciphertext [20] 0.0173 -0.0112 -0.01252500 pixels were randomly selected from the three primary color components of the original image and the encrypted image, respectively. The element distribution in the diagonal direction is shown in Figure5.Figure 5
Correlation of pixel components in the diagonal direction of plaintext and ciphertext.
(a)
Plaintext-R (b)
Plaintext-G (c)
Plaintext-B (d)
Ciphertext-R (e)
Ciphertext-G (f)
Ciphertext-BAdjacent elements of plaintext images tend to have a strong correlation, and the distribution of elements and their adjacent elements is concentrated aroundx=y, as shown in Figures 5(a)–5(c). The scrambling and diffusion operation are aimed at reducing this correlation, which is shown as nearly uniform distribution in the region [0,255], as shown in Figures 5(d)–5(f).In fact, pixel values at the same relative position of different color components in color images are often highly correlated. Therefore, in the process of color image encryption, attention should be paid to reducing the correlation between pixel values at the same relative position of different components.Some random points are randomly selected in plaintext and ciphertext. The pixel values of the three-color components R, G, and B represent the X, Y, and Z axis coordinates, the adjacent elements in the diagonal direction are plotted as the relationship diagram of the adjacent elements. The scatter diagram is shown in Figure6, where the red points are the selected random points and the blue points are the pixels in the diagonal direction of the random points. For color plaintext images, the pixel values of components at the same relative position are highly correlated; as shown in Figure 6(a), the scattered points are distributed centrally around the line x=y=z, and the overlap degree between red and blue points is high; in Figure 6(b), the scattered points selected from ciphertext are randomly distributed in space and the overlap degree is low. As can be seen from Figure 6, plaintext images show obvious characteristics of centralized distribution, while ciphertext images show strong randomness.Figure 6
RGB components are represented by the distribution of adjacent elements diagonally.
(a)
Plaintext-diagonal (b)
Ciphertext-diagonalTable1 and Figures 5 and 6 show that this encryption algorithm has good diffusion characteristics.


## 5.4. Robustness

In the process of image transmission or decoding, pepper and salt noise, Gaussian noise, and other noises as well as image clipping are often generated [21]. Therefore, the image encryption and decryption algorithm should adapt to clipping and noise to a certain extent. Figure 7 shows the images decrypted after a 1/4 clipping, adding 0.20 pepper noise, 0.1 Gaussian noise, Poisson noise, and speckle noise.Figure 7
Decrypted images of 1/4 clipping and noises.
(a)
1/4 tailoring (b)
0.20 pepper noise (c)
0.1 Gaussian noise (d)
Poisson noise (e)
Speckle noise (f)
Decryption (a) (g)
Decryption (b) (h)
Decryption (c) (i)
Decryption (d) (j)
Decryption (e)According to Figure7, ciphertexts have been recovered well and plaintext information can be basically restored. Figure 7 indicates that this algorithm has good robustness.


## 6. Antiattack Analysis

### 6.1. Antiexhaustive Attack

This algorithm is based on gray code and hyperchaos system of 4D. Parameters, initial value, the number of iterations, and image size are the encryption key. When the precision is set to 1014, key space would be more than 1086. According to the current calculation conditions, when the key space is larger than 2128, ciphertext images can effectively resist violent attacks. The key space of this algorithm far exceeds this standard [22]. Thereunder, the key space of this encryption algorithm can effectively resist exhaustive attack.


### 6.2. Antientropy Attack

Image information entropy is used to represent the aggregation feature of image pixel value distribution [23]. The calculation method is as follows:(11)H=-∑i=0255pilog2⁡pip ( i ) is the frequency of each greyscale. This equation is mainly used to calculate the information entropy of gray image. In this paper, the calculation method of the information entropy of color image is defined as follows:(12)H=13∑Hkk ∈ { R , G , B } and Hk represents the information entropy of each color component of RGB.According to Table2, by comparing the information entropy of plaintext, ciphertext of this algorithm, and ciphertext image of [4, 17, 20, 24], it can be concluded that the information entropy value of the encrypted image of this algorithm is closer to the ideal value 8 which means that the encrypted image is closer to the random signal source and this algorithm has the ability to resist entropy attack.Table 2
Comparison of information entropy.
Image Information Entropy plaintext 7.4481 ciphertext 7.9991 ciphertext [4] 7.8556 ciphertext [17] 7.8534 ciphertext [20] 7.9994 ciphertext [24] 7.9551


### 6.3. Antiplaintext Attack

Since the starting sequence number of gray code and chaotic sequence is related to the attribute of plaintext image itself [25], the key obtained by selecting different plaintext is often different; “One Picture One Key” can basically be realized. The key deduced from the specific plaintext cannot correctly decrypt the other ciphertext [8]. Therefore, it can be concluded that this algorithm has good antiselective plaintext attack ability.


### 6.4. Antidifferential Attack

NPCR (Number of Pixels Change Rate) and UACI (Unified Average Changing Intensity) [26] can be used to measure the sensitivity of encryption algorithm to plaintext, which is an essential indicator to measure the algorithm’s resistance to differential attack. NPCR and UACI represent the proportion and degree of change of pixel values at corresponding positions. The more significant the proportion and degree of change is, the stronger the ability of algorithm’s resistance to differential attack is. The calculation equation is as follows:(13)NPCR=∑i=1M∑j=1NSijM×N×100%(14)Sij=1Xi,j≠X′i,j0Xi,j=X′i,j(15)UACI=∑i=1M∑j=1NXi,j-X′i,jM×N×255×100%whereM×N is the size of the image and Xi,j and X′(i,j) represent the pixel values of the corresponding positions of plaintext and ciphertext. The calculation method of NPCR and UACI for color image is defined according to the gray images, as follows:(16)NPCR3=∑i=1M∑j=1N∑k=13Sijk′M×N×3×100%(17)Sijk′=1Xi,j,k≠X′i,j,k0Xi,j,k=X′i,j,k(18)UACI3=∑i=1M∑j=1N∑k=13Sijk′M×N×255×3×100%The calculated results are shown in Table3.Table 3
Comparison of NPCR and UACI.
Image NPCR/% UACI/% Ciphertext 99.63 33.52 Ciphertext [4] 99.63 33.54 Ciphertext [17] 86.55 33.47 Ciphertext [18] 99.63 33.51 Ciphertext [20] 99.60 30.34When the NPCR and UACI of the ciphertext are greater than 99.6% and 33.46%, respectively, it indicates that the algorithm has good security. As shown in Table3, by comparing the NPCR and UACI values of [4, 17, 18, 20], this algorithm is more sensitive to plaintext than the references listed in Table 3. Therefore, this algorithm can meet the security requirements and has good resistance to differential attack.


## 6.1. Antiexhaustive Attack

This algorithm is based on gray code and hyperchaos system of 4D. Parameters, initial value, the number of iterations, and image size are the encryption key. When the precision is set to 1014, key space would be more than 1086. According to the current calculation conditions, when the key space is larger than 2128, ciphertext images can effectively resist violent attacks. The key space of this algorithm far exceeds this standard [22]. Thereunder, the key space of this encryption algorithm can effectively resist exhaustive attack.


## 6.2. Antientropy Attack

Image information entropy is used to represent the aggregation feature of image pixel value distribution [23]. The calculation method is as follows:(11)H=-∑i=0255pilog2⁡pip ( i ) is the frequency of each greyscale. This equation is mainly used to calculate the information entropy of gray image. In this paper, the calculation method of the information entropy of color image is defined as follows:(12)H=13∑Hkk ∈ { R , G , B } and Hk represents the information entropy of each color component of RGB.According to Table2, by comparing the information entropy of plaintext, ciphertext of this algorithm, and ciphertext image of [4, 17, 20, 24], it can be concluded that the information entropy value of the encrypted image of this algorithm is closer to the ideal value 8 which means that the encrypted image is closer to the random signal source and this algorithm has the ability to resist entropy attack.Table 2
Comparison of information entropy.
Image Information Entropy plaintext 7.4481 ciphertext 7.9991 ciphertext [4] 7.8556 ciphertext [17] 7.8534 ciphertext [20] 7.9994 ciphertext [24] 7.9551


## 6.3. Antiplaintext Attack

Since the starting sequence number of gray code and chaotic sequence is related to the attribute of plaintext image itself [25], the key obtained by selecting different plaintext is often different; “One Picture One Key” can basically be realized. The key deduced from the specific plaintext cannot correctly decrypt the other ciphertext [8]. Therefore, it can be concluded that this algorithm has good antiselective plaintext attack ability.


## 6.4. Antidifferential Attack

NPCR (Number of Pixels Change Rate) and UACI (Unified Average Changing Intensity) [26] can be used to measure the sensitivity of encryption algorithm to plaintext, which is an essential indicator to measure the algorithm’s resistance to differential attack. NPCR and UACI represent the proportion and degree of change of pixel values at corresponding positions. The more significant the proportion and degree of change is, the stronger the ability of algorithm’s resistance to differential attack is. The calculation equation is as follows:(13)NPCR=∑i=1M∑j=1NSijM×N×100%(14)Sij=1Xi,j≠X′i,j0Xi,j=X′i,j(15)UACI=∑i=1M∑j=1NXi,j-X′i,jM×N×255×100%whereM×N is the size of the image and Xi,j and X′(i,j) represent the pixel values of the corresponding positions of plaintext and ciphertext. The calculation method of NPCR and UACI for color image is defined according to the gray images, as follows:(16)NPCR3=∑i=1M∑j=1N∑k=13Sijk′M×N×3×100%(17)Sijk′=1Xi,j,k≠X′i,j,k0Xi,j,k=X′i,j,k(18)UACI3=∑i=1M∑j=1N∑k=13Sijk′M×N×255×3×100%The calculated results are shown in Table3.Table 3
Comparison of NPCR and UACI.
Image NPCR/% UACI/% Ciphertext 99.63 33.52 Ciphertext [4] 99.63 33.54 Ciphertext [17] 86.55 33.47 Ciphertext [18] 99.63 33.51 Ciphertext [20] 99.60 30.34When the NPCR and UACI of the ciphertext are greater than 99.6% and 33.46%, respectively, it indicates that the algorithm has good security. As shown in Table3, by comparing the NPCR and UACI values of [4, 17, 18, 20], this algorithm is more sensitive to plaintext than the references listed in Table 3. Therefore, this algorithm can meet the security requirements and has good resistance to differential attack.



---

*Source: 8132547-2019-06-27.xml*