# An Image Encryption Algorithm Based on a New Hybrid Power Exponent Chaotic System

Authors: Dongyao Zou; Ming Li; Jun Li; Zhigang Li
Journal: Security and Communication Networks
 (2021)

---

## Abstract

Aiming at the problem of a small parameter value range when a one-dimensional chaotic system presents a chaotic state, this paper proposes a new type of hybrid power exponential chaotic system (HPECS). HPECS combines the classic one-dimensional Sine chaotic system to form a new chaotic system (HPECS-SS). Experiments show that the obtained new chaotic system has better chaotic performance, a more extensive parameter value range, and higher sensitivity. Simultaneously, on the basis of HPECS-SS, a new image encryption algorithm is proposed. The algorithm uses the key generated by the SHA-512 algorithm and HPECS-SS to iteratively output the chaotic sequence, SFY algorithm combines the chaotic sequence to perform two rounds of scrambling on the plaintext sequence to obtain the scrambling sequence, and finally, through the modulus operation to diffuse the scrambling sequence to form the encryption matrix of the plaintext image, simulation experiment analysis shows that the algorithm has a large key space, good encryption effect, and security; the pixel change rate (NPCR) and the normalized average change intensity (UACI) are close to ideal values which can resist various cryptanalysis and attacks.


---

## Body

## 1. Introduction

With the rapid development of the Internet and multimedia transmission technology, image information has become an essential part of people’s daily lives. Massive image information transmission makes image security become the focus of public attention. How to prove the security and confidentiality of image information has become a key research content in the field of information security [1]. Different from ordinary texts, digital images themselves have some unique characteristics, such as vivid images, intuitive expressions, etc., which enable images to be widely used; at the same time, digital images also have unique advantages such as a large amount of data and greater correlation between pixels, which are unmatched by ordinary text. Due to network transmission’s relatively high publicity, image transmission may encounter many security risks, such as copy, paste, tampering, etc. [2, 3]. And because the pixels between the images are relatively strong, if the general traditional encryption algorithm is used, it will cause the slow encryption speed, long encryption time, low efficiency, and other shortcomings, which are not enough to perform better encryption on the image. Therefore, encryption and decryption processing is required to ensure the secure transmission of images [4].The chaotic system has the characteristics of pseudorandomness, extremely high sensitivity to initial values, and unpredictability, making it very suitable for image encryption systems and can improve the efficiency of the security of the encryption system [5–9]. In recent years, chaotic systems have also been extremely hot to be studied. Since the introduction of chaotic systems, there have been several research upsurges. The combination of chaotic system and image encryption has been well researched and used. The combination of the two can perform encryption well. Even if the encryption algorithm is public, a small change in the key will produce a completely different ciphered image, so many scholars have developed many excellent algorithms on this basis [10–12]. Image encryption includes two stages of scrambling and diffusion. Classical replacement algorithms include Arnold-based replacement algorithm [13–15], Baker-based image replacement algorithm [16, 17], and cyclic shift replacement algorithm [18–21], and a permutation algorithm based on sorting. However, many chaotic sequences entangled by chaotic systems have such a problem. The initial conditions and parameters are randomly selected, which cannot resist image attacks very well. Therefore, a stream cipher algorithm based on a one-time key and robust chaotic mapping is designed in [22]. Piecewise linear chaotic mapping is used as the generator of the pseudorandom key stream sequence. The initial conditions are determined by the real random number generator. With generation, this algorithm makes even the same image; after encryption, it will be significantly different, ensuring the security level of the image. The image encryption algorithm studied in [23] uses a one-dimensional chaotic system and the hash value of each plane to rearrange the bit planes to achieve the effect of scrambling diffusion, which can effectively resist exhaustive attacks, statistical analysis attacks, and differential attacks.In the previous image encryption, many researchers have improved a lot in the encryption algorithm scrambling and diffusion methods and have many good encryption effects, but they have done less innovation in chaotic mapping. One-dimensional chaotic systems are often used in encryption systems [24, 25], such as one-dimensional logistic systems, one-dimensional Sine systems, etc. Although one-dimensional systems have many advantages, many one-dimensional systems have shortcomings such as small key space, low confidentiality, slow encryption speed, and low efficiency [26–28]. At the same time, when a one-dimensional chaotic system presents a chaotic state, the parameter value range is relatively small, and the chaotic range is not uniform, so many researchers have modified it on the basis of the one-dimensional chaotic system to expand the value range of the chaotic system parameters. Tan et al. [29] mention the newly modified chaotic system IESL based on the exponential compound type. When the three parameters are within the range, LE is always greater than zero, which proves that the chaotic system modified in this article has strong robustness. If the chaotic map is improved to produce a more complex chaotic sequence, and then the image is encrypted, will there be a better encryption effect? In order to expand the value range of the parameters of the chaotic system and obtain a more complex chaotic sequence, so that the image encryption has better confidentiality, this paper proposes a new hybrid power exponential chaotic system (hybrid power exponential chaotic system: HPECS), which is substituted into a typical one-dimensional chaotic system to form a new chaotic system (HPECS-SS) compared with a typical one-dimensional chaotic system. Using bifurcation graph, Lyapunov exponent, Shannon entropy, etc., to analyse the chaotic performance of HPECS-SS, using the key generated by the SHA-512 algorithm and HPECS-SS to iteratively output the chaotic sequence, the SFY algorithm combined with the chaotic sequence performs two rounds of scrambling on the plaintext sequence to obtain the scrambling sequence, and finally the scrambling sequence is diffused to form the plaintext image through the modulo operation. In the encryption matrix, the simulation results prove that the encryption algorithm has better encryption performance.The structure of this paper is as follows: Section2 reviews the classic one-dimensional chaotic system and proposes HPECS and analyses HPECS-SS; Section 3 proposes an image encryption algorithm based on HPECS; Section 4 gives the decryption of the encryption algorithm scheme; Section 5 is the experimental analysis of the grayscale image encryption effect; Section 6 is the summary of this article.


## 2. The Proposed Chaotic System

### 2.1. Classical One-Dimensional Chaotic System

In the field of image encryption, commonly used chaotic systems include logistic chaotic system and Sine chaotic system. The logistic chaotic system is a classic one-dimensional chaotic system proposed by the mathematical ecologist Robert M. May. Due to the simple structure of the system and the good performance of chaotic behaviour, it has highly complex dynamic behaviour, so it is widely used in the field of information security [30]. The mathematical expression of the logistic chaotic system is(1)xn+1=μxn1−xn0<xn≤1,where μ is the system parameter, and xn is the generated chaotic sequence. The bifurcation diagram of the logistic chaotic system is shown in Figure 1. The value range of parameter μ∈0,4; when μ∈3.57,4, the system exhibits chaotic behaviour, and the periodic window disappears, and when μ ≈4, the logistic mapping distribution presents the maximum state.Figure 1
Bifurcation diagram of logistic chaotic system.Sine chaotic system is also a commonly used one-dimensional chaotic system. The mathematical expression of the Sine chaotic system is(2)xn+1=Mμ,xn=μsinπxn4.The bifurcation diagram of the Sine chaotic system is shown in Figure2. When μ∈3.478,4, the system exhibits chaotic behaviour.Figure 2
Bifurcation diagram of Sine chaotic system.


### 2.2. New Hybrid Power Exponent Chaotic System

The general mathematical expression of HPECS proposed in this paper is as follows:(3)xn+1=μmμ+kμ,xngγ,xn,where m is the system adjustment parameter, and its value will affect the system performance under the condition of fixed kμ,xn, gγ,xn; kμ,xn, gγ,xn can be typical chaotic systems, such as logistic chaotic system and Sine chaotic system, etc. Based on the general mathematical expression of the HPECS system, this paper assigns the Sine chaotic system with the better chaotic performance to kμ,xn, gγ,xn to obtain a new chaotic system, HPECS-SS, whose mathematical expression is(4)xn+1=μmμ+μsinπxn4μsinπxn/4.For HPECS-SS, this paper makes a relevant analysis on the selection ofm parameters. For different values of m, the value range of the chaotic system is compared. It is found that the value range of HPECS-SS is relatively large when m=10, and the variables that can make the system in chaotic behaviour can get better distributed in the phase space. In summary, the chaotic system expression used in the image encryption/decryption process in this paper is(5)xn+1=μ10μ+μsinπxn4μsinπxn/4.The system bifurcation diagram of HPECS-SS is shown in Figure3. The value range of parameter μ∈0,6; when μ∈1.402,6, the system presents chaotic behaviour, and the bifurcation graph presents a chaotic state, and when μ≥1.402, there is no periodic window.Figure 3
Bifurcation diagram of HPECS-SS chaotic system.In order to evaluate the characteristics of the chaotic mapping system of HPECS-SS proposed in this paper, in this section, the sensitivity of HPECS-SS, Shannon Entropy (SE), etc., will be discussed, and the one-dimensional logistic mapping and one-dimensional Sine mapping will be used to compare with HPECS-SS.


#### 2.2.1. Sensitivity Analysis

The Lyapunov exponent (LE) is an important index to evaluate whether a nonlinear system has chaotic motion, and its mathematical expression is(6)LE=limn⟶∞1n∑i=0n−1lnf′xi.The value LE of can be used to evaluate whether the chaotic map has reached the chaotic state at a certain moment. IfLE>0, the chaotic system is in a chaotic state. This paper uses the LE index to test the sensitivity of the chaotic system to the initial value. The test results of the logistic chaotic system, the Sine chaotic system, and the HPECS-SS chaotic system are shown in Figure 4.Figure 4
LE index diagram of three chaotic systems. (a) Logistic chaotic system; (b) sine chaotic system; (c) HPECS-SS chaotic system.
(a)(b)(c)It can be observed from Figure4 that Logistic's LE index shows that μ is greater than 0 after 3.57. When μ≥3.57, the chaotic sequence obtained by the logistic chaotic system is not uniformly distributed in 0,1; the range where LE is greater than 0 is smaller, which will affect the security of the encryption scheme to a certain extent. The LE index of the Sine chaotic system is greater than 0 when μ≥3.478; that is, a chaotic sequence is generated, which has the same problem as the chaotic series generated by logistic. The LE index value of HPECS-SS is greater than 0 after μ≥1.402; that is, a chaotic sequence is generated. Therefore, it can be seen from the comparison that the usable value range of μ of HPECS-SS is larger than the other two one-dimensional chaotic maps.


#### 2.2.2. Shannon Entropy Analysis

Shannon entropy is a nonlinear dynamic parameter that measures the incidence of information in a time series. It can be used to measure the complexity of the output sequence of the system, that is, the degree of irregularity. The larger the Shannon entropy value, the higher the complexity of the time series. This paper uses Shannon entropy to evaluate the complexity of the chaotic sequence generated by HPECS-SS. The Shannon entropy of logistic system, the Sine system, and HPECS-SS in this paper are shown in Figure5. It can be seen from the figure that the Shannon entropy of HPECS-SS reaches its maximum at around 1.5, while the one-dimensional logistic chaotic system reaches its maximum at approximately 4, and the one-dimensional Sine system reaches its maximum at approximately 1.2 and then slowly decreases. It can be seen intuitively that the maximum SE of HPECS-SS is larger than the other two one-dimensional chaotic systems and almost reaches the ideal value. Therefore, the complexity of the output sequence of the new chaotic system is greater than that of the classic one-dimensional chaotic system.Figure 5
Shannon entropy of three chaotic systems.


## 2.1. Classical One-Dimensional Chaotic System

In the field of image encryption, commonly used chaotic systems include logistic chaotic system and Sine chaotic system. The logistic chaotic system is a classic one-dimensional chaotic system proposed by the mathematical ecologist Robert M. May. Due to the simple structure of the system and the good performance of chaotic behaviour, it has highly complex dynamic behaviour, so it is widely used in the field of information security [30]. The mathematical expression of the logistic chaotic system is(1)xn+1=μxn1−xn0<xn≤1,where μ is the system parameter, and xn is the generated chaotic sequence. The bifurcation diagram of the logistic chaotic system is shown in Figure 1. The value range of parameter μ∈0,4; when μ∈3.57,4, the system exhibits chaotic behaviour, and the periodic window disappears, and when μ ≈4, the logistic mapping distribution presents the maximum state.Figure 1
Bifurcation diagram of logistic chaotic system.Sine chaotic system is also a commonly used one-dimensional chaotic system. The mathematical expression of the Sine chaotic system is(2)xn+1=Mμ,xn=μsinπxn4.The bifurcation diagram of the Sine chaotic system is shown in Figure2. When μ∈3.478,4, the system exhibits chaotic behaviour.Figure 2
Bifurcation diagram of Sine chaotic system.


## 2.2. New Hybrid Power Exponent Chaotic System

The general mathematical expression of HPECS proposed in this paper is as follows:(3)xn+1=μmμ+kμ,xngγ,xn,where m is the system adjustment parameter, and its value will affect the system performance under the condition of fixed kμ,xn, gγ,xn; kμ,xn, gγ,xn can be typical chaotic systems, such as logistic chaotic system and Sine chaotic system, etc. Based on the general mathematical expression of the HPECS system, this paper assigns the Sine chaotic system with the better chaotic performance to kμ,xn, gγ,xn to obtain a new chaotic system, HPECS-SS, whose mathematical expression is(4)xn+1=μmμ+μsinπxn4μsinπxn/4.For HPECS-SS, this paper makes a relevant analysis on the selection ofm parameters. For different values of m, the value range of the chaotic system is compared. It is found that the value range of HPECS-SS is relatively large when m=10, and the variables that can make the system in chaotic behaviour can get better distributed in the phase space. In summary, the chaotic system expression used in the image encryption/decryption process in this paper is(5)xn+1=μ10μ+μsinπxn4μsinπxn/4.The system bifurcation diagram of HPECS-SS is shown in Figure3. The value range of parameter μ∈0,6; when μ∈1.402,6, the system presents chaotic behaviour, and the bifurcation graph presents a chaotic state, and when μ≥1.402, there is no periodic window.Figure 3
Bifurcation diagram of HPECS-SS chaotic system.In order to evaluate the characteristics of the chaotic mapping system of HPECS-SS proposed in this paper, in this section, the sensitivity of HPECS-SS, Shannon Entropy (SE), etc., will be discussed, and the one-dimensional logistic mapping and one-dimensional Sine mapping will be used to compare with HPECS-SS.


### 2.2.1. Sensitivity Analysis

The Lyapunov exponent (LE) is an important index to evaluate whether a nonlinear system has chaotic motion, and its mathematical expression is(6)LE=limn⟶∞1n∑i=0n−1lnf′xi.The value LE of can be used to evaluate whether the chaotic map has reached the chaotic state at a certain moment. IfLE>0, the chaotic system is in a chaotic state. This paper uses the LE index to test the sensitivity of the chaotic system to the initial value. The test results of the logistic chaotic system, the Sine chaotic system, and the HPECS-SS chaotic system are shown in Figure 4.Figure 4
LE index diagram of three chaotic systems. (a) Logistic chaotic system; (b) sine chaotic system; (c) HPECS-SS chaotic system.
(a)(b)(c)It can be observed from Figure4 that Logistic's LE index shows that μ is greater than 0 after 3.57. When μ≥3.57, the chaotic sequence obtained by the logistic chaotic system is not uniformly distributed in 0,1; the range where LE is greater than 0 is smaller, which will affect the security of the encryption scheme to a certain extent. The LE index of the Sine chaotic system is greater than 0 when μ≥3.478; that is, a chaotic sequence is generated, which has the same problem as the chaotic series generated by logistic. The LE index value of HPECS-SS is greater than 0 after μ≥1.402; that is, a chaotic sequence is generated. Therefore, it can be seen from the comparison that the usable value range of μ of HPECS-SS is larger than the other two one-dimensional chaotic maps.


### 2.2.2. Shannon Entropy Analysis

Shannon entropy is a nonlinear dynamic parameter that measures the incidence of information in a time series. It can be used to measure the complexity of the output sequence of the system, that is, the degree of irregularity. The larger the Shannon entropy value, the higher the complexity of the time series. This paper uses Shannon entropy to evaluate the complexity of the chaotic sequence generated by HPECS-SS. The Shannon entropy of logistic system, the Sine system, and HPECS-SS in this paper are shown in Figure5. It can be seen from the figure that the Shannon entropy of HPECS-SS reaches its maximum at around 1.5, while the one-dimensional logistic chaotic system reaches its maximum at approximately 4, and the one-dimensional Sine system reaches its maximum at approximately 1.2 and then slowly decreases. It can be seen intuitively that the maximum SE of HPECS-SS is larger than the other two one-dimensional chaotic systems and almost reaches the ideal value. Therefore, the complexity of the output sequence of the new chaotic system is greater than that of the classic one-dimensional chaotic system.Figure 5
Shannon entropy of three chaotic systems.


## 2.2.1. Sensitivity Analysis

The Lyapunov exponent (LE) is an important index to evaluate whether a nonlinear system has chaotic motion, and its mathematical expression is(6)LE=limn⟶∞1n∑i=0n−1lnf′xi.The value LE of can be used to evaluate whether the chaotic map has reached the chaotic state at a certain moment. IfLE>0, the chaotic system is in a chaotic state. This paper uses the LE index to test the sensitivity of the chaotic system to the initial value. The test results of the logistic chaotic system, the Sine chaotic system, and the HPECS-SS chaotic system are shown in Figure 4.Figure 4
LE index diagram of three chaotic systems. (a) Logistic chaotic system; (b) sine chaotic system; (c) HPECS-SS chaotic system.
(a)(b)(c)It can be observed from Figure4 that Logistic's LE index shows that μ is greater than 0 after 3.57. When μ≥3.57, the chaotic sequence obtained by the logistic chaotic system is not uniformly distributed in 0,1; the range where LE is greater than 0 is smaller, which will affect the security of the encryption scheme to a certain extent. The LE index of the Sine chaotic system is greater than 0 when μ≥3.478; that is, a chaotic sequence is generated, which has the same problem as the chaotic series generated by logistic. The LE index value of HPECS-SS is greater than 0 after μ≥1.402; that is, a chaotic sequence is generated. Therefore, it can be seen from the comparison that the usable value range of μ of HPECS-SS is larger than the other two one-dimensional chaotic maps.


## 2.2.2. Shannon Entropy Analysis

Shannon entropy is a nonlinear dynamic parameter that measures the incidence of information in a time series. It can be used to measure the complexity of the output sequence of the system, that is, the degree of irregularity. The larger the Shannon entropy value, the higher the complexity of the time series. This paper uses Shannon entropy to evaluate the complexity of the chaotic sequence generated by HPECS-SS. The Shannon entropy of logistic system, the Sine system, and HPECS-SS in this paper are shown in Figure5. It can be seen from the figure that the Shannon entropy of HPECS-SS reaches its maximum at around 1.5, while the one-dimensional logistic chaotic system reaches its maximum at approximately 4, and the one-dimensional Sine system reaches its maximum at approximately 1.2 and then slowly decreases. It can be seen intuitively that the maximum SE of HPECS-SS is larger than the other two one-dimensional chaotic systems and almost reaches the ideal value. Therefore, the complexity of the output sequence of the new chaotic system is greater than that of the classic one-dimensional chaotic system.Figure 5
Shannon entropy of three chaotic systems.


## 3. Image Encryption Algorithm Based on HPECS-SS

The encryption algorithm proposed in this paper is based on HPECS-SS. The encryption process is divided into three stages: key generation, scrambling, and diffusion. The algorithm framework is shown in Figure6.Figure 6
Algorithm framework diagram.


### 3.1. Key Generation

KeyK=x0,μ0,x1,μ1,x2,μ2,N0,θ,L has a total of 9 parameters, of which x0, x1, x2 are the initial value, μ0, μ1, μ2 are the control parameter, N0 is the iteration parameter, θ control the interception position of the hash sequence, and L control the interception length of the hash sequence. The role of the key K in the system is manifested in two aspects: (1) It is used to generate the initial value and control parameters of the chaotic system; (2) it is used to obtain the subkey in the scrambling-diffusion process.First, discuss the key generation method in this article. The key generation depends on the SHA-512 algorithm. The hash function has the properties of irreversibility and collision resistance. Using these two properties in image encryption can effectively resist attacks on plaintext and ciphered. In order to achieve “one image, one key,” it is ensured that the key and the plaintext image have a strong correlation. According to equations (7) and (8), the plaintext information is used as the input of the SHA-512 algorithm, and a 512-bit hash value Hash is obtained.(7)Hash=SHA−512Psum2.(8)Psum=∑i=1M∑j−1NPi,j,where Hash is a 512-bit binary number; Psum is the sum of all pixels of the plaintext image (image size is M×N).This article makes the following provisions:(9)Hα,β=Hashα:β=hα,hα+1,…,hβ,1≤α≤β≤512.In equation (10), Hα,β represents a hash sequence of length β−α+1, hα is the α−th position of Hash, and hα∈0,1.In order to make the randomness of the initial value and control parameter generation of the chaotic system and the correlation with the plaintext image, a continuous sequenceHθ,θ+LHθ,θ+L of length L is randomly selected from Hash, where L≥8 and θ are random integers and θ∈0,512−L. Hθ,θ+L is used to generate the initial value x0 and the control parameter μ0 that transform the plaintext image sequence into the chaotic image sequence, x0 and μ0 should meet the conditions of equation (5), and the specific calculation equations are as equations (10)–(13).(10)λh=XORHθ,θ+L2L.(11)λP=PsumM×N−PsumM×N.(12)x0=modλh+λP,1.(13)μ0=modx0,b0+c0,where XOR is the exclusive OR function. λn guarantees the randomness generated by x0 and μ0, and λp guarantees the correlation between x0 and μ0 and the plaintext image. In order to make x0 and μ0 in a reasonable interval and avoid local chaotic behaviour, let b0>0, c0>φ here. Similarly, by controlling the values of L and θ, the initial values x1 and x2 and the control parameters μ1 and μ2 can be obtained.For the generation of chaotic sequence, this paper substitutesx0 and μ0 into equation (5) and iterates M×N+N0 times to generate a one-dimensional chaotic sequence of length M×N. N0 is used to eliminate the transient effect produced by the iterative process and the influence on the generation of the chaotic sequence.


### 3.2. Scrambling Stage

The sorting in this paper uses the Gonard scrambling algorithm (Sort Fisher-Yates: SFY), combining the sort scrambling algorithm and the Gonard scrambling algorithm (Fisher-Yates scrambling algorithm), to perform two rounds of sorting on the plaintext sequence. The Fisher-Yates scrambling algorithm is unbiased, and there aren! equal probability arrangements for the sequence of length n.The scrambling is divided into two rounds: one round of scrambling is to sort the plaintext sequence through the chaotic sequence to obtain a round of scrambling sequenceP′=p1′,p2′,…,pM×N'; the second round of scrambling is to scramble the sequence S=s1,s2,…,sM×N through the Fisher-Yates scrambling algorithm to obtain the scrambling sequence. The specific implementation steps are as follows:Step 1: Substitutex0 and μ0 into equation (5) to get the chaotic sequence K0=k10,k20,…,kM×N0 after M×N+N0 iteration.Step 2: Sort the elements in the chaotic sequenceK0 in ascending order to obtain the position sequence K′=k1′,k2′,…,kM×N'; obtain a round of scrambling sequence P′=p1′,p2′,…,pM×N' by the following equation:(14)pi′=pki′.Step 3: Substitutex1 and μ1 into equation (5) to get the chaotic sequence K1=k11,k21,…,kM×N1 after iteration, and let i=M×N.Step 4:j takes a random integer from 0 to i and assigns values to si, sj, and i according to equations (15)–(17):(15)si=pj′.(16)sj=pi′.(17)i=i−1.Step 5: Repeat STEP 4 untili=0, and get the scrambling sequence S=s1,s2,…,sM×N.The pseudocode of the SFY algorithm is as follows (Algorithm1):Algorithm 1: SFY Algorithm.
INPUT:x0, μ0, x1, μ1, P=p1,p2,…,pM×NOUTPUT:S=s1,s2,…,sM×NArrayListChaoticSequence (x, u,M, N, n):defineK=k1,k2,…,kM×Nx0=x.fori=0 in range (M×N+n):xi+1=μγμ+μsinπxi/4μsinπxi/4ifi≥n:ki−N0+1=xi+1end ifend forreturnK=k1,k2,…,kM×NStart:defineP′=p1′,p2′,…,pM×N'S=s1,s2,…,sM×NK0 = ChaoticSequence (x0, μ0, M, N, N0)K′=sortK0pi′=pki′K1 = ChaoticSequence (x1, μ1, M, N, N0)i=M×Nwhile (i ! = 0):si=pj′; sj=pi′; i−−;end whilereturnS=s1,s2,…,sM×NEND


### 3.3. Diffusion Stage

The diffusion process will modify the pixel value through a certain regular method to supplement the problem of only changing the position of the pixel during the scrambling process, which makes it difficult to effectively resist the problem of statistical attacks. The specific steps of the diffusion process in this paper are as follows:Step 1: Substitutex2 and μ2 into equation (5) to get the chaotic sequence K2=k12,k22,…,kM×N2 after iteration.Step 2: IncorporatingK2=k12,k22,⋯,kM×N2 and S=s1,s2,…,sM×N into equation (18), the correlation between the plaintext pixels in the scrambled sequence is diffused into the entire diffused chaotic sequence, and the diffused sequence Q=q1,q2,…,qM×N is obtained.(18)qi=modSi⊕Ki2×2F,2F⊕ηi=1modSi⊕Ki2×2F,2F⊕qi−1other,whereF is the pixel bit depth, and η is the control parameter in the diffusion process.Step 3: Reshape the diffusion sequenceQ into a matrix of M×N to obtain the final encryption matrix Q.The pseudocode of the diffusion phase is shown below:Algorithm 2: Diffusion Algorithm.
INPUT:x2, μ2, S=s1,s2,…,sM×NOUTPUT:QimportChaoticSequence (x, u,M, N, n)Start:defineQ=q1,q2,…,qM×NK2 = ChaoticSequence (x2, μ2, M, N, N0)qi=modSi⊕Ki2×2F,2F⊕ηi=1modSi⊕Ki2×2F,2F⊕qi−1otherQ ← Q=q1,q2,…,qM×NreturnQEND


## 3.1. Key Generation

KeyK=x0,μ0,x1,μ1,x2,μ2,N0,θ,L has a total of 9 parameters, of which x0, x1, x2 are the initial value, μ0, μ1, μ2 are the control parameter, N0 is the iteration parameter, θ control the interception position of the hash sequence, and L control the interception length of the hash sequence. The role of the key K in the system is manifested in two aspects: (1) It is used to generate the initial value and control parameters of the chaotic system; (2) it is used to obtain the subkey in the scrambling-diffusion process.First, discuss the key generation method in this article. The key generation depends on the SHA-512 algorithm. The hash function has the properties of irreversibility and collision resistance. Using these two properties in image encryption can effectively resist attacks on plaintext and ciphered. In order to achieve “one image, one key,” it is ensured that the key and the plaintext image have a strong correlation. According to equations (7) and (8), the plaintext information is used as the input of the SHA-512 algorithm, and a 512-bit hash value Hash is obtained.(7)Hash=SHA−512Psum2.(8)Psum=∑i=1M∑j−1NPi,j,where Hash is a 512-bit binary number; Psum is the sum of all pixels of the plaintext image (image size is M×N).This article makes the following provisions:(9)Hα,β=Hashα:β=hα,hα+1,…,hβ,1≤α≤β≤512.In equation (10), Hα,β represents a hash sequence of length β−α+1, hα is the α−th position of Hash, and hα∈0,1.In order to make the randomness of the initial value and control parameter generation of the chaotic system and the correlation with the plaintext image, a continuous sequenceHθ,θ+LHθ,θ+L of length L is randomly selected from Hash, where L≥8 and θ are random integers and θ∈0,512−L. Hθ,θ+L is used to generate the initial value x0 and the control parameter μ0 that transform the plaintext image sequence into the chaotic image sequence, x0 and μ0 should meet the conditions of equation (5), and the specific calculation equations are as equations (10)–(13).(10)λh=XORHθ,θ+L2L.(11)λP=PsumM×N−PsumM×N.(12)x0=modλh+λP,1.(13)μ0=modx0,b0+c0,where XOR is the exclusive OR function. λn guarantees the randomness generated by x0 and μ0, and λp guarantees the correlation between x0 and μ0 and the plaintext image. In order to make x0 and μ0 in a reasonable interval and avoid local chaotic behaviour, let b0>0, c0>φ here. Similarly, by controlling the values of L and θ, the initial values x1 and x2 and the control parameters μ1 and μ2 can be obtained.For the generation of chaotic sequence, this paper substitutesx0 and μ0 into equation (5) and iterates M×N+N0 times to generate a one-dimensional chaotic sequence of length M×N. N0 is used to eliminate the transient effect produced by the iterative process and the influence on the generation of the chaotic sequence.


## 3.2. Scrambling Stage

The sorting in this paper uses the Gonard scrambling algorithm (Sort Fisher-Yates: SFY), combining the sort scrambling algorithm and the Gonard scrambling algorithm (Fisher-Yates scrambling algorithm), to perform two rounds of sorting on the plaintext sequence. The Fisher-Yates scrambling algorithm is unbiased, and there aren! equal probability arrangements for the sequence of length n.The scrambling is divided into two rounds: one round of scrambling is to sort the plaintext sequence through the chaotic sequence to obtain a round of scrambling sequenceP′=p1′,p2′,…,pM×N'; the second round of scrambling is to scramble the sequence S=s1,s2,…,sM×N through the Fisher-Yates scrambling algorithm to obtain the scrambling sequence. The specific implementation steps are as follows:Step 1: Substitutex0 and μ0 into equation (5) to get the chaotic sequence K0=k10,k20,…,kM×N0 after M×N+N0 iteration.Step 2: Sort the elements in the chaotic sequenceK0 in ascending order to obtain the position sequence K′=k1′,k2′,…,kM×N'; obtain a round of scrambling sequence P′=p1′,p2′,…,pM×N' by the following equation:(14)pi′=pki′.Step 3: Substitutex1 and μ1 into equation (5) to get the chaotic sequence K1=k11,k21,…,kM×N1 after iteration, and let i=M×N.Step 4:j takes a random integer from 0 to i and assigns values to si, sj, and i according to equations (15)–(17):(15)si=pj′.(16)sj=pi′.(17)i=i−1.Step 5: Repeat STEP 4 untili=0, and get the scrambling sequence S=s1,s2,…,sM×N.The pseudocode of the SFY algorithm is as follows (Algorithm1):Algorithm 1: SFY Algorithm.
INPUT:x0, μ0, x1, μ1, P=p1,p2,…,pM×NOUTPUT:S=s1,s2,…,sM×NArrayListChaoticSequence (x, u,M, N, n):defineK=k1,k2,…,kM×Nx0=x.fori=0 in range (M×N+n):xi+1=μγμ+μsinπxi/4μsinπxi/4ifi≥n:ki−N0+1=xi+1end ifend forreturnK=k1,k2,…,kM×NStart:defineP′=p1′,p2′,…,pM×N'S=s1,s2,…,sM×NK0 = ChaoticSequence (x0, μ0, M, N, N0)K′=sortK0pi′=pki′K1 = ChaoticSequence (x1, μ1, M, N, N0)i=M×Nwhile (i ! = 0):si=pj′; sj=pi′; i−−;end whilereturnS=s1,s2,…,sM×NEND


## 3.3. Diffusion Stage

The diffusion process will modify the pixel value through a certain regular method to supplement the problem of only changing the position of the pixel during the scrambling process, which makes it difficult to effectively resist the problem of statistical attacks. The specific steps of the diffusion process in this paper are as follows:Step 1: Substitutex2 and μ2 into equation (5) to get the chaotic sequence K2=k12,k22,…,kM×N2 after iteration.Step 2: IncorporatingK2=k12,k22,⋯,kM×N2 and S=s1,s2,…,sM×N into equation (18), the correlation between the plaintext pixels in the scrambled sequence is diffused into the entire diffused chaotic sequence, and the diffused sequence Q=q1,q2,…,qM×N is obtained.(18)qi=modSi⊕Ki2×2F,2F⊕ηi=1modSi⊕Ki2×2F,2F⊕qi−1other,whereF is the pixel bit depth, and η is the control parameter in the diffusion process.Step 3: Reshape the diffusion sequenceQ into a matrix of M×N to obtain the final encryption matrix Q.The pseudocode of the diffusion phase is shown below:Algorithm 2: Diffusion Algorithm.
INPUT:x2, μ2, S=s1,s2,…,sM×NOUTPUT:QimportChaoticSequence (x, u,M, N, n)Start:defineQ=q1,q2,…,qM×NK2 = ChaoticSequence (x2, μ2, M, N, N0)qi=modSi⊕Ki2×2F,2F⊕ηi=1modSi⊕Ki2×2F,2F⊕qi−1otherQ ← Q=q1,q2,…,qM×NreturnQEND


## 4. Decryption Process

The decryption process is the inverse process of the encryption process. For the image encryption algorithm proposed in this article, it should be noted in the decryption that equation (18) in the expansion process should be equation (19):(19)Si=q1⊕η⊕modSi⊕Ki2×2F,2Fi=1qi⊕Qi+1⊕modSi⊕Ki2×2F,2Fother.


## 5. Simulation Results and Performance Analysis

### 5.1. Simulation Results

In this paper, the grayscale plaintext images of Lena, Peppers, and Cameraman with an image size of 256×256 are selected for simulation, and the simulation results are shown in Figure7. The plaintext image, ciphered image, and decrypted image of the above three images are, respectively, given, where the information of the plaintext image still remains in the decrypted image.Figure 7
Simulation results. (a) Lena Plaintext image; (b) Lena Ciphered image; (c) Lena Decrypted image; (d) Peppers Plaintext image; (e) Peppers Ciphered image; (f) Peppers Decrypted image; (g) Cameraman Plaintext image; (h) Cameraman Ciphered image; (i) Cameraman Decrypted image.
(a)(b)(c)(d)(e)(f)(g)(h)(i)


### 5.2. Key Analysis

#### 5.2.1. Key Space Analysis

Key space is the range of encryption key size, usually in bits. In order to resist brute force attacks, the encryption algorithm needs to have a large enough key space. In this article, the initial value of the chaotic system and the control parametersx0,μ0, x1,μ1, x2,μ2 and the hash sequence obtained through the plaintext image are the keys of the encryption algorithm. The space size of the hash sequence obtained by the SHA-512 algorithm is 2512. When the key space is greater than 2100, it is sufficient to resist brute force attacks [28]. The overall key space of this article is greater than 2512, which has a good effect on resisting brute force attacks.


#### 5.2.2. Key Sensitivity Analysis

In order to verify that the key obtained by the algorithm in this paper has strong sensitivity, we set the parameters ofx0 to 3.838 and 3.826, respectively, and the ciphered images obtained are shown in Figures 8(b) and 8(c). Although there is only a slight change in x0, the obtained key difference is as high as 99.8784%; secondly, perform algebraic operations on the obtained x0=3.838 to get K0−1. The corresponding ciphered image is shown in Figure 8(d). The key difference between K0 and K0−1 reaches 99.9213%. The above results show that the encryption algorithm proposed in this paper is key-sensitive.Figure 8
Key sensitivity analysis diagram. (a) Lena plaintext image; (b) Lena ciphered image (x0=3.838, K0); (c) Lena plaintext image (x0=3.826, K0); (d) Lena ciphered image (x0=3.838K0−1).
(a)(b)(c)(d)


#### 5.2.3. Key Randomness Analysis

This paper uses the NIST sequence randomness test tool to analyse the randomness of the generated key sequence. The test items include 15 items such as frequency test, intrablock frequency test, and linear complexity test. The values obtained for 15 test items are all greater than the significance level of 0.01. The results show that the generated key sequence has strong randomness.


### 5.3. Histogram Analysis

The histogram is used to describe the distribution of image pixel values. If the histogram is unevenly distributed, the attacker can obtain certain information through statistical analysis to crack our encryption scheme and analyse the characteristics of the ciphered image to make the ciphered attack easier. Therefore, in order to verify the maturity of the encryption scheme proposed in this article, the analysis of the histogram is necessary.In this article, three pictures of Lena, Peppers, and Cameraman's histogram distribution are given, as shown in Figure9. It can be seen from the figure that the histogram distribution of the plaintext image is very uneven, while the distribution of the ciphered image is relatively uniform, and the average is near a certain value, indicating that the algorithm can resist statistical attacks well.Figure 9
Image histogram. (a) Lena Plaintext image; (b) Lena Ciphered image (c) Peppers Plaintext image; (d) Peppers Ciphered image; (e) Cameraman Plaintext image; (f) Cameraman Ciphered image.
(a)(b)(c)(d)(e)(f)The smaller the variance value of the histogram, the higher the uniformity of the encrypted image, calculated by formula (20):(20)var=1n2∑i=0n∑j=1n12zi−zj2,where zi and zj are the number of pixels with gray values i and j, respectively, n=M×N.In the simulation experiment, we calculated the variance of the histogram of the three ciphered images of Lena, Peppers, and Cameraman by formula (20), and the calculation results are shown in Table 1. The variances of the three ciphered images of Lena, Peppers, and Cameraman are 5156.719, 5289.979, and 5154.814, respectively. In [15] and [31], the variances of Lena's encrypted image histogram are 5554.829 and 5335.830, respectively, which are greater than any variance in Table 1. It shows that, in the histogram analysis, the algorithm we proposed is also effective.Table 1
Histogram analysis of variance results.
Ciphered imageLenaPeppersCameramanVar5156.7195289.9795154.814In addition to visually analysing the difference between the plaintext image and the ciphered image from the histogram, this paper usesχ2 detection to digitally detect whether the ciphered pixels are evenly distributed. The mathematical expression of the χ2 distribution is(21)χ2=∑i=0nyi−k¯2k¯,where n is the gray level, and n is 255 in this paper; yi is the frequency of pixel i in the image. Suppose the image size is M×N; there are(22)k¯=M×Nn+1.When the confidence level is 0.05,χ20.05255=293.24783; that is, when the χ2 detection value of the image is less than 293.24783, it passes the test. Table 2 shows the histogram χ2 test results of the plaintext image and ciphered image of Lena, Peppers, and Cameraman. The χ2 test results of the ciphered images of the three images are all less than 293.24783, so it can be judged that the ciphered image encrypted by this algorithm is closer to a uniform distribution.Table 2
χ2 test results.
ImageLenaPeppersCameramanPlaintext4039436778113650Ciphered228.0703228.4453281.1953


### 5.4. Adjacent Pixels Correlation Analysis

The adjacent pixels of the image are generally closely related, and their distribution is in the diagonal direction. Because the image is scrambled and diffused by the encryption algorithm, the correlation of the pixels of the ciphered image will become relatively low, and the plaintext image can be obtained by resisting the destruction attack. In order to measure the correlation between the image before and after encryption in different directions (horizontal, vertical, and diagonal), this paper uses equation (22) to calculate the correlation coefficient. Take Lena as an example to test the correlation between the pixels of the plaintext image and the ciphered image. Figures 10 and 11 show the correlation distribution of Lena’s plaintext image and ciphered image in various directions, respectively. Figures 12 and 13 show the correlation distribution of Peppers' plaintext image and ciphered image in various directions, respectively. Figures 14 and 15 show the correlation distribution of Cameraman’s plaintext image and ciphered image in various directions, respectively.(23)rmn=covm,nDmDncovm,n=En−Enm−EmEm=1N∑i=1Nmi,Dm=1N∑i=1Nmi−Em2,where m and n are the coordinates of adjacent pixels in the image.Figure 10
Correlation of Lena plaintext images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)Figure 11
Correlation of Lena ciphered images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)Figure 12
Correlation of Peppers plaintext images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)Figure 13
Correlation of Peppers ciphered images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)Figure 14
Correlation of Cameraman plaintext images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)Figure 15
Correlation of Cameraman ciphered images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)It can be seen from the figure that the pixels of the plaintext image are near the diagonal and are relatively concentrated, and the correlation is relatively high, while the pixels of the ciphered image are evenly distributed, and the correlation between adjacent pixels is relatively low. Calculate the correlation coefficients of the plaintext image and the encrypted image in three directions, and the results are shown in Table3. The results show that the horizontal, vertical, and diagonal values of the original image are very close to 1, which proves that the correlation is relatively high. The correlation coefficient of the ciphered image in the three directions is almost close to 0, and the correlation of the ciphered image is relatively low. At the same time, the results are compared with [20] and [32], and lower correlation coefficients are achieved in some directions.Table 3
Correlation coefficient.
ImageHorizontal directionVertical directionDiagonal directionLena plaintext0.93850.96820.9129Lena ciphered0.0022−0.00020.0044Ref. [32] plaintext0.97180.95260.9419Ref. [32] ciphered0.00200.00520.0069Ref. [33] plaintext0.98760.97600.9626Ref. [33] ciphered−0.0010−0.00590.0072


### 5.5. Information Entropy

In image encryption, information entropy can measure the distribution of information sources. For a grayscale image with a grayscale level of 256, the theoretical value of information entropy is 8. That is, the closer the value of the ciphered image information entropy of the grayscale image to 8, the better the randomness of the information distribution and the higher the security. The calculation equation is(24)Hx=−∑i=02N−1pxilog2pxi,where N is the gray level and pxi is the frequency of the gray value i, the information entropy of the plaintext image and ciphered image of Lena, Peppers, and Cameraman is shown in Table 4. The information entropy of the ciphered image is 7.99749, 7.99749, and 7.99689, which are close to the ideal value and can well meet the security requirements.Table 4
Image information entropy and comparison.
ImageLenaPeppersCameramanPlaintext7.444597.532696.97190Ciphered7.997497.997497.99689


### 5.6. Differential Attack

Differential attack is a kind of plaintext attack. The attacker will make very small changes to the plaintext to observe the changes of the ciphered and establish the association between the plaintext image and the ciphered image. There are two commonly used evaluation indicators for the ability to resist differential attacks: The number of Pixels Change Rate (NPCR) and Unified Average Intensity (UACI) [33]. The values of NPCR and UACI are calculated using the following two equations:(25)NPCR=∑i,jDi,j∗100M∗N,UACI=∑i,jc1i,j−c2i,j/255∗100M∗N,where c1 is a plaintext image, and c2 is a ciphered image; if c1i,j=c2i,j, then there is Di,j=0; otherwise Di,j=1.Generally, the closer the theoretical value of NPCR is to 99.6094% and the closer the theoretical value of UACI is to 33.4635%, the better the algorithm resists differential attacks. In this paper, when calculating the two values, the pixel values ofc11,1, c1256,256 and c21,1, c2256,256 are changed for an image each time, and the results are shown in Table 5. Every time a pixel of the image is changed, the NPCR and UACI obtained are close to the theoretical values. By comparing with literature [32–34], we found that our algorithm has better security and ability to resist related attacks.Table 5
NPCR and UACI.
c11,1c2256,256NPCR (%)UACI (%)NPCR (%)UACI (%)NPCR (%)UACI (%)Lena99.609333.516799.589533.5285Ref. [32]99.650333.4803Peppers99.565133.399299.592533.4094Ref. [33]99.609833.4536Cameraman99.598633.456299.563533.4692Ref. [34]99.610133.4602


### 5.7. Four Common Attack Methods

Kerckhoff principle [34] that is the only thing that should be kept secret in a cryptographic system is the key, and the cryptographic algorithm should be made public. If a cryptographic system needs to be kept secret, the more possible weaknesses will be. Therefore, the cryptanalyst may know the design and work of other cryptographic systems except for the secret key. There are four types of attacks [35]: (1) only ciphered: the cracker only has a string of ciphered; (2) select ciphered: the cracker gains access to the decryption machine; that is, it can select a ciphered character string to construct the corresponding plaintext string; (3) known plaintext: the cracker owns a string of plaintext and the corresponding cipher ciphered; (4) select the plaintext: the opponent obtains temporary access to the encryption machine. Therefore, he can select a plaintext string and construct the corresponding cipher ciphered string. From the perspective of four typical attacks, the plaintext attack is the most powerful attack. If our algorithm can resist this attack, it can also resist several other attacks. The algorithm is sensitive to the initial values x0, x1, x2, and control parameters μ0, μ1, μ2, and if one of the values changes, then K0=k10,k20,…,kM×N0, K′=k1′,k2′,…,kM×N', P′=p1′,p2′,…,pM×N', S=s1,s2,…,sM×N will be completely different. The sequence K2=k12,k22,…,kM×N2, Q=q1,q2,…,qM×N generated in the diffusion stage will also be completely different. This means that different images have different sequences of encryption operations to obtain different encrypted images. Therefore, the algorithm can resist plaintext/ciphered attacks.


### 5.8. Robustness Analysis

During the transmission process, the encrypted image may be affected by noise or loss of information. In order to verify the robustness of the encryption algorithm proposed in this article, this article performs cropping attacks and noise addition attacks on encrypted images. In the experiment, different regions of the image were cropped, and salt and pepper noise with a variance of 0.1 was added. As shown in Figures16–18, respectively, it is shown that when Lena, Baboon, and Boats images are attacked by different degrees of noise, the decrypted images can still be distinguished. Experimental results show that the algorithm proposed in this paper has good antishear and antinoise capabilities and has good robustness.Figure 16
Lena image cropping attack and noise attack results. (a) 1 randomly cropped area; (b) decrypted image corresponding to (a); (c) adding salt and pepper noise with variance of 0.1; (d) decrypted image corresponding to (c); (e) randomly cropped area 1 block + 0.1 salt and pepper noise; (f) decrypted image corresponding to (e).
(a)(b)(c)(d)(e)(f)Figure 17
Baboon image cropping attack and noise attack results. (a) 1 randomly cropped area; (b) decrypted image corresponding to (a); (c) adding salt and pepper noise with variance of 0.1; (d) decrypted image corresponding to (c); (e) randomly cropped area 1 block + 0.1 salt and pepper noise; (f) decrypted image corresponding to (e).
(a)(b)(c)(d)(e)(f)Figure 18
Boats image cropping attack and noise attack results. (a) Random cropping area 1 block; (b) decrypted image corresponding to (a); (c) adding salt and pepper noise with variance of 0.1; (d) decrypted image corresponding to (e); (e) randomly cropped area 1 block + 0.1 salt and pepper noise; (f) decrypted image corresponding to (e).
(a)(b)(c)(d)(e)(f)


## 5.1. Simulation Results

In this paper, the grayscale plaintext images of Lena, Peppers, and Cameraman with an image size of 256×256 are selected for simulation, and the simulation results are shown in Figure7. The plaintext image, ciphered image, and decrypted image of the above three images are, respectively, given, where the information of the plaintext image still remains in the decrypted image.Figure 7
Simulation results. (a) Lena Plaintext image; (b) Lena Ciphered image; (c) Lena Decrypted image; (d) Peppers Plaintext image; (e) Peppers Ciphered image; (f) Peppers Decrypted image; (g) Cameraman Plaintext image; (h) Cameraman Ciphered image; (i) Cameraman Decrypted image.
(a)(b)(c)(d)(e)(f)(g)(h)(i)


## 5.2. Key Analysis

### 5.2.1. Key Space Analysis

Key space is the range of encryption key size, usually in bits. In order to resist brute force attacks, the encryption algorithm needs to have a large enough key space. In this article, the initial value of the chaotic system and the control parametersx0,μ0, x1,μ1, x2,μ2 and the hash sequence obtained through the plaintext image are the keys of the encryption algorithm. The space size of the hash sequence obtained by the SHA-512 algorithm is 2512. When the key space is greater than 2100, it is sufficient to resist brute force attacks [28]. The overall key space of this article is greater than 2512, which has a good effect on resisting brute force attacks.


### 5.2.2. Key Sensitivity Analysis

In order to verify that the key obtained by the algorithm in this paper has strong sensitivity, we set the parameters ofx0 to 3.838 and 3.826, respectively, and the ciphered images obtained are shown in Figures 8(b) and 8(c). Although there is only a slight change in x0, the obtained key difference is as high as 99.8784%; secondly, perform algebraic operations on the obtained x0=3.838 to get K0−1. The corresponding ciphered image is shown in Figure 8(d). The key difference between K0 and K0−1 reaches 99.9213%. The above results show that the encryption algorithm proposed in this paper is key-sensitive.Figure 8
Key sensitivity analysis diagram. (a) Lena plaintext image; (b) Lena ciphered image (x0=3.838, K0); (c) Lena plaintext image (x0=3.826, K0); (d) Lena ciphered image (x0=3.838K0−1).
(a)(b)(c)(d)


### 5.2.3. Key Randomness Analysis

This paper uses the NIST sequence randomness test tool to analyse the randomness of the generated key sequence. The test items include 15 items such as frequency test, intrablock frequency test, and linear complexity test. The values obtained for 15 test items are all greater than the significance level of 0.01. The results show that the generated key sequence has strong randomness.


## 5.2.1. Key Space Analysis

Key space is the range of encryption key size, usually in bits. In order to resist brute force attacks, the encryption algorithm needs to have a large enough key space. In this article, the initial value of the chaotic system and the control parametersx0,μ0, x1,μ1, x2,μ2 and the hash sequence obtained through the plaintext image are the keys of the encryption algorithm. The space size of the hash sequence obtained by the SHA-512 algorithm is 2512. When the key space is greater than 2100, it is sufficient to resist brute force attacks [28]. The overall key space of this article is greater than 2512, which has a good effect on resisting brute force attacks.


## 5.2.2. Key Sensitivity Analysis

In order to verify that the key obtained by the algorithm in this paper has strong sensitivity, we set the parameters ofx0 to 3.838 and 3.826, respectively, and the ciphered images obtained are shown in Figures 8(b) and 8(c). Although there is only a slight change in x0, the obtained key difference is as high as 99.8784%; secondly, perform algebraic operations on the obtained x0=3.838 to get K0−1. The corresponding ciphered image is shown in Figure 8(d). The key difference between K0 and K0−1 reaches 99.9213%. The above results show that the encryption algorithm proposed in this paper is key-sensitive.Figure 8
Key sensitivity analysis diagram. (a) Lena plaintext image; (b) Lena ciphered image (x0=3.838, K0); (c) Lena plaintext image (x0=3.826, K0); (d) Lena ciphered image (x0=3.838K0−1).
(a)(b)(c)(d)


## 5.2.3. Key Randomness Analysis

This paper uses the NIST sequence randomness test tool to analyse the randomness of the generated key sequence. The test items include 15 items such as frequency test, intrablock frequency test, and linear complexity test. The values obtained for 15 test items are all greater than the significance level of 0.01. The results show that the generated key sequence has strong randomness.


## 5.3. Histogram Analysis

The histogram is used to describe the distribution of image pixel values. If the histogram is unevenly distributed, the attacker can obtain certain information through statistical analysis to crack our encryption scheme and analyse the characteristics of the ciphered image to make the ciphered attack easier. Therefore, in order to verify the maturity of the encryption scheme proposed in this article, the analysis of the histogram is necessary.In this article, three pictures of Lena, Peppers, and Cameraman's histogram distribution are given, as shown in Figure9. It can be seen from the figure that the histogram distribution of the plaintext image is very uneven, while the distribution of the ciphered image is relatively uniform, and the average is near a certain value, indicating that the algorithm can resist statistical attacks well.Figure 9
Image histogram. (a) Lena Plaintext image; (b) Lena Ciphered image (c) Peppers Plaintext image; (d) Peppers Ciphered image; (e) Cameraman Plaintext image; (f) Cameraman Ciphered image.
(a)(b)(c)(d)(e)(f)The smaller the variance value of the histogram, the higher the uniformity of the encrypted image, calculated by formula (20):(20)var=1n2∑i=0n∑j=1n12zi−zj2,where zi and zj are the number of pixels with gray values i and j, respectively, n=M×N.In the simulation experiment, we calculated the variance of the histogram of the three ciphered images of Lena, Peppers, and Cameraman by formula (20), and the calculation results are shown in Table 1. The variances of the three ciphered images of Lena, Peppers, and Cameraman are 5156.719, 5289.979, and 5154.814, respectively. In [15] and [31], the variances of Lena's encrypted image histogram are 5554.829 and 5335.830, respectively, which are greater than any variance in Table 1. It shows that, in the histogram analysis, the algorithm we proposed is also effective.Table 1
Histogram analysis of variance results.
Ciphered imageLenaPeppersCameramanVar5156.7195289.9795154.814In addition to visually analysing the difference between the plaintext image and the ciphered image from the histogram, this paper usesχ2 detection to digitally detect whether the ciphered pixels are evenly distributed. The mathematical expression of the χ2 distribution is(21)χ2=∑i=0nyi−k¯2k¯,where n is the gray level, and n is 255 in this paper; yi is the frequency of pixel i in the image. Suppose the image size is M×N; there are(22)k¯=M×Nn+1.When the confidence level is 0.05,χ20.05255=293.24783; that is, when the χ2 detection value of the image is less than 293.24783, it passes the test. Table 2 shows the histogram χ2 test results of the plaintext image and ciphered image of Lena, Peppers, and Cameraman. The χ2 test results of the ciphered images of the three images are all less than 293.24783, so it can be judged that the ciphered image encrypted by this algorithm is closer to a uniform distribution.Table 2
χ2 test results.
ImageLenaPeppersCameramanPlaintext4039436778113650Ciphered228.0703228.4453281.1953


## 5.4. Adjacent Pixels Correlation Analysis

The adjacent pixels of the image are generally closely related, and their distribution is in the diagonal direction. Because the image is scrambled and diffused by the encryption algorithm, the correlation of the pixels of the ciphered image will become relatively low, and the plaintext image can be obtained by resisting the destruction attack. In order to measure the correlation between the image before and after encryption in different directions (horizontal, vertical, and diagonal), this paper uses equation (22) to calculate the correlation coefficient. Take Lena as an example to test the correlation between the pixels of the plaintext image and the ciphered image. Figures 10 and 11 show the correlation distribution of Lena’s plaintext image and ciphered image in various directions, respectively. Figures 12 and 13 show the correlation distribution of Peppers' plaintext image and ciphered image in various directions, respectively. Figures 14 and 15 show the correlation distribution of Cameraman’s plaintext image and ciphered image in various directions, respectively.(23)rmn=covm,nDmDncovm,n=En−Enm−EmEm=1N∑i=1Nmi,Dm=1N∑i=1Nmi−Em2,where m and n are the coordinates of adjacent pixels in the image.Figure 10
Correlation of Lena plaintext images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)Figure 11
Correlation of Lena ciphered images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)Figure 12
Correlation of Peppers plaintext images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)Figure 13
Correlation of Peppers ciphered images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)Figure 14
Correlation of Cameraman plaintext images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)Figure 15
Correlation of Cameraman ciphered images in three directions. (a) Horizontal direction; (b) vertical direction; (c) diagonal direction.
(a)(b)(c)It can be seen from the figure that the pixels of the plaintext image are near the diagonal and are relatively concentrated, and the correlation is relatively high, while the pixels of the ciphered image are evenly distributed, and the correlation between adjacent pixels is relatively low. Calculate the correlation coefficients of the plaintext image and the encrypted image in three directions, and the results are shown in Table3. The results show that the horizontal, vertical, and diagonal values of the original image are very close to 1, which proves that the correlation is relatively high. The correlation coefficient of the ciphered image in the three directions is almost close to 0, and the correlation of the ciphered image is relatively low. At the same time, the results are compared with [20] and [32], and lower correlation coefficients are achieved in some directions.Table 3
Correlation coefficient.
ImageHorizontal directionVertical directionDiagonal directionLena plaintext0.93850.96820.9129Lena ciphered0.0022−0.00020.0044Ref. [32] plaintext0.97180.95260.9419Ref. [32] ciphered0.00200.00520.0069Ref. [33] plaintext0.98760.97600.9626Ref. [33] ciphered−0.0010−0.00590.0072


## 5.5. Information Entropy

In image encryption, information entropy can measure the distribution of information sources. For a grayscale image with a grayscale level of 256, the theoretical value of information entropy is 8. That is, the closer the value of the ciphered image information entropy of the grayscale image to 8, the better the randomness of the information distribution and the higher the security. The calculation equation is(24)Hx=−∑i=02N−1pxilog2pxi,where N is the gray level and pxi is the frequency of the gray value i, the information entropy of the plaintext image and ciphered image of Lena, Peppers, and Cameraman is shown in Table 4. The information entropy of the ciphered image is 7.99749, 7.99749, and 7.99689, which are close to the ideal value and can well meet the security requirements.Table 4
Image information entropy and comparison.
ImageLenaPeppersCameramanPlaintext7.444597.532696.97190Ciphered7.997497.997497.99689


## 5.6. Differential Attack

Differential attack is a kind of plaintext attack. The attacker will make very small changes to the plaintext to observe the changes of the ciphered and establish the association between the plaintext image and the ciphered image. There are two commonly used evaluation indicators for the ability to resist differential attacks: The number of Pixels Change Rate (NPCR) and Unified Average Intensity (UACI) [33]. The values of NPCR and UACI are calculated using the following two equations:(25)NPCR=∑i,jDi,j∗100M∗N,UACI=∑i,jc1i,j−c2i,j/255∗100M∗N,where c1 is a plaintext image, and c2 is a ciphered image; if c1i,j=c2i,j, then there is Di,j=0; otherwise Di,j=1.Generally, the closer the theoretical value of NPCR is to 99.6094% and the closer the theoretical value of UACI is to 33.4635%, the better the algorithm resists differential attacks. In this paper, when calculating the two values, the pixel values ofc11,1, c1256,256 and c21,1, c2256,256 are changed for an image each time, and the results are shown in Table 5. Every time a pixel of the image is changed, the NPCR and UACI obtained are close to the theoretical values. By comparing with literature [32–34], we found that our algorithm has better security and ability to resist related attacks.Table 5
NPCR and UACI.
c11,1c2256,256NPCR (%)UACI (%)NPCR (%)UACI (%)NPCR (%)UACI (%)Lena99.609333.516799.589533.5285Ref. [32]99.650333.4803Peppers99.565133.399299.592533.4094Ref. [33]99.609833.4536Cameraman99.598633.456299.563533.4692Ref. [34]99.610133.4602


## 5.7. Four Common Attack Methods

Kerckhoff principle [34] that is the only thing that should be kept secret in a cryptographic system is the key, and the cryptographic algorithm should be made public. If a cryptographic system needs to be kept secret, the more possible weaknesses will be. Therefore, the cryptanalyst may know the design and work of other cryptographic systems except for the secret key. There are four types of attacks [35]: (1) only ciphered: the cracker only has a string of ciphered; (2) select ciphered: the cracker gains access to the decryption machine; that is, it can select a ciphered character string to construct the corresponding plaintext string; (3) known plaintext: the cracker owns a string of plaintext and the corresponding cipher ciphered; (4) select the plaintext: the opponent obtains temporary access to the encryption machine. Therefore, he can select a plaintext string and construct the corresponding cipher ciphered string. From the perspective of four typical attacks, the plaintext attack is the most powerful attack. If our algorithm can resist this attack, it can also resist several other attacks. The algorithm is sensitive to the initial values x0, x1, x2, and control parameters μ0, μ1, μ2, and if one of the values changes, then K0=k10,k20,…,kM×N0, K′=k1′,k2′,…,kM×N', P′=p1′,p2′,…,pM×N', S=s1,s2,…,sM×N will be completely different. The sequence K2=k12,k22,…,kM×N2, Q=q1,q2,…,qM×N generated in the diffusion stage will also be completely different. This means that different images have different sequences of encryption operations to obtain different encrypted images. Therefore, the algorithm can resist plaintext/ciphered attacks.


## 5.8. Robustness Analysis

During the transmission process, the encrypted image may be affected by noise or loss of information. In order to verify the robustness of the encryption algorithm proposed in this article, this article performs cropping attacks and noise addition attacks on encrypted images. In the experiment, different regions of the image were cropped, and salt and pepper noise with a variance of 0.1 was added. As shown in Figures16–18, respectively, it is shown that when Lena, Baboon, and Boats images are attacked by different degrees of noise, the decrypted images can still be distinguished. Experimental results show that the algorithm proposed in this paper has good antishear and antinoise capabilities and has good robustness.Figure 16
Lena image cropping attack and noise attack results. (a) 1 randomly cropped area; (b) decrypted image corresponding to (a); (c) adding salt and pepper noise with variance of 0.1; (d) decrypted image corresponding to (c); (e) randomly cropped area 1 block + 0.1 salt and pepper noise; (f) decrypted image corresponding to (e).
(a)(b)(c)(d)(e)(f)Figure 17
Baboon image cropping attack and noise attack results. (a) 1 randomly cropped area; (b) decrypted image corresponding to (a); (c) adding salt and pepper noise with variance of 0.1; (d) decrypted image corresponding to (c); (e) randomly cropped area 1 block + 0.1 salt and pepper noise; (f) decrypted image corresponding to (e).
(a)(b)(c)(d)(e)(f)Figure 18
Boats image cropping attack and noise attack results. (a) Random cropping area 1 block; (b) decrypted image corresponding to (a); (c) adding salt and pepper noise with variance of 0.1; (d) decrypted image corresponding to (e); (e) randomly cropped area 1 block + 0.1 salt and pepper noise; (f) decrypted image corresponding to (e).
(a)(b)(c)(d)(e)(f)


## 6. Conclusion

This paper proposes a chaotic system image encryption algorithm based on power exponent operation, combined with one-dimensional Sine chaotic system, and proposes a brand new chaotic system—HPECS-SS. Comparing this system with the ordinary one-dimensional chaotic systems logistic and Sine, it is found that HPECS-SS has a larger parameter range and higher complexity. At the same time, based on HPECS-SS, a new encryption image algorithm is proposed. Experimental results show that the ciphered information entropy, NPCR, and UACI obtained by the algorithm are close to ideal values, which can effectively resist differential attacks and meet the security requirements well. The encryption and decryption in this article are the study of the standard 256 × 256 grayscale image. The later work plans to use the RGB three-channel image input method to realize the colour image encryption research. [36].



---

*Source: 7580971-2021-12-30.xml*