# Development of a Novel Hyperchaos-Based Image Encryption Algorithm Consisting of Two Scrambling-Diffusion Operations

Authors: Yongzhong Huang; Xueguang Bi; Yucheng Liu; Yuxia Li
Journal: Complexity
 (2022)

---

## Abstract

This paper proposes a hyperchaos-based image encryption algorithm, which consists of two scrambling-diffusion operations and one scrambling operation. In the proposed algorithm, the initial conditions of a hyperchaotic Chen system are first generated using the Message Digest 5 (MD5) value of digital images and given initial values, and then the images will be encrypted using the keystream created by the system. Since the initial values of hyperchaotic Chen systems are related to plaintext and the encryption process is related to the images, this algorithm is able to effectively protect images against selective plaintext attacks. Simulation results demonstrate that the present algorithm offers enhanced encryption performance, high security, and strong resistance to known attacks. Therefore, it may find wide application in image encryption transmission. Compared to other image encryption algorithms, the proposed algorithm uses different keystreams when encrypting different images and is capable of effectively resisting various plain image and differential attacks faster.


---

## Body

## 1. Introduction

Digital images have been widely used as a major carrier of network information. The past decade has seen the rapid development of cloud computing, big data, and communication technology. However, the security of image transmission has raised noticeable awareness and has become a high-priority topic in the field of information security. Neighboring pixels in an image exhibit a high level of correlation, and the image itself contains a large amount of pictorial data. Because of that, conventional text-based encryption schemes like the data encryption standard (DES) or advanced encryption standard (AES) are not applicable to image encryption. It is therefore a critical task to design new algorithms that can be used for image encryption.Chaotic systems are nonlinear and have inherent characteristics like high sensitivity to control parameters’ initial conditions, internal randomness, unpredictability, and ergodicity. Therefore, pseudo-random sequences generated from chaotic systems are random, are computationally unpredictable, have a weak correlation, and possess a large parameter space. This property makes chaotic systems particularly competent for image encryption. Since Fridrich put forward a symmetric block encryption algorithm on the basis of invertible 2D chaotic maps in 1989 [1], many chaotic-based image encryption algorithms have been developed.For instance, [2] proposed a real-time secure symmetric encryption algorithm that used a 3D cat map to rearrange all the pixels of the original images and another chaotic map to mystify the relationship between the plain image and the cipher image, thereby increasing the immunity against statistical and differential attacks. The authors of [3] developed an image encryption approach based on chaotic logistic maps, which employed an 80-bit external secret key and two chaotic logistic maps. The authors of [4] designed a modified image encryption using coupled map lattices and substitution box transformation. In that approach, the positions of image pixels were mixed up by using a chaotic tent map; coupled map lattices and the S-box transformation were also employed to confuse the correlation between the original and the encrypted images. The authors of [5] put forward an image encryption scheme based on a quantum chaotic map and diffusion-permutation architecture. In their approach, the quantum chaotic map and the 2D logistic map were separately coupled with nearest-neighboring coupled-map lattices to achieve high complexity and randomness in the generated keystreams. The authors of [6] developed a lossless encryption method for color images by means of a 6D hyperchaotic system and the 2D discrete wavelet transform (DWT). Their scheme was established based on the 2D DWT and 6D hyperchaotic systems in both the spatial and frequency domains, where the key streams hinge on both the hyperchaotic system and the plain image.The authors of [7] presented an encryption scheme of linear-nonlinear-linear structure that employed total shuffling. Their system was able to generate a 1D chaotic system with enhanced chaotic performances and broader chaotic ranges by comparison with previous chaotic maps. The authors of [8] presented an image encryption method that enhanced the link between value changing for grayness and position shuffling for pixels. The authors of [9] developed a new image encryption algorithm, SPRING, applying lightweight chaotic maps and simple arithmetic and logical operations. The authors of [10] put forward a digital image encryption scheme via dynamic deoxyribonucleic acid coding and chaotic operations, making use of hyper-digital chaos in the frequency domain. In that algorithm, both the phase and amplitude components in the frequency domain were scrambled and diffused. The authors of [11] presented a 2D logistic-modulated-sine-coupling-logistic chaotic map (LSMCL) and used that map to design an image encryption scheme consisting of two rounds of permutation and diffusion operation. The authors of [12] put forward a composite chaotic map and a way of utilizing optimization approach to enhance the performance of encryption schemes. The authors of [13] applied three chaotic sequences to acquire a high level of encryption in their scheme to conduct both permutation and substitution processes of image encryption. The authors of [14] first obtained a memristive neuron model by coupling a memristor into an advanced neuron model with key chaotic characteristics. After that, they proposed a new encryption algorithm to apply the memristive neuron for image encryption. Lai, Zhang, and other coworkers [15] also designed a novel Hopfield neural network (HNN) that can yield multiscroll attractors by using a new memristor as a synapse in the HNN. They finally developed a 3D image encryption scheme based on the proposed memristive and confirmed its outstanding encryption performance.However, lots of chaos-based image encryption schemes are in fact not as secure as their developers claimed and cannot resist selective and known plaintext attacks. For example, the images encrypted using the schemes developed by [16, 17], and [18] were decoded by [19, 20], and [21] through plaintext attacks, respectively. Those encrypted images were deciphered because the secret keys were not related to the original plain images and the generated chaotic sequences to encrypt image data were constant. Those security defects made the aforementioned algorithms [16, 17]; and [18] as well as other encryption algorithms designed in similar manners [22, 23] vulnerable to plaintext attacks.To overcome the abovementioned shortcomings, this paper presents a hyperchaos-based image encryption scheme that has a scrambling-diffusion structure. In the present algorithm, the generated secret key is related to the original plain image and the encryption process is related to the image. Simulation results have verified that the presented scheme possesses a high degree of resistance against various plaintext attacks. The remainder of this paper is structured as follows. Section2 reviews the hyperchaotic Chen system adopted in this study. Section 3 illustrates the proposed algorithm, its structure, and presents the simulation results to verify its encryption performance. Section 4 discusses the characteristics of the algorithm by means of key space, key sensitivity, histograms, correlation coefficient, information entropy, and resistance to differential attacks. Section 5 concludes the paper.


## 2. Hyperchaotic Chen System

The hyperchaotic Chen system was presented by [24] from the Chen system via a dynamical controller. This system was chosen for designing the image encryption algorithm because it has notable dynamical properties and can generate pseudo-random sequences with excellent statistical properties. The equations describing the dynamics of the hyperchaotic Chen system can be written as follows [25]:(1)x˙=ay−x,y˙=−xz+dx+cy−w,z˙=xy−bz,w˙=x+k..When the control parametersa = 36, b = 3, c = 28, d = 16, and −0.7 ≤ k ≤ 0.7, the system is in hyperchaotic status. In this study, k is set as 0.2. Figure 1 shows the attractor of this hyperchaotic system.Figure 1
Attractor of the hyperchaotic chen system: (a) x-y plane; (b) y-z plane; (c) x-z plane; (d) y-w plane; (e) x-w plane; (f) z-w plane.
(a)(b)(c)(d)(e)(f)


## 3. Image Encryption Algorithm

The image encryption process is illustrated in Figure2. At first, the Message Digest 5 (MD5) hash value of the plain image is acquired, based on which the initial conditions of the hyperchaotic Chen system are determined. Next, the system generates chaotic sequences in an image encryption process. The generated sequences are then used for scrambling and diffusing the pixels or bits of the original image, and the entire encryption process is completed after two rounds of high-speed scrambling and pixel adaptive diffusion and a bit-plane scrambling step.Figure 2
Image encryption scheme.


### 3.1. Generation and Testing of Key Stream

We assume that the size of a plain imageP is M × N, the steps to generate a key stream are as follows:Step 1: Generate a 128 bit secret keyI from the plain image P using the MD5 algorithm.Step 2: Divide I into 32 4-bit-long groups, which isI = i1, i2, i3, …, i32.Step 3: Determine the initial conditions of the hyperchaotic Chen systemx1,y1,z1,w1 based on given initial values x0,y0,z0,w0 using equation (2). This set of initial conditions will be used for scrambling and diffusion operation I.(2)x1=x0+i1⊕i2⊕i3⊕i416,y1=y0+i5⊕i6⊕i7⊕i816,z1=z0+i9⊕i10⊕i11⊕i1216,ω1=ω0+i13⊕i14⊕i15⊕i1616..Step 3: Substitutex1,y1,z1,w1 into the hyperchaotic Chen system (equation (1)), iterate 500 times, and then continue to iterate other M × N times to obtain a sequence x1(i), y1(i), z1(i), and w1i, where i = 1, 2, 3, …, M × N.Step 4: Processe the generated sequence using equation (3) to obtain M × N matrices X1, Y1, Z1, W1, R1, and S1.(3)X1i=floormod200+x1i×1014,M,Y1i=floormod200+y1i×1014,N,Z1i=floormod200+z1i×1014,256,W1i=floormod200+x1i+z1i×1014,256,R1i=floormod200+x1i+y1i×1014,256,S1i=floormod200+w1i×1014,M+N..In equation (3), floor(x) returns the largest integer that is smaller than or equal to x, while mod(x, y) returns the remainder of x divided by y.Step 5: Determine another set of initial conditionsx2,y2,z2,w2 for the Chen system based on x0,y0,z0,w0 using equation (4). This set of initial conditions will be used for scrambling and diffusion operation II.(4)x2=x0+i17⊕i18⊕i19⊕i2016,y2=y0+i21⊕i22⊕i23⊕i2416,z2=z0+i25⊕i26⊕i27⊕i2816,ω2=ω0+i29⊕i30⊕i31⊕i3216..Step 6: Repeat step 3 to generate another sequence obtain a sequencex2(i), y2(i), z2(i), and w2i, where i = 1, 2, 3, …, M×N.Step 7: Repeat step 4 to obtain another set ofM × N matrices X2, Y2, Z2, W2, R2, and S2 using equation (5).(5)X1i=floormod200+x2i×1014,M,Y1i=floormod200+y2i×1014,N,Z1i=floormod200+z2i×1014,256,W1i=floormod200+x2i+z2i×1014,256,R1i=floormod200+x2i+y2i×1014,256,S1i=floormod200+w2i×1014,M+N.Next, a statistical test suite put forward by [26] was applied to test a key stream generated by the hyperchaotic Chen system following the above steps to determine its randomness. The plain image chosen for this experiment is “Lena”, whose size is 512 × 512. The initial values of this hyperchaotic Chen system are: x0 = 0.3838, y0 = 0.9876, z0 = 32.1234, and w0=0.6565. Test results are displayed in Table 1, from which it can be determined that the key stream generated by this system possesses excellent randomness.Table 1
Results of a randomness test.
ItemsP-valuesResultsApproximate entropy0.684325SuccessBlock frequency0.201642SuccessCumulative sums (forward)0.448463SuccessFast Fourier transform (FFT)0.742726SuccessFrequency0.640642SuccessLinear complexity0.998936SuccessLongest run0.503063SuccessNonoverlapping template0.829020SuccessOverlapping template0.946675SuccessRank0.903588SuccessRuns0.749820SuccessSerialP-value 10.517025SuccessSerialP-value 20.824740SuccessUniversal0.355340SuccessRandom excursionsX = −40.292475SuccessRandom excursionsX = −30.665211SuccessRandom excursionsX = −20.201510SuccessRandom excursionsX = −10.785998SuccessRandom excursionsX = 10.056035SuccessRandom excursionsX = 20.567424SuccessRandom excursionsX = 30.375432SuccessRandom excursionsX = 40.802170SuccessRandom excursions variantX = −90.993779SuccessRandom excursions variantX = −80.874679SuccessRandom excursions variantX = −70.820132SuccessRandom excursions variantX = −60.564102SuccessRandom excursions variantX = −50.301069SuccessRandom excursions variantX = −40.144795SuccessRandom excursions variantX = −30.078193SuccessRandom excursions variantX = −20.150287SuccessRandom excursions variantX = −10.296088SuccessRandom excursions variantX = 10.074375SuccessRandom excursions variantX = 20.135122SuccessRandom excursions variantX = 30.284107SuccessRandom excursions variantX = 40.841091SuccessRandom excursions variantX = 50.588381SuccessRandom excursions variantX = 60.415502SuccessRandom excursions variantX = 70.284619SuccessRandom excursions variantX = 80.233579SuccessRandom excursions variantX = 90.167543Success


### 3.2. Scrambling Operation I

The scrambling operationI is pixel-related, which scrambles the pixels in the original image through two scrambling processes. M + N pixels are selected from the image and the remaining pixels are scrambled in the first process, while the M + N selected pixels will be scrambled in the second process.The steps of the first scrambling process are:Step 1: We randomly selectM + N pixels from the image P, which will not be scrambled in this process; then use matrices X1 and Y1 to determine the locations of the selected pixels P(b(i), c(i)), i = 1, 2, 3, …, M + N. The values of b and c are calculated using equations (6) and (7), respectively.(6)bi=X1i,1,i=1,2,3,…,M,bj+M=X11,j,j=1,2,3,…,N,(7)ci=Y1i,1,i=1,2,3,…,M,cj+M=Y11,j,j=1,2,3,…,N.Step 2: Solve the information entropy (H1) of the remaining pixels of the image (excluding the selected M + N pixels P(b(i), c(i)) using equation (8); then find h1 from H1 based on equation (9).(8)H1m=∑i=02N−1pmilog1pmi.In (8), mi represents the grayscale value of each pixel of the image; p(mi) represents the probability of the occurrence of the value mi in the image; and N denotes the value’s number of bits.(9)h1=floorH1×105.Step 3: Shift the location of pixelsP(i, j) and Pu,v, determine the location u and v using equations (10) and (11).(10)u=X1i,j+Pbi,ci+h1modM,i=1,2,3,…M;j=1,2,3,…N,(11)v=Y1i,j+Pbj+M,cj+M+h1modN,i=1,2,3,…M;j=1,2,3,…N.Ifu is solved as 0 based on (10), then we set u=X1i,j; likewise, if v is solved as 0 from (11), it will be set as v=Y1i,j.Step 4: Complete the location change if bothP(i, j) and Pu,v do not belong to the randomly selected M + N pixels P(b, c). In another word, if i = b(k), j = c(k) or u=bk,v=ck, k = 1, 2, 3, …, M + N, then the positions of P(i, j) and Pu,v will not be changed.The image obtained after the first scrambling process is denoted asE.The second scrambling process is to change the locations of theM + N pixels E(b(i), c(i)) that have not been scrambled in the first process, which includes the following steps:Step 1: Form a vector F with theM + N pixels F(i) = {E(b(i), c(i))}, i = 1, 2, 3, …, M + N.Step 2: Find the information entropy of {F}, H2, using equation (8), and obtain h2 from H2 following the same approach described in equation (9): h2=floorH2×102.Step 3: Chang the location ofF(i) to F(t) by means of matrix S1 (established in equation (3)). t can be determined using equation (12)(12)t=S1i+h2modM+N,i=1,2,3,…,M+N.Ift is found to be 0 from (12), then let t = S1(i).Step 4: Plac the scrambledF(i) back into the image E and update the M + N pixels in E as E(b(i), c(i)) = F(i), i = 1, 2, 3, …, M + N.


### 3.3. Diffusion Operation I

The diffusion operation I mixes modulo addition and bitwise exclusive or (XOR) operations as suggested by [2]. Its main steps are:Step 1: Obtain an image matrixG by conducting an XOR diffusion operation with the help of matrix Z1 (equation (3))(13)Gi,j=Z1i,j⊕Ei,j,i=1,2,3,…,M,j=1,2,3,…,N.Step 2: RepresentG as a row vector GV, and matrix R1 (established in equation (3)) as another row vector RV, then conduct a modulo operation to obtain J (equation (14)).(14)J1=RV1+GV1mod256,Ji=Ji−1+RVi+GVimod256,i=2,3,…,MN.Step 3: Represent matrixW1 (equation (3) as a row vector WV and use it for another modulo operation to obtain diffused image data K, as illustrated in equation (15):(15)KMN=WVMN+JMNmod256,Ki=Ki+1+WVi+Jimod256,i=MN−1,MN−2,MN−3,…,2,1.


### 3.4. Bit-Plane Scrambling Operation

The image’s pixel values are represented in an 8 bit binary format. We first obtain the 8 bit binary value of each pixel inK and rearrange those binary values to obtain the position-scrambled image data (Figure 3).Figure 3
The process diagram of the bit-plain scrambling operation.The method of acquiring the 8-bit binary value of theith pixel involves the following steps: Ki=bi8,bi7,bi6,bi5,bi4,bi3,bi2,bi1, i = 1, 2, 3, …, MN. Next, a new set of image data L1(i) can be obtained by scrambling K(i) via the process illustrated in Figure 2 as L1i=bi4,bi3,bi2,bi1,bi7,bi6,bi5,bi8, i = 1, 2, 3, …, MN. Decimal values of L1(i) can then be easily obtained as(16)Li=bi4×27+bi3×26+bi2×25+bi1×24+bi7×23+bi6×22+bi5×21+bi8×20i=1,2,3,…,MN.TheL(i) is a M×N matrix and the image K is converted to image A after this operation.


### 3.5. Scrambling Operation II

The scrambling operation II is related to the plaintext. All the pixels in the image A will be scrambled in this operation through two processes. Similar to the scrambling operation I, in the first scrambling process,M + N pixels are selected from A and the remaining pixels will be scrambled. In the second process, the M + N selected pixels will be scrambled.The first scrambling process consists of following steps:Step 1: Randomly selectM + N pixels from A and the selected pixels will not be scrambled in this process. The locations of those pixels (d(i), f(i)) are determined by means of matrices X2 and Y2 (equation (5)) using the following equations:(17)di=X2i,1,i=1,2,3,…,M,dj+M=X21,j,j=1,2,3,…,N,fi=Y2i,1,i=1,2,3,…,M,fj+M=Y21,j,j=1,2,3,…,N.The selected pixelsA(d(i), f(i)), i = 1, 2, 3, …, M + N will not be scrambled in the first scrambling process.Step 2: Find the mean value and mix for image A and obtain mixA using equation (19).(18)mix=1MN∑i=0MNAi,mixA=mix×105.Step 3: Shift the locations of the pixelA(i, j) and Ag,h, where g and h are determined by the following equations:(19)g=X2i,j+Adi,fi+mixAmodM,i=1,2,3,…M;j=1,2,3,…N,h=Y2i,j+Adj,fj+mixAmodN,i=1,2,3,…M;j=1,2,3,…N.Ifg is found to be zero, then let g=X2i,j; likewise, if h is found to be zero then h = Y2(i, j).Step 4: Complete the location change if bothA(i, j) and Ag,h do not belong to the randomly selected M + N pixels A(d, f). In another word, if i = d(k), j = f(k) or u=dk,v=fk, k = 1, 2, 3, …, M + N, then the positions of A(i, j) and Ag,h will not be shifted.The image obtained after the first scrambling process is denoted as B.The second scrambling process is to scramble theM + N pixels B(d(i), f(i)) that have not been scrambled in the first process. The steps of this process are listed below:Step 1: Form a vectorC with the M + N pixels C(i) = {B(d(i), f(i))}, i = 1, 2, 3, …, M + N.Step 2: Find the mean value and mix of C, and obtain mixC following the same approach depicted in(20)mix=1MN∑i=0MNCi,mixC=mix×105.Step 3: Shift the locations ofC(i) and C(q) by means of matrix S2 (established in equation (5)). q can be determined based on(21)q=S2i+mixCmodM+N,i=1,2,3,…M+N.Ifq is found to be 0 from (21), then let q = S2(i).Step 4: Place the scrambledC(i) back into the image and update the M + N pixels in B as B(d(i), f(i)) = C(i), i = 1, 2, 3, …, M + N.


### 3.6. Diffusion Operation II

The diffusion operation II is similar to operation I (Section3.3) and consists of the following steps:Step 1: Obtain an image matrixD through a modulo operation using matrix Z2 (equation (5)):(22)Di,j=Z2i,j+Bi,jmod256,i=1,2,3,…M,j=1,2,3,…N.Step 2: RepresentD as a row vector DK, matrix R2 (established in equation (5)) as another row vector RK and perform an XOR diffusion operation to obtain Q.(23)Q1=RK1⊕DK1,Qi=Qi−1⊕RKi⊕DKi,i=2,3,…,MN.Step 3: Represent matrix W2 (equation (5) as a row vector WK and use it for another XOR operation to obtain T:(24)TMN=WKMN⊕QMN,Ki=Ki+1+WVi+Jimod256,i=MN−1,MN−2,MN−3,…,2,1.The resultT is then converted to a M×N matrix TL.


### 3.7. Simulation Results

The proposed image encryption algorithm was then applied to encrypt and decrypt four grayscale images (baboon, Lena, airplane, and pepper) to assess its encryption performance. The size of the selected images is 512 × 512. The secret key of each image consists of initial valuesx0,y0,z0,w0, as well as the 128 bit MD5 hash value of the image. The encryption and decryption processes were simulated on professional graphic workstations (graphics card: NVDIA Tesla K80, processor: Intel Core i7-6700K, and the maximum RAM capacity was 8 GB) using Matlab. Matlab is a powerful software package which has been widely used for solving engineering problems and developing graphical illustrations [27, 28]. Simulation results and the original plain images are displayed in Figure 4. From that figure, we can find that the encrypted images are noise-like images, which are completely different from the original images. However, the decrypted images are identical to the original images.Figure 4
Simulation results: (a, b, c, d) plain images; (e, f, g, h) encrypted images; (i, j, k, l) decrypted images.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)


## 3.1. Generation and Testing of Key Stream

We assume that the size of a plain imageP is M × N, the steps to generate a key stream are as follows:Step 1: Generate a 128 bit secret keyI from the plain image P using the MD5 algorithm.Step 2: Divide I into 32 4-bit-long groups, which isI = i1, i2, i3, …, i32.Step 3: Determine the initial conditions of the hyperchaotic Chen systemx1,y1,z1,w1 based on given initial values x0,y0,z0,w0 using equation (2). This set of initial conditions will be used for scrambling and diffusion operation I.(2)x1=x0+i1⊕i2⊕i3⊕i416,y1=y0+i5⊕i6⊕i7⊕i816,z1=z0+i9⊕i10⊕i11⊕i1216,ω1=ω0+i13⊕i14⊕i15⊕i1616..Step 3: Substitutex1,y1,z1,w1 into the hyperchaotic Chen system (equation (1)), iterate 500 times, and then continue to iterate other M × N times to obtain a sequence x1(i), y1(i), z1(i), and w1i, where i = 1, 2, 3, …, M × N.Step 4: Processe the generated sequence using equation (3) to obtain M × N matrices X1, Y1, Z1, W1, R1, and S1.(3)X1i=floormod200+x1i×1014,M,Y1i=floormod200+y1i×1014,N,Z1i=floormod200+z1i×1014,256,W1i=floormod200+x1i+z1i×1014,256,R1i=floormod200+x1i+y1i×1014,256,S1i=floormod200+w1i×1014,M+N..In equation (3), floor(x) returns the largest integer that is smaller than or equal to x, while mod(x, y) returns the remainder of x divided by y.Step 5: Determine another set of initial conditionsx2,y2,z2,w2 for the Chen system based on x0,y0,z0,w0 using equation (4). This set of initial conditions will be used for scrambling and diffusion operation II.(4)x2=x0+i17⊕i18⊕i19⊕i2016,y2=y0+i21⊕i22⊕i23⊕i2416,z2=z0+i25⊕i26⊕i27⊕i2816,ω2=ω0+i29⊕i30⊕i31⊕i3216..Step 6: Repeat step 3 to generate another sequence obtain a sequencex2(i), y2(i), z2(i), and w2i, where i = 1, 2, 3, …, M×N.Step 7: Repeat step 4 to obtain another set ofM × N matrices X2, Y2, Z2, W2, R2, and S2 using equation (5).(5)X1i=floormod200+x2i×1014,M,Y1i=floormod200+y2i×1014,N,Z1i=floormod200+z2i×1014,256,W1i=floormod200+x2i+z2i×1014,256,R1i=floormod200+x2i+y2i×1014,256,S1i=floormod200+w2i×1014,M+N.Next, a statistical test suite put forward by [26] was applied to test a key stream generated by the hyperchaotic Chen system following the above steps to determine its randomness. The plain image chosen for this experiment is “Lena”, whose size is 512 × 512. The initial values of this hyperchaotic Chen system are: x0 = 0.3838, y0 = 0.9876, z0 = 32.1234, and w0=0.6565. Test results are displayed in Table 1, from which it can be determined that the key stream generated by this system possesses excellent randomness.Table 1
Results of a randomness test.
ItemsP-valuesResultsApproximate entropy0.684325SuccessBlock frequency0.201642SuccessCumulative sums (forward)0.448463SuccessFast Fourier transform (FFT)0.742726SuccessFrequency0.640642SuccessLinear complexity0.998936SuccessLongest run0.503063SuccessNonoverlapping template0.829020SuccessOverlapping template0.946675SuccessRank0.903588SuccessRuns0.749820SuccessSerialP-value 10.517025SuccessSerialP-value 20.824740SuccessUniversal0.355340SuccessRandom excursionsX = −40.292475SuccessRandom excursionsX = −30.665211SuccessRandom excursionsX = −20.201510SuccessRandom excursionsX = −10.785998SuccessRandom excursionsX = 10.056035SuccessRandom excursionsX = 20.567424SuccessRandom excursionsX = 30.375432SuccessRandom excursionsX = 40.802170SuccessRandom excursions variantX = −90.993779SuccessRandom excursions variantX = −80.874679SuccessRandom excursions variantX = −70.820132SuccessRandom excursions variantX = −60.564102SuccessRandom excursions variantX = −50.301069SuccessRandom excursions variantX = −40.144795SuccessRandom excursions variantX = −30.078193SuccessRandom excursions variantX = −20.150287SuccessRandom excursions variantX = −10.296088SuccessRandom excursions variantX = 10.074375SuccessRandom excursions variantX = 20.135122SuccessRandom excursions variantX = 30.284107SuccessRandom excursions variantX = 40.841091SuccessRandom excursions variantX = 50.588381SuccessRandom excursions variantX = 60.415502SuccessRandom excursions variantX = 70.284619SuccessRandom excursions variantX = 80.233579SuccessRandom excursions variantX = 90.167543Success


## 3.2. Scrambling Operation I

The scrambling operationI is pixel-related, which scrambles the pixels in the original image through two scrambling processes. M + N pixels are selected from the image and the remaining pixels are scrambled in the first process, while the M + N selected pixels will be scrambled in the second process.The steps of the first scrambling process are:Step 1: We randomly selectM + N pixels from the image P, which will not be scrambled in this process; then use matrices X1 and Y1 to determine the locations of the selected pixels P(b(i), c(i)), i = 1, 2, 3, …, M + N. The values of b and c are calculated using equations (6) and (7), respectively.(6)bi=X1i,1,i=1,2,3,…,M,bj+M=X11,j,j=1,2,3,…,N,(7)ci=Y1i,1,i=1,2,3,…,M,cj+M=Y11,j,j=1,2,3,…,N.Step 2: Solve the information entropy (H1) of the remaining pixels of the image (excluding the selected M + N pixels P(b(i), c(i)) using equation (8); then find h1 from H1 based on equation (9).(8)H1m=∑i=02N−1pmilog1pmi.In (8), mi represents the grayscale value of each pixel of the image; p(mi) represents the probability of the occurrence of the value mi in the image; and N denotes the value’s number of bits.(9)h1=floorH1×105.Step 3: Shift the location of pixelsP(i, j) and Pu,v, determine the location u and v using equations (10) and (11).(10)u=X1i,j+Pbi,ci+h1modM,i=1,2,3,…M;j=1,2,3,…N,(11)v=Y1i,j+Pbj+M,cj+M+h1modN,i=1,2,3,…M;j=1,2,3,…N.Ifu is solved as 0 based on (10), then we set u=X1i,j; likewise, if v is solved as 0 from (11), it will be set as v=Y1i,j.Step 4: Complete the location change if bothP(i, j) and Pu,v do not belong to the randomly selected M + N pixels P(b, c). In another word, if i = b(k), j = c(k) or u=bk,v=ck, k = 1, 2, 3, …, M + N, then the positions of P(i, j) and Pu,v will not be changed.The image obtained after the first scrambling process is denoted asE.The second scrambling process is to change the locations of theM + N pixels E(b(i), c(i)) that have not been scrambled in the first process, which includes the following steps:Step 1: Form a vector F with theM + N pixels F(i) = {E(b(i), c(i))}, i = 1, 2, 3, …, M + N.Step 2: Find the information entropy of {F}, H2, using equation (8), and obtain h2 from H2 following the same approach described in equation (9): h2=floorH2×102.Step 3: Chang the location ofF(i) to F(t) by means of matrix S1 (established in equation (3)). t can be determined using equation (12)(12)t=S1i+h2modM+N,i=1,2,3,…,M+N.Ift is found to be 0 from (12), then let t = S1(i).Step 4: Plac the scrambledF(i) back into the image E and update the M + N pixels in E as E(b(i), c(i)) = F(i), i = 1, 2, 3, …, M + N.


## 3.3. Diffusion Operation I

The diffusion operation I mixes modulo addition and bitwise exclusive or (XOR) operations as suggested by [2]. Its main steps are:Step 1: Obtain an image matrixG by conducting an XOR diffusion operation with the help of matrix Z1 (equation (3))(13)Gi,j=Z1i,j⊕Ei,j,i=1,2,3,…,M,j=1,2,3,…,N.Step 2: RepresentG as a row vector GV, and matrix R1 (established in equation (3)) as another row vector RV, then conduct a modulo operation to obtain J (equation (14)).(14)J1=RV1+GV1mod256,Ji=Ji−1+RVi+GVimod256,i=2,3,…,MN.Step 3: Represent matrixW1 (equation (3) as a row vector WV and use it for another modulo operation to obtain diffused image data K, as illustrated in equation (15):(15)KMN=WVMN+JMNmod256,Ki=Ki+1+WVi+Jimod256,i=MN−1,MN−2,MN−3,…,2,1.


## 3.4. Bit-Plane Scrambling Operation

The image’s pixel values are represented in an 8 bit binary format. We first obtain the 8 bit binary value of each pixel inK and rearrange those binary values to obtain the position-scrambled image data (Figure 3).Figure 3
The process diagram of the bit-plain scrambling operation.The method of acquiring the 8-bit binary value of theith pixel involves the following steps: Ki=bi8,bi7,bi6,bi5,bi4,bi3,bi2,bi1, i = 1, 2, 3, …, MN. Next, a new set of image data L1(i) can be obtained by scrambling K(i) via the process illustrated in Figure 2 as L1i=bi4,bi3,bi2,bi1,bi7,bi6,bi5,bi8, i = 1, 2, 3, …, MN. Decimal values of L1(i) can then be easily obtained as(16)Li=bi4×27+bi3×26+bi2×25+bi1×24+bi7×23+bi6×22+bi5×21+bi8×20i=1,2,3,…,MN.TheL(i) is a M×N matrix and the image K is converted to image A after this operation.


## 3.5. Scrambling Operation II

The scrambling operation II is related to the plaintext. All the pixels in the image A will be scrambled in this operation through two processes. Similar to the scrambling operation I, in the first scrambling process,M + N pixels are selected from A and the remaining pixels will be scrambled. In the second process, the M + N selected pixels will be scrambled.The first scrambling process consists of following steps:Step 1: Randomly selectM + N pixels from A and the selected pixels will not be scrambled in this process. The locations of those pixels (d(i), f(i)) are determined by means of matrices X2 and Y2 (equation (5)) using the following equations:(17)di=X2i,1,i=1,2,3,…,M,dj+M=X21,j,j=1,2,3,…,N,fi=Y2i,1,i=1,2,3,…,M,fj+M=Y21,j,j=1,2,3,…,N.The selected pixelsA(d(i), f(i)), i = 1, 2, 3, …, M + N will not be scrambled in the first scrambling process.Step 2: Find the mean value and mix for image A and obtain mixA using equation (19).(18)mix=1MN∑i=0MNAi,mixA=mix×105.Step 3: Shift the locations of the pixelA(i, j) and Ag,h, where g and h are determined by the following equations:(19)g=X2i,j+Adi,fi+mixAmodM,i=1,2,3,…M;j=1,2,3,…N,h=Y2i,j+Adj,fj+mixAmodN,i=1,2,3,…M;j=1,2,3,…N.Ifg is found to be zero, then let g=X2i,j; likewise, if h is found to be zero then h = Y2(i, j).Step 4: Complete the location change if bothA(i, j) and Ag,h do not belong to the randomly selected M + N pixels A(d, f). In another word, if i = d(k), j = f(k) or u=dk,v=fk, k = 1, 2, 3, …, M + N, then the positions of A(i, j) and Ag,h will not be shifted.The image obtained after the first scrambling process is denoted as B.The second scrambling process is to scramble theM + N pixels B(d(i), f(i)) that have not been scrambled in the first process. The steps of this process are listed below:Step 1: Form a vectorC with the M + N pixels C(i) = {B(d(i), f(i))}, i = 1, 2, 3, …, M + N.Step 2: Find the mean value and mix of C, and obtain mixC following the same approach depicted in(20)mix=1MN∑i=0MNCi,mixC=mix×105.Step 3: Shift the locations ofC(i) and C(q) by means of matrix S2 (established in equation (5)). q can be determined based on(21)q=S2i+mixCmodM+N,i=1,2,3,…M+N.Ifq is found to be 0 from (21), then let q = S2(i).Step 4: Place the scrambledC(i) back into the image and update the M + N pixels in B as B(d(i), f(i)) = C(i), i = 1, 2, 3, …, M + N.


## 3.6. Diffusion Operation II

The diffusion operation II is similar to operation I (Section3.3) and consists of the following steps:Step 1: Obtain an image matrixD through a modulo operation using matrix Z2 (equation (5)):(22)Di,j=Z2i,j+Bi,jmod256,i=1,2,3,…M,j=1,2,3,…N.Step 2: RepresentD as a row vector DK, matrix R2 (established in equation (5)) as another row vector RK and perform an XOR diffusion operation to obtain Q.(23)Q1=RK1⊕DK1,Qi=Qi−1⊕RKi⊕DKi,i=2,3,…,MN.Step 3: Represent matrix W2 (equation (5) as a row vector WK and use it for another XOR operation to obtain T:(24)TMN=WKMN⊕QMN,Ki=Ki+1+WVi+Jimod256,i=MN−1,MN−2,MN−3,…,2,1.The resultT is then converted to a M×N matrix TL.


## 3.7. Simulation Results

The proposed image encryption algorithm was then applied to encrypt and decrypt four grayscale images (baboon, Lena, airplane, and pepper) to assess its encryption performance. The size of the selected images is 512 × 512. The secret key of each image consists of initial valuesx0,y0,z0,w0, as well as the 128 bit MD5 hash value of the image. The encryption and decryption processes were simulated on professional graphic workstations (graphics card: NVDIA Tesla K80, processor: Intel Core i7-6700K, and the maximum RAM capacity was 8 GB) using Matlab. Matlab is a powerful software package which has been widely used for solving engineering problems and developing graphical illustrations [27, 28]. Simulation results and the original plain images are displayed in Figure 4. From that figure, we can find that the encrypted images are noise-like images, which are completely different from the original images. However, the decrypted images are identical to the original images.Figure 4
Simulation results: (a, b, c, d) plain images; (e, f, g, h) encrypted images; (i, j, k, l) decrypted images.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)


## 4. Performance Analysis

A good encryption algorithm should guarantee security and exhibit an excellent encryption performance. An assessment of the developed image encryption algorithm is presented in this section. As mentioned in 3.7, Matlab was used for this computational analysis. The running platform was an Intel Core i7-6700K processor (8M Cache, 4 GHz) with a maximum RAM capacity of 8 GB and the operating system was Windows 7.


### 4.1. Key Space

An encryption system needs to have a large key space to resist exhaustive attacks. The key space size has to be larger than 2128 to effectively protect the images from exhaustive attacks. The secret key generated from the proposed encryption algorithm includes four initial values x0,y0,z0,w0, and a 128 bit MD5 value. The initial values are double precision values. The space of the key consists of those first four values is about 2192, which is far greater than 2128. Therefore, the present encryption algorithm can effectively resist the exhaustive attacks.


### 4.2. Histograms

The histogram of an image reflects the image’s statistical properties. Figure4 displays histograms of the original plain images and the encrypted images. A secure encryption system can make an encrypted image with a uniform histogram to resist any statistical attacks [29]. As shown in Figure 5, the histograms of the encrypted images are evidently different from those of the plain images, which reveals that the pixel values of the encrypted images are evenly distributed. Therefore, the displayed histograms proved that the present scheme is well able to withstand the statistical attacks.Figure 5
Histograms of original plain images (e)-(h) and encrypted images (i)-(l); (a)-(d) the original images.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)


### 4.3. Correlation Coefficient Analysis

Neighboring pixels of plain images have strong correlations. An effective image encryption scheme should be able to reduce these correlations to almost zero. The correlation coefficient (ruv,u and v are two adjacent pixels) is calculated as(25)ruv=covu,vDuDv,where(26)covu,v=1N∑i=1Nui−Euvi−Ev,Du=1N∑i=1Nui−Eu2,Eu=1N∑i=1Nui.In this study, we selected 5,000 pairs of adjacent pixels from both the plain and encrypted images and calculated the correlation coefficients along vertical, horizontal, and diagonal directions. Calculation results are listed in Table2 and Figure 6 compares the correlation coefficients calculated from the original and encrypted image of pepper. It can be seen from Table 2 that the horizontal, vertical, and diagonal correlation coefficients of the original plain images are close to 1 and the corresponding correlation coefficients of the encrypted images are nearly zero. This means that the present algorithm can significantly reduce the correlation coefficients and show desirable encryption performance.Table 2
Correlation coefficients of selected adjacent pixels.
AlgorithmsImagesHorizontalVerticalDiagonalPresent in this paperBaboon (plain)0.7533860.8647580.718634Present in this paperLena (plain)0.9853160.9779140.958496Present in this paperAirplane (plain)0.9701160.9663740.940405Present in this paperPepper (plain)0.9809260.9752150.965311Present in this paperBaboon (encrypted)0.0112260.0166520.004684Present in this paperLena (encrypted)0.016603−0.0071930.001036Present in this paperAirplane (encrypted)0.014916−0.0008450.004081Present in this paperPepper (encrypted)0.0103800.006469−0.010354[30]Lena (encrypted)−0.0288720.0145930.036587[31]Lena (encrypted)−0.02850.00140.0013[32]Lena (encrypted)0.0039−0.03140.0158[12]Lena (encrypted)0.011816−0.0173110.022785Figure 6
Correlation coefficients of the image of pepper (a) plain image; (b)-(d) horizontal, vertical, and diagonal correlation coefficients of the plain image; (e) encrypted image; (f)-(h) horizontal, vertical, and diagonal correlation coefficients of the encrypted image.
(a)(b)(c)(d)(e)(f)(g)(h)


### 4.4. Key Sensitivity Analysis

Next, we use two similar key codes (with slight differences) to encrypt the same image to obtain two encrypted images. If these two images differ markedly from each other, then it means the present algorithm is very sensitive to small changes in key because such small changes would produce great differences between cipher images. Otherwise, the key sensitivity of the algorithm is low. The initial values of the first key code arex0 = 0.4, y0 = 0.9, z0 = 30, and ω0 = 0.6; and those of the second key code are set to be x0 = 0.4 + 10−15, y0 = 0.9, z0 = 30, and ω0 = 0.6. These two keys were used to encrypt the image for the airplane, and the two cipher images are displayed in Figure 7. From that figure, it can be found that the two encrypted images show obvious differences. The key sensitivity of the proposed encryption algorithm is therefore confirmed.Figure 7
Key sensitivity analysis results: (a) a plain image for airplane; (b) a cipher image encrypted using the first key code; (c) a cipher image encrypted using the second key code; and (d) the difference between (b) and (c).
(a)(b)(c)(d)


### 4.5. Information Entropy

Information entropy is a measure of the randomness or uncertainty of image information. Under ideal conditions, the information entropy of a grayscale image should be 8 if the image consists of randomly distributed pixels. Therefore, the information entropy of a cipher image should be close to eight if the cipher image is encrypted using an effective image encryption algorithm. The information entropies of the four plain images and the corresponding encrypted images were calculated, and Table3 lists the calculation results.Table 3
Information entropies of the plain and encrypted figures.
ImageInformation entropy for plain imageInformation entropy for encrypted imageBaboon7.3154997.999338Lena7.3479027.999303Airplane6.7169457.999211Pepper7.5171467.999275From Table3 it can be found that the information entropies of the encrypted images are close to the optimal value 8, which verifies that the presented scheme is secure enough to be used for image transmission. Furthermore, the information entropy of the image of Lena processed using other encryption schemes was calculated as 7.9972 [33], 7.9992 [34], 7.9993 [31], and 7.9991 [35]. Compared to those values, the information entropy of the cipher image encrypted utilizing the present algorithm is closer to 8.


### 4.6. Resistance to Differential Attacks

An effective image encryption scheme should have excellent plain-image sensitivity and be capable of defending against differential attacks. It signifies that any slight change in the original plain image will cause its cipher image to change significantly. The plain image sensitivity of the present image encryption algorithm is determined through the following steps: Assuming a plain image P1, we first change the value of a randomly selected pixel of that image to obtain another plain image P2. Next, both P1 and P2 are encrypted, applying the present encryption algorithm to acquire two cipher images, C1 and C2. Finally, the plain-image sensitivity of the proposed algorithm is determined by comparing C1 with C2. The difference between C1 and C2 is indicated using net pixel change rate (NPCR) (27) and unified average changing intensity (UACI) (28) [36].(27)NPCR=1M×N∑i=1M∑j=1NDi,j×1,(28)UACI=1M×N∑i=1M∑j=1NC1i,j−C2i,j255,where(29)Di,j=1,C1i,j≠C2i,j,0,C1i,j=C2i,j.In equation (29), (C1) (i, j) and C2(i, j) denote pixel values of C1 and C2. The NPCR and UACI of the encrypted images of baboon, Lena, airplane, and pepper are displayed in Table 4. For comparison, that table also contains the NPCR and UACI of the cipher images of Lena encrypted using existing image encryption algorithms.Table 4
NPCR and UACI of cipher images.
Encryption algorithmImageNPCR (%)UACI (%)Present in this studyBaboon99.59373433.544325Present in this studyLena99.59030233.462442Present in this studyAirplane99.60098333.481864Present in this studyPepper99.60212733.453822[31]Lena99.6233.46[37]Lena99.6333.56[38]Lena99.622733.51964From Table4, it is found that compared with other schemes, the UACI and NPCR values yielded from the proposed algorithm are closer to their theoretical values of 99.61% and 33.46%, respectively. In other words, if we use the same key code generated from our algorithm to encrypt two very similar plain images, the obtained cipher images will differ markedly. Hence, it is verified that the developed algorithm is very sensitive to plain images and possesses a strong capacity to resist the differential attacks.


### 4.7. Resistance to Chosen Plain Image Attacks

Our algorithm can effectively defend against chosen plain image attacks. This is because the generated key code is related to the plain image, so different key codes will be acquired for different images. With a chosen plain image attack, the attacker can encrypt a plain image of his or her choice and has access to the resulting cipher image. This information is used to derive the encryption key and break the encryption algorithm. To assess the resistance of the designed algorithm to the chosen plain image attacks, the algorithm was applied to encrypt a 512 × 512 black image and a white image of the same size. The obtained cipher images were analyzed, and the results are displayed in Figure8 and Table 5.Figure 8
Plain and cipher histograms and images: (a) plain black image; (b) plain white image; (c) histogram of the cipher image of the black image; (d) cipher image of the black image; (e) cipher image of the white image; and (f) histogram of the cipher image of the white image.
(a)(b)(c)(d)(e)(f)Table 5
Information entropies and correlation coefficients of the cipher images.
ImageInformation entropyCorrelation coefficientHorizontalVerticalDiagonalWhitePlain image0000Cipher image7.999292−0.02720790.028597−0.0085912BlackPlain image0000Cipher image7.9992570.023715−0.0079270.042870As shown in Table5, the information entropies of the cipher images are very close to 8 and the correlation coefficients are close to 0. Therefore, almost no useful information can be extracted from the cipher images encrypted using the developed algorithm.


### 4.8. Speed Analysis

A good image encryption scheme should possess not only high security but also fast encryption speed. Using the image of Lena as an example, the speed analysis data (Table6) show that compared with other image encryption algorithms, our algorithm is faster in encrypting images.Table 6
Speed analysis results.
Encryption algorithmImage (size)Time (s)Present in this studyLena (256 × 256)0.547[39]Lena (256 × 256)1.532[40]Lena (256 × 256)0.580[12]Lena (256 × 256)2.443


### 4.9. Discussion

The proposed image encryption algorithm consists of two scrambling-diffusion operations. To verify the superiority of two scrambling-diffusion operations over one scrambling-diffusion operation in image encryption, we encrypted the image “Baboon” using the proposed algorithm and an existing image encryption algorithm that only includes one scrambling-diffusion operation separately, and compared the encryption times and information entropies of these two encryptions (Table7). As displayed in Table 7, the times needed for two scrambling-diffusion operations are quite close to those needed for one operation. However, the information entropy of the image encrypted after two scrambling-diffusion operations is better than the information entropy of the image encrypted with one operation. The comparison shows that the proposed encryption algorithm has high efficiency and exhibits greater performance than the algorithm with only one scrambling-diffusion operation.Table 7
Encryption times and information entropies of the encrypted images.
Encryption algorithmsImages (size)Times (s)Information entropiesProposed one with two scrambling-diffusion operationsBaboon (256 × 256)0.5597.999An existing algorithm with one scrambling-diffusion operationBaboon (256 × 256)0.4847.997


## 4.1. Key Space

An encryption system needs to have a large key space to resist exhaustive attacks. The key space size has to be larger than 2128 to effectively protect the images from exhaustive attacks. The secret key generated from the proposed encryption algorithm includes four initial values x0,y0,z0,w0, and a 128 bit MD5 value. The initial values are double precision values. The space of the key consists of those first four values is about 2192, which is far greater than 2128. Therefore, the present encryption algorithm can effectively resist the exhaustive attacks.


## 4.2. Histograms

The histogram of an image reflects the image’s statistical properties. Figure4 displays histograms of the original plain images and the encrypted images. A secure encryption system can make an encrypted image with a uniform histogram to resist any statistical attacks [29]. As shown in Figure 5, the histograms of the encrypted images are evidently different from those of the plain images, which reveals that the pixel values of the encrypted images are evenly distributed. Therefore, the displayed histograms proved that the present scheme is well able to withstand the statistical attacks.Figure 5
Histograms of original plain images (e)-(h) and encrypted images (i)-(l); (a)-(d) the original images.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)


## 4.3. Correlation Coefficient Analysis

Neighboring pixels of plain images have strong correlations. An effective image encryption scheme should be able to reduce these correlations to almost zero. The correlation coefficient (ruv,u and v are two adjacent pixels) is calculated as(25)ruv=covu,vDuDv,where(26)covu,v=1N∑i=1Nui−Euvi−Ev,Du=1N∑i=1Nui−Eu2,Eu=1N∑i=1Nui.In this study, we selected 5,000 pairs of adjacent pixels from both the plain and encrypted images and calculated the correlation coefficients along vertical, horizontal, and diagonal directions. Calculation results are listed in Table2 and Figure 6 compares the correlation coefficients calculated from the original and encrypted image of pepper. It can be seen from Table 2 that the horizontal, vertical, and diagonal correlation coefficients of the original plain images are close to 1 and the corresponding correlation coefficients of the encrypted images are nearly zero. This means that the present algorithm can significantly reduce the correlation coefficients and show desirable encryption performance.Table 2
Correlation coefficients of selected adjacent pixels.
AlgorithmsImagesHorizontalVerticalDiagonalPresent in this paperBaboon (plain)0.7533860.8647580.718634Present in this paperLena (plain)0.9853160.9779140.958496Present in this paperAirplane (plain)0.9701160.9663740.940405Present in this paperPepper (plain)0.9809260.9752150.965311Present in this paperBaboon (encrypted)0.0112260.0166520.004684Present in this paperLena (encrypted)0.016603−0.0071930.001036Present in this paperAirplane (encrypted)0.014916−0.0008450.004081Present in this paperPepper (encrypted)0.0103800.006469−0.010354[30]Lena (encrypted)−0.0288720.0145930.036587[31]Lena (encrypted)−0.02850.00140.0013[32]Lena (encrypted)0.0039−0.03140.0158[12]Lena (encrypted)0.011816−0.0173110.022785Figure 6
Correlation coefficients of the image of pepper (a) plain image; (b)-(d) horizontal, vertical, and diagonal correlation coefficients of the plain image; (e) encrypted image; (f)-(h) horizontal, vertical, and diagonal correlation coefficients of the encrypted image.
(a)(b)(c)(d)(e)(f)(g)(h)


## 4.4. Key Sensitivity Analysis

Next, we use two similar key codes (with slight differences) to encrypt the same image to obtain two encrypted images. If these two images differ markedly from each other, then it means the present algorithm is very sensitive to small changes in key because such small changes would produce great differences between cipher images. Otherwise, the key sensitivity of the algorithm is low. The initial values of the first key code arex0 = 0.4, y0 = 0.9, z0 = 30, and ω0 = 0.6; and those of the second key code are set to be x0 = 0.4 + 10−15, y0 = 0.9, z0 = 30, and ω0 = 0.6. These two keys were used to encrypt the image for the airplane, and the two cipher images are displayed in Figure 7. From that figure, it can be found that the two encrypted images show obvious differences. The key sensitivity of the proposed encryption algorithm is therefore confirmed.Figure 7
Key sensitivity analysis results: (a) a plain image for airplane; (b) a cipher image encrypted using the first key code; (c) a cipher image encrypted using the second key code; and (d) the difference between (b) and (c).
(a)(b)(c)(d)


## 4.5. Information Entropy

Information entropy is a measure of the randomness or uncertainty of image information. Under ideal conditions, the information entropy of a grayscale image should be 8 if the image consists of randomly distributed pixels. Therefore, the information entropy of a cipher image should be close to eight if the cipher image is encrypted using an effective image encryption algorithm. The information entropies of the four plain images and the corresponding encrypted images were calculated, and Table3 lists the calculation results.Table 3
Information entropies of the plain and encrypted figures.
ImageInformation entropy for plain imageInformation entropy for encrypted imageBaboon7.3154997.999338Lena7.3479027.999303Airplane6.7169457.999211Pepper7.5171467.999275From Table3 it can be found that the information entropies of the encrypted images are close to the optimal value 8, which verifies that the presented scheme is secure enough to be used for image transmission. Furthermore, the information entropy of the image of Lena processed using other encryption schemes was calculated as 7.9972 [33], 7.9992 [34], 7.9993 [31], and 7.9991 [35]. Compared to those values, the information entropy of the cipher image encrypted utilizing the present algorithm is closer to 8.


## 4.6. Resistance to Differential Attacks

An effective image encryption scheme should have excellent plain-image sensitivity and be capable of defending against differential attacks. It signifies that any slight change in the original plain image will cause its cipher image to change significantly. The plain image sensitivity of the present image encryption algorithm is determined through the following steps: Assuming a plain image P1, we first change the value of a randomly selected pixel of that image to obtain another plain image P2. Next, both P1 and P2 are encrypted, applying the present encryption algorithm to acquire two cipher images, C1 and C2. Finally, the plain-image sensitivity of the proposed algorithm is determined by comparing C1 with C2. The difference between C1 and C2 is indicated using net pixel change rate (NPCR) (27) and unified average changing intensity (UACI) (28) [36].(27)NPCR=1M×N∑i=1M∑j=1NDi,j×1,(28)UACI=1M×N∑i=1M∑j=1NC1i,j−C2i,j255,where(29)Di,j=1,C1i,j≠C2i,j,0,C1i,j=C2i,j.In equation (29), (C1) (i, j) and C2(i, j) denote pixel values of C1 and C2. The NPCR and UACI of the encrypted images of baboon, Lena, airplane, and pepper are displayed in Table 4. For comparison, that table also contains the NPCR and UACI of the cipher images of Lena encrypted using existing image encryption algorithms.Table 4
NPCR and UACI of cipher images.
Encryption algorithmImageNPCR (%)UACI (%)Present in this studyBaboon99.59373433.544325Present in this studyLena99.59030233.462442Present in this studyAirplane99.60098333.481864Present in this studyPepper99.60212733.453822[31]Lena99.6233.46[37]Lena99.6333.56[38]Lena99.622733.51964From Table4, it is found that compared with other schemes, the UACI and NPCR values yielded from the proposed algorithm are closer to their theoretical values of 99.61% and 33.46%, respectively. In other words, if we use the same key code generated from our algorithm to encrypt two very similar plain images, the obtained cipher images will differ markedly. Hence, it is verified that the developed algorithm is very sensitive to plain images and possesses a strong capacity to resist the differential attacks.


## 4.7. Resistance to Chosen Plain Image Attacks

Our algorithm can effectively defend against chosen plain image attacks. This is because the generated key code is related to the plain image, so different key codes will be acquired for different images. With a chosen plain image attack, the attacker can encrypt a plain image of his or her choice and has access to the resulting cipher image. This information is used to derive the encryption key and break the encryption algorithm. To assess the resistance of the designed algorithm to the chosen plain image attacks, the algorithm was applied to encrypt a 512 × 512 black image and a white image of the same size. The obtained cipher images were analyzed, and the results are displayed in Figure8 and Table 5.Figure 8
Plain and cipher histograms and images: (a) plain black image; (b) plain white image; (c) histogram of the cipher image of the black image; (d) cipher image of the black image; (e) cipher image of the white image; and (f) histogram of the cipher image of the white image.
(a)(b)(c)(d)(e)(f)Table 5
Information entropies and correlation coefficients of the cipher images.
ImageInformation entropyCorrelation coefficientHorizontalVerticalDiagonalWhitePlain image0000Cipher image7.999292−0.02720790.028597−0.0085912BlackPlain image0000Cipher image7.9992570.023715−0.0079270.042870As shown in Table5, the information entropies of the cipher images are very close to 8 and the correlation coefficients are close to 0. Therefore, almost no useful information can be extracted from the cipher images encrypted using the developed algorithm.


## 4.8. Speed Analysis

A good image encryption scheme should possess not only high security but also fast encryption speed. Using the image of Lena as an example, the speed analysis data (Table6) show that compared with other image encryption algorithms, our algorithm is faster in encrypting images.Table 6
Speed analysis results.
Encryption algorithmImage (size)Time (s)Present in this studyLena (256 × 256)0.547[39]Lena (256 × 256)1.532[40]Lena (256 × 256)0.580[12]Lena (256 × 256)2.443


## 4.9. Discussion

The proposed image encryption algorithm consists of two scrambling-diffusion operations. To verify the superiority of two scrambling-diffusion operations over one scrambling-diffusion operation in image encryption, we encrypted the image “Baboon” using the proposed algorithm and an existing image encryption algorithm that only includes one scrambling-diffusion operation separately, and compared the encryption times and information entropies of these two encryptions (Table7). As displayed in Table 7, the times needed for two scrambling-diffusion operations are quite close to those needed for one operation. However, the information entropy of the image encrypted after two scrambling-diffusion operations is better than the information entropy of the image encrypted with one operation. The comparison shows that the proposed encryption algorithm has high efficiency and exhibits greater performance than the algorithm with only one scrambling-diffusion operation.Table 7
Encryption times and information entropies of the encrypted images.
Encryption algorithmsImages (size)Times (s)Information entropiesProposed one with two scrambling-diffusion operationsBaboon (256 × 256)0.5597.999An existing algorithm with one scrambling-diffusion operationBaboon (256 × 256)0.4847.997


## 5. Conclusion

This paper presents an image encryption algorithm based on the hyperchaotic Chen system. In this algorithm, the key code and the diffusion process are directly related to plain images. The present algorithm was employed to encrypt several plain images. Important parameters such as the key space, histograms, correlation coefficients, key and plain-image sensitivity, and information entropy of the cipher images were calculated to validate the encryption performance of the designed algorithm. Simulation results indicate that the proposed algorithm has high security and can effectively defend against the chosen plain image attacks and differential attacks. Therefore, the algorithm possesses high potential for practical applications. The present encryption algorithm will be further improved to enhance its security and encryption speed through the introduction of an image compression algorithm and machine learning techniques. [41, 42].



---

*Source: 8765268-2022-10-04.xml*