# An Image Encryption Scheme Using a 1D Chaotic Double Section Skew Tent Map

Authors: Rania A. Elmanfaloty; Ehab Abou-Bakr
Journal: Complexity
 (2020)

---

## Abstract

Because of their complex behaviour, simple mathematical and digital hardware representation, one-dimensional (1D) chaotic functions were the earliest choices of cryptologists for applying chaos theory to cryptography. It was discovered later that most of these functions suffer from orbits collapsing into a specific period, especially under finite precision realization and weakness because of their limited number of control parameter(s). This in turn exposed many security issues and was proven to be vulnerable to various types of attacks. This paper addresses the issue of limited number of control parameters by introducing a 1D chaotic function with five control parameters (in addition to the initial condition). Analysis of the function implies its chaotic properties in addition to its ability to generate a cryptographically secured random stream of numbers. To further elaborate on its robustness, a new image encryption algorithm incorporating the function as its random number generator is presented. Various analyses of the new scheme confirm it to be secure with good confusion-diffusion properties.


---

## Body

## 1. Introduction

In the current era, digital technology is changing all aspects of everyday life. It has revolutionized the way data is stored, displayed, and transmitted. However, with the increase of digital-based applications such as mobile communications, cloud storage, and the Internet of things (IoT), more advanced methods of securing these data are also being developed. While many logical/physical techniques exist to protect sensitive data from unauthorized access and accidental or intentional destruction [1], encryption is the most popular method of choice for securing them. As depicted in Figure 1, an encryption/decryption should incorporate three basic elements: a message, an encryption/decryption scheme, and a key [2].Figure 1
Basic encryption/decryption system.Despite the fact that the strength of an algorithm comes from the strength of its key [3, 4], other critical factors come into consideration for the overall performance. Some of these factors would be the computational load of their mathematical representation [5–11], the generated key size, and the randomness of the generated sequence.This is one of many reasons why cryptologists have turned to chaotic functions as many chaotic functions are simple in their mathematical representation [12–14], such as 1-D functions with iterative difference equation [15]. These functions are also characterized by their high sensitivity to initial conditions, aperiodicity, and unpredictability [16]. For all these reasons, these functions seem to be ideal for encryption application.When it comes to hardware implementation, the cost of realizing low dimension maps (specially 1D maps) decreases significantly with respect to higher-order ones. However, PRNG with a single 1D chaotic map as its core proved to be inefficient with generally two main issues [17–22]; (i) its limited number of control parameters and (ii) its orbit collapsing to a specific period under finite precision implementation. Recent studies suggested that 2D chaotic maps may be considered as a midpoint balance between hardware complexity and chaotic performance. This is clearly shown in the recent work of Zhongyun Hua where the complexity of 2D chaotic maps was improved by using a two-dimensional sine chaotification system (2D-SCS) in [23] and two-dimensional modular chaotification system (2D-MCS) in [24].For the second issue, [25, 26] investigated the effect of finite precision on the periodic and chaotic behaviour of the logistic and coupled logistic maps. In [27], further studies of the same effect were conducted on single and coupled skew tent maps, the authors then presented a modified design to reduce the effect of limited finite precision realization on coupled skew tent maps. The finding of the research gives deep insight on how this issue needs a lot of attention in hardware implementation of chaotic systems.This manuscript deals with the first issue mentioned above by introducing a 1D difference chaotic map with five variable parameters (not including the initial condition). The map is first analyzed for chaotic properties and its capability to be used as pseudorandom number generator (PRNG). Then, based on the promising results of the map histograms and statistical analysis, the proposed map will be used as a RING in a new image encryption scheme. Despite the map simplicity, its unique feature of increasing the number of control parameters allowed a key space large enough to withstand brute-force attack. Further analysis of the whole encryption scheme showed good confusion-diffusion properties.This paper is organized as follows: Section2 gives the mathematical representation of the presented map with an investigation of its chaotic properties; in Section 3, a new image encryption algorithm using the introduced map is presented and the encryption results were subjected to many statistical tests to prove its robustness. The conclusion is given in Section 5.


## 2. A 1D Map with Variable Control Parameters

In this section, a 1D map with variable control parameters is introduced. Multiple analysis is conducted to validate its chaotic property. Then, the possibility of employing it as a potential pseudorandom bit generator (PRBG) is tested.


### 2.1. Mathematical Representation

The first order discrete dynamical system in Figure2 is given by(1)xn+1=fx=hp1xn,x∈0,p1,hL1−p1L1−xn,x∈p1,L1,hp2−L1xn−L1,x∈L1,p2,hL2−p2L2−xnx∈p2,L2.where x∈ℝ+:x∈0,L2, and L1,L2,p1,p2,h∈ℝ+ acting as the control parameters. Although the previous postulate stated the range of x and the control parameters to be in positive real number set ℝ+, for the function to exhibit full-chaotic behaviour, the following conditions must be satisfied:(i)
L1<L2,(ii)
p1∈0,L1,(iii)
p2∈L1,L2,(iv)
h=L2.Figure 2
State space of the 1D map in (1).Although the function in (1) may seem to resemble the second iterate of the skew tent map given by(2)fy=yn+1=ynp,y∈ℝ:y∈0,p,1−yn1−py∈ℝ:y∈p,1.It is obvious that more system parameters were added to increase the control on its topology, where the map described by (2) has only one control parameter p, while the proposed function has five L1,L2,p1,p2,h. In addition, expanding the phase space to 0,L2 makes it difficult to estimate the control parameters using chaotic signal estimation technologies for 1D maps [28, 29].


### 2.2. Chaotic Properties of the Proposed Function

In 1989, Devaney [30] set the most common definition for classifying dynamical systems as chaotic; that is, the system should (i) be topologically transitive, (ii) have dense periodic orbits, and (iii) be sensitive to the initial condition xo. We follow this definition to validate the presented function chaotic properties. In addition to that, a numerical calculation of the Lyapunov exponent for different values of the control parameters was conducted.


#### 2.2.1. Topologically Transitivity (Mixing)

LettingX be a topological space, a continuous map f:X⟶X is said to be topologically transitive on X if for any two open nonempty subintervals U1,U2⊂X, there exists an n>0 such that fnU1∩U2≠ϕ, where ϕ is an empty set.The first five iteratesf1,f2,f3,f4,f5 of the function f:0,L2⟶0,L2 in (1) are shown in Figure 3. It is visually clear that any fn iterate has k=22n−1 “skew tent” and the iterate fn maps itself to the interval 0,L2. This implies that n satisfies fnU1∩U2≠ϕ and that the presented function is topologically transitive.Figure 3
Multiple iterates of the function in (1) using xo=0.001,L1=1.5,L2=4.5,h=L2−δ,p1=0.5,p2=3.25, (a) f1, (b) f2, (c) f3, (d) f4, (e) f5.
(a)(b)(c)(d)(e)


#### 2.2.2. Dense Periodic Orbits

By definition, a pointx∈X is a periodic point for f with period n∈ℕ>0 if fnx=x. Thus, by referring to Figure 3, it is obvious that fn intersects a line y=x in 22n locations (once in each interval). As a result, each interval contains a fixed point of fn that results in a periodic orbit of period n. Therefore, periodic points of f are dense in 0,L2.


#### 2.2.3. Sensitivity toxo,p1,p2,L1,L2

Sensitivity to the initial conditionxoThe mapf:X⟶X is sensitive to the initial conditions if for any x∈X and any neighbourhood N of x, there exist y∈N and n≥0 such that fnx−fny>δ, where δ>0.The presented map shows high sensitivity to the initial condition as depicted in Figure4. Two trajectories starting from two nearby initial points xo,xo+d (where d∼10−9) coincide at first and then evolve incoherently afterwards.Sensitivity to the control parametersFigure 4
Sensitivity to the initial conditionxo.p1,p2,L1,L2: To test the sensitivity of the proposed map for any small perturbation in the control parameters, a sequence S1 is generated using the values of p1,p2,L1,L2. Then, another sequence S2 is generated but with a small perturbation of d∼10−9 to any of the control parameters. The cross-correlation results in Figure 5 show that no correlation was detected between S1 and the sequences of S2. This proves the sensitivity of the proposed map to any small change in any of the control parameters.Figure 5
Cross-correlation between two sequencesS1 and S2 generated by (1): (a) same parameters, (b) with p1S2=p1S1+d, (c) p2S2=p2S1+d, (d) L1S2=L1S1+d, and (e) L2S2=L2S1+d, where d∼109. The results show that there is no correlation between the sequences and that the proposed map is very sensitive to any small change in any of the control parameters.
(a)(b)(c)(d)(e)(f)


#### 2.2.4. Lyapunov Exponent (LE)

For a dynamical system with two infinitesimally close initial pointsxoandxo+d generating two nearby trajectories, the rate of exponential divergence of these nearby trajectories is called the Lyapunov exponent and is defined by(3)λ=limn⟶∞1n∑i=0n−1lnδ1δo.where δo and δ1 represent a separation between two trajectories. By itself, the Lyapunov exponent defines the degree of sensitivity to the initial condition. However, for a dynamical system bounded in a finite phase space, it is the familiar test for chaotic behaviour where positive LE indicates chaos.The procedural steps described by Sprott in [31] allow the calculation of the Lyapunov exponent numerically as follows:(1)
Choose any initial condition in the basin of the trajectory.(2)
Sufficiently iterate the map to ensure it is on the trajectory. Select a nearby point with infinitesimal separationδo.(3)
Increment both orbits on iteration and then calculate the new separationδ1  =  xa−xb.(4)
Evaluatelnδ1/δo .(5)
Readjust perturbed trajectory so its separation from the original trajectory is back toδo and is in the same direction as δ1 using xbo=xa1+δoxb1−xa1/δ1.(6)
Repeat steps 4–6 multiple times and then calculate the average of step 5.Since there are multiple system parameters controlling the topology of the presented function, Algorithm1 shows how the Lyapunov exponent was calculated by varying p1 and p2 while fixing L1 to half of L2. The 3D depiction and contour representation of the result in Figures 6(a) and 6(b) show that, for all values of p1 and p2, λ>0 and subsequently the orbit is “unstable.” This emphasizes that the map possesses a chaotic behaviour for all values of p1 and p2. This is also considered an advantage over the LE of the tent map given by (4) and having only one control parameter μ∈0,2. In comparison, it is visible from Figure 6(c) that, for the tent map to be “unstable” λ>0, μ must be greater than “1”, whereas in the proposed map λ>0 for all values of the control parameters:(4)fy=yn+1=μyn,y∈ℝ:y∈0,1/2μ1−yn,y∈ℝ:y∈1/2,1,μ∈0,2.Algorithm 1:3D Lyapunov exponent initialise δ0, i, N, xo
(1)
forp1⟵0 to L1 do(2)
forp2⟵L1 to L2 do(3)
run the map for N times(4)
xao⟵xN(5)
xbo⟵xN+δ0(6)
fori⟵1 to N do(7)
run the map with initialxao(8)
run the map with initialxbo(9)
δ1⟵xai−xbi(10)
λ=lnδ1/δ0(11)
readjust the perturbed trajectory using:(12)
xbo=xa1+δoxb1−xa1/δ1.(13)
end for(14)
end for(15)
end forFigure 6
Calculated Lyapunov exponent for the map in (1) by varying p1 and p2 and the map in (4). (a) 3D LE plot for the map in (1), (b) LE contour representation for the map in (1), and (c) LE for the map in (4).
(a)(b)(c)


### 2.3. Cryptographic Property of the Presented 1D Map

The histogram count shown in Figure7 reveals the uniformity of the output sequence for different (random) values of the control parameters p1,p2,L1,L2. This is an indication of good cryptographic property as a uniform distribution gives little information about the system and its control parameters.Figure 7
Histogram for randomly selected control parameters showing uniform distribution. For the shown figures the parameters were randomly generated as (a)L1=1,L2=2,h=L2−δ,p1=0.25,p2=0.8; (b) L1=1.3,L2=2.5,h=L2−δ,p1=0.75,p2=1.4; (c) L1=3,L2=7,h=L2−δ,p1=1.5,p2=6.8; and (d) L1=2,L2=10,h=L2−δ,p1=1.4,p2=9.7.
(a)(b)(c)(d)The chaotic map described by (1) is used to generate a binary sequence according to the simple and basic scheme shown in Figure 8. The seed xo along with the control parameters is randomly selected. The generated bit-sequence is subjected to a statistical test to check for clear patterns and its suitability as a (PRNG).Figure 8
Simple scheme for generating a binary sequence from the iterated output of (1).


#### 2.3.1. Statistical Testing

The statistical analysis was conducted by the suite provided by the National Institute of Standards and Technology (NIST STS) [32]. NIST package comprises 15 tests that target the discovery of nonrandom patterns in the generated sequence. It tests for two types of hypotheses: null hypothesis H0 (i.e., the sequence under test is random) and the alternative hypothesis Ha (i.e., the sequence under test is not random). After each test, a decision is produced with two possible outcomes, either accept H0 or accept Ha. These decisions are based on calculating the probability (P-value) and comparing it with a significance level α. For cryptographic applications, common values of α are about 0.01. Hence, of P-value ≥α, then the null hypothesis is accepted (random sequence). If P-value <α, then the null hypothesis is rejected (not random).After the test is conducted, the resultantP-values are counted and distributed over ten subintervals in the range of [0, 1]. Overall distribution of these P-values is determined using the incomplete gamma function P‐values=igamc9/2,χ2/2, where χ2 is the chi-square of the resultant P-values of a given test and is calculated using(5)χ2=∑i=110Fi−m/102m/10,where m is the sample size and Fi is the number of P-values in the ith subinterval. NIST considers the sequences to be uniformly distributed if P-values ≥0.0001.The generator is tested by producingm=1000 sequences with a length of 106 bits each (m=100 should be sufficient with respect to α=0.01; however, we choose m=1000 to increase the accuracy of our test and prove the robustness of our system). For each sequence, xo,p1,p2,L1,L2 were randomly chosen and the 15 tests were applied with the results listed in Table 1. To interpret these empirical results, an acceptable proportion range called the confidence region is determined using(6)confidence interval=p^±3p^1−p^m,where p^=1−α and α=0.01. For any test, the evidence that the data is not random is manifested when a result proportion falls outside this interval.Table 1
NIST STS result for 1000 sequences generated by randomly selectedxo,p1,p2,L1,L2.
TestP-valuesPassing ratioResultFrequency0.0235450.992PASSBlock frequency0.1019170.984PASSCumulative sums0.5483140.993PASSRuns0.173770.988PASSLongest run0.4208270.99PASSRank0.7278510.991PASSFFT0.6786860.992PASSNonoverlapping template0.9688630.993PASSOverlapping template0.061260.983PASSUniversal0.159910.991PASSApproximate entropy0.5442540.989PASSRandom excursions0.8153290.9947PASSRandom excursions variant0.8781070.9947PASSSerial0.9723820.991PASSLinear complexity0.0295980.989PASSSubstituting in (6), we get the confidence interval of [0.9805607, 0.9994392]. The proportion of sequences that passes a test and the confidence region is shown in Figure 9, where all proportions lie within the confidence interval region. This is an indication that (1) can be used as PRBG suitable for cryptographic applications.Figure 9
All proportions passing the test lie within the confidence interval.


## 2.1. Mathematical Representation

The first order discrete dynamical system in Figure2 is given by(1)xn+1=fx=hp1xn,x∈0,p1,hL1−p1L1−xn,x∈p1,L1,hp2−L1xn−L1,x∈L1,p2,hL2−p2L2−xnx∈p2,L2.where x∈ℝ+:x∈0,L2, and L1,L2,p1,p2,h∈ℝ+ acting as the control parameters. Although the previous postulate stated the range of x and the control parameters to be in positive real number set ℝ+, for the function to exhibit full-chaotic behaviour, the following conditions must be satisfied:(i)
L1<L2,(ii)
p1∈0,L1,(iii)
p2∈L1,L2,(iv)
h=L2.Figure 2
State space of the 1D map in (1).Although the function in (1) may seem to resemble the second iterate of the skew tent map given by(2)fy=yn+1=ynp,y∈ℝ:y∈0,p,1−yn1−py∈ℝ:y∈p,1.It is obvious that more system parameters were added to increase the control on its topology, where the map described by (2) has only one control parameter p, while the proposed function has five L1,L2,p1,p2,h. In addition, expanding the phase space to 0,L2 makes it difficult to estimate the control parameters using chaotic signal estimation technologies for 1D maps [28, 29].


## 2.2. Chaotic Properties of the Proposed Function

In 1989, Devaney [30] set the most common definition for classifying dynamical systems as chaotic; that is, the system should (i) be topologically transitive, (ii) have dense periodic orbits, and (iii) be sensitive to the initial condition xo. We follow this definition to validate the presented function chaotic properties. In addition to that, a numerical calculation of the Lyapunov exponent for different values of the control parameters was conducted.


### 2.2.1. Topologically Transitivity (Mixing)

LettingX be a topological space, a continuous map f:X⟶X is said to be topologically transitive on X if for any two open nonempty subintervals U1,U2⊂X, there exists an n>0 such that fnU1∩U2≠ϕ, where ϕ is an empty set.The first five iteratesf1,f2,f3,f4,f5 of the function f:0,L2⟶0,L2 in (1) are shown in Figure 3. It is visually clear that any fn iterate has k=22n−1 “skew tent” and the iterate fn maps itself to the interval 0,L2. This implies that n satisfies fnU1∩U2≠ϕ and that the presented function is topologically transitive.Figure 3
Multiple iterates of the function in (1) using xo=0.001,L1=1.5,L2=4.5,h=L2−δ,p1=0.5,p2=3.25, (a) f1, (b) f2, (c) f3, (d) f4, (e) f5.
(a)(b)(c)(d)(e)


### 2.2.2. Dense Periodic Orbits

By definition, a pointx∈X is a periodic point for f with period n∈ℕ>0 if fnx=x. Thus, by referring to Figure 3, it is obvious that fn intersects a line y=x in 22n locations (once in each interval). As a result, each interval contains a fixed point of fn that results in a periodic orbit of period n. Therefore, periodic points of f are dense in 0,L2.


### 2.2.3. Sensitivity toxo,p1,p2,L1,L2

Sensitivity to the initial conditionxoThe mapf:X⟶X is sensitive to the initial conditions if for any x∈X and any neighbourhood N of x, there exist y∈N and n≥0 such that fnx−fny>δ, where δ>0.The presented map shows high sensitivity to the initial condition as depicted in Figure4. Two trajectories starting from two nearby initial points xo,xo+d (where d∼10−9) coincide at first and then evolve incoherently afterwards.Sensitivity to the control parametersFigure 4
Sensitivity to the initial conditionxo.p1,p2,L1,L2: To test the sensitivity of the proposed map for any small perturbation in the control parameters, a sequence S1 is generated using the values of p1,p2,L1,L2. Then, another sequence S2 is generated but with a small perturbation of d∼10−9 to any of the control parameters. The cross-correlation results in Figure 5 show that no correlation was detected between S1 and the sequences of S2. This proves the sensitivity of the proposed map to any small change in any of the control parameters.Figure 5
Cross-correlation between two sequencesS1 and S2 generated by (1): (a) same parameters, (b) with p1S2=p1S1+d, (c) p2S2=p2S1+d, (d) L1S2=L1S1+d, and (e) L2S2=L2S1+d, where d∼109. The results show that there is no correlation between the sequences and that the proposed map is very sensitive to any small change in any of the control parameters.
(a)(b)(c)(d)(e)(f)


### 2.2.4. Lyapunov Exponent (LE)

For a dynamical system with two infinitesimally close initial pointsxoandxo+d generating two nearby trajectories, the rate of exponential divergence of these nearby trajectories is called the Lyapunov exponent and is defined by(3)λ=limn⟶∞1n∑i=0n−1lnδ1δo.where δo and δ1 represent a separation between two trajectories. By itself, the Lyapunov exponent defines the degree of sensitivity to the initial condition. However, for a dynamical system bounded in a finite phase space, it is the familiar test for chaotic behaviour where positive LE indicates chaos.The procedural steps described by Sprott in [31] allow the calculation of the Lyapunov exponent numerically as follows:(1)
Choose any initial condition in the basin of the trajectory.(2)
Sufficiently iterate the map to ensure it is on the trajectory. Select a nearby point with infinitesimal separationδo.(3)
Increment both orbits on iteration and then calculate the new separationδ1  =  xa−xb.(4)
Evaluatelnδ1/δo .(5)
Readjust perturbed trajectory so its separation from the original trajectory is back toδo and is in the same direction as δ1 using xbo=xa1+δoxb1−xa1/δ1.(6)
Repeat steps 4–6 multiple times and then calculate the average of step 5.Since there are multiple system parameters controlling the topology of the presented function, Algorithm1 shows how the Lyapunov exponent was calculated by varying p1 and p2 while fixing L1 to half of L2. The 3D depiction and contour representation of the result in Figures 6(a) and 6(b) show that, for all values of p1 and p2, λ>0 and subsequently the orbit is “unstable.” This emphasizes that the map possesses a chaotic behaviour for all values of p1 and p2. This is also considered an advantage over the LE of the tent map given by (4) and having only one control parameter μ∈0,2. In comparison, it is visible from Figure 6(c) that, for the tent map to be “unstable” λ>0, μ must be greater than “1”, whereas in the proposed map λ>0 for all values of the control parameters:(4)fy=yn+1=μyn,y∈ℝ:y∈0,1/2μ1−yn,y∈ℝ:y∈1/2,1,μ∈0,2.Algorithm 1:3D Lyapunov exponent initialise δ0, i, N, xo
(1)
forp1⟵0 to L1 do(2)
forp2⟵L1 to L2 do(3)
run the map for N times(4)
xao⟵xN(5)
xbo⟵xN+δ0(6)
fori⟵1 to N do(7)
run the map with initialxao(8)
run the map with initialxbo(9)
δ1⟵xai−xbi(10)
λ=lnδ1/δ0(11)
readjust the perturbed trajectory using:(12)
xbo=xa1+δoxb1−xa1/δ1.(13)
end for(14)
end for(15)
end forFigure 6
Calculated Lyapunov exponent for the map in (1) by varying p1 and p2 and the map in (4). (a) 3D LE plot for the map in (1), (b) LE contour representation for the map in (1), and (c) LE for the map in (4).
(a)(b)(c)


## 2.2.1. Topologically Transitivity (Mixing)

LettingX be a topological space, a continuous map f:X⟶X is said to be topologically transitive on X if for any two open nonempty subintervals U1,U2⊂X, there exists an n>0 such that fnU1∩U2≠ϕ, where ϕ is an empty set.The first five iteratesf1,f2,f3,f4,f5 of the function f:0,L2⟶0,L2 in (1) are shown in Figure 3. It is visually clear that any fn iterate has k=22n−1 “skew tent” and the iterate fn maps itself to the interval 0,L2. This implies that n satisfies fnU1∩U2≠ϕ and that the presented function is topologically transitive.Figure 3
Multiple iterates of the function in (1) using xo=0.001,L1=1.5,L2=4.5,h=L2−δ,p1=0.5,p2=3.25, (a) f1, (b) f2, (c) f3, (d) f4, (e) f5.
(a)(b)(c)(d)(e)


## 2.2.2. Dense Periodic Orbits

By definition, a pointx∈X is a periodic point for f with period n∈ℕ>0 if fnx=x. Thus, by referring to Figure 3, it is obvious that fn intersects a line y=x in 22n locations (once in each interval). As a result, each interval contains a fixed point of fn that results in a periodic orbit of period n. Therefore, periodic points of f are dense in 0,L2.


## 2.2.3. Sensitivity toxo,p1,p2,L1,L2

Sensitivity to the initial conditionxoThe mapf:X⟶X is sensitive to the initial conditions if for any x∈X and any neighbourhood N of x, there exist y∈N and n≥0 such that fnx−fny>δ, where δ>0.The presented map shows high sensitivity to the initial condition as depicted in Figure4. Two trajectories starting from two nearby initial points xo,xo+d (where d∼10−9) coincide at first and then evolve incoherently afterwards.Sensitivity to the control parametersFigure 4
Sensitivity to the initial conditionxo.p1,p2,L1,L2: To test the sensitivity of the proposed map for any small perturbation in the control parameters, a sequence S1 is generated using the values of p1,p2,L1,L2. Then, another sequence S2 is generated but with a small perturbation of d∼10−9 to any of the control parameters. The cross-correlation results in Figure 5 show that no correlation was detected between S1 and the sequences of S2. This proves the sensitivity of the proposed map to any small change in any of the control parameters.Figure 5
Cross-correlation between two sequencesS1 and S2 generated by (1): (a) same parameters, (b) with p1S2=p1S1+d, (c) p2S2=p2S1+d, (d) L1S2=L1S1+d, and (e) L2S2=L2S1+d, where d∼109. The results show that there is no correlation between the sequences and that the proposed map is very sensitive to any small change in any of the control parameters.
(a)(b)(c)(d)(e)(f)


## 2.2.4. Lyapunov Exponent (LE)

For a dynamical system with two infinitesimally close initial pointsxoandxo+d generating two nearby trajectories, the rate of exponential divergence of these nearby trajectories is called the Lyapunov exponent and is defined by(3)λ=limn⟶∞1n∑i=0n−1lnδ1δo.where δo and δ1 represent a separation between two trajectories. By itself, the Lyapunov exponent defines the degree of sensitivity to the initial condition. However, for a dynamical system bounded in a finite phase space, it is the familiar test for chaotic behaviour where positive LE indicates chaos.The procedural steps described by Sprott in [31] allow the calculation of the Lyapunov exponent numerically as follows:(1)
Choose any initial condition in the basin of the trajectory.(2)
Sufficiently iterate the map to ensure it is on the trajectory. Select a nearby point with infinitesimal separationδo.(3)
Increment both orbits on iteration and then calculate the new separationδ1  =  xa−xb.(4)
Evaluatelnδ1/δo .(5)
Readjust perturbed trajectory so its separation from the original trajectory is back toδo and is in the same direction as δ1 using xbo=xa1+δoxb1−xa1/δ1.(6)
Repeat steps 4–6 multiple times and then calculate the average of step 5.Since there are multiple system parameters controlling the topology of the presented function, Algorithm1 shows how the Lyapunov exponent was calculated by varying p1 and p2 while fixing L1 to half of L2. The 3D depiction and contour representation of the result in Figures 6(a) and 6(b) show that, for all values of p1 and p2, λ>0 and subsequently the orbit is “unstable.” This emphasizes that the map possesses a chaotic behaviour for all values of p1 and p2. This is also considered an advantage over the LE of the tent map given by (4) and having only one control parameter μ∈0,2. In comparison, it is visible from Figure 6(c) that, for the tent map to be “unstable” λ>0, μ must be greater than “1”, whereas in the proposed map λ>0 for all values of the control parameters:(4)fy=yn+1=μyn,y∈ℝ:y∈0,1/2μ1−yn,y∈ℝ:y∈1/2,1,μ∈0,2.Algorithm 1:3D Lyapunov exponent initialise δ0, i, N, xo
(1)
forp1⟵0 to L1 do(2)
forp2⟵L1 to L2 do(3)
run the map for N times(4)
xao⟵xN(5)
xbo⟵xN+δ0(6)
fori⟵1 to N do(7)
run the map with initialxao(8)
run the map with initialxbo(9)
δ1⟵xai−xbi(10)
λ=lnδ1/δ0(11)
readjust the perturbed trajectory using:(12)
xbo=xa1+δoxb1−xa1/δ1.(13)
end for(14)
end for(15)
end forFigure 6
Calculated Lyapunov exponent for the map in (1) by varying p1 and p2 and the map in (4). (a) 3D LE plot for the map in (1), (b) LE contour representation for the map in (1), and (c) LE for the map in (4).
(a)(b)(c)


## 2.3. Cryptographic Property of the Presented 1D Map

The histogram count shown in Figure7 reveals the uniformity of the output sequence for different (random) values of the control parameters p1,p2,L1,L2. This is an indication of good cryptographic property as a uniform distribution gives little information about the system and its control parameters.Figure 7
Histogram for randomly selected control parameters showing uniform distribution. For the shown figures the parameters were randomly generated as (a)L1=1,L2=2,h=L2−δ,p1=0.25,p2=0.8; (b) L1=1.3,L2=2.5,h=L2−δ,p1=0.75,p2=1.4; (c) L1=3,L2=7,h=L2−δ,p1=1.5,p2=6.8; and (d) L1=2,L2=10,h=L2−δ,p1=1.4,p2=9.7.
(a)(b)(c)(d)The chaotic map described by (1) is used to generate a binary sequence according to the simple and basic scheme shown in Figure 8. The seed xo along with the control parameters is randomly selected. The generated bit-sequence is subjected to a statistical test to check for clear patterns and its suitability as a (PRNG).Figure 8
Simple scheme for generating a binary sequence from the iterated output of (1).


### 2.3.1. Statistical Testing

The statistical analysis was conducted by the suite provided by the National Institute of Standards and Technology (NIST STS) [32]. NIST package comprises 15 tests that target the discovery of nonrandom patterns in the generated sequence. It tests for two types of hypotheses: null hypothesis H0 (i.e., the sequence under test is random) and the alternative hypothesis Ha (i.e., the sequence under test is not random). After each test, a decision is produced with two possible outcomes, either accept H0 or accept Ha. These decisions are based on calculating the probability (P-value) and comparing it with a significance level α. For cryptographic applications, common values of α are about 0.01. Hence, of P-value ≥α, then the null hypothesis is accepted (random sequence). If P-value <α, then the null hypothesis is rejected (not random).After the test is conducted, the resultantP-values are counted and distributed over ten subintervals in the range of [0, 1]. Overall distribution of these P-values is determined using the incomplete gamma function P‐values=igamc9/2,χ2/2, where χ2 is the chi-square of the resultant P-values of a given test and is calculated using(5)χ2=∑i=110Fi−m/102m/10,where m is the sample size and Fi is the number of P-values in the ith subinterval. NIST considers the sequences to be uniformly distributed if P-values ≥0.0001.The generator is tested by producingm=1000 sequences with a length of 106 bits each (m=100 should be sufficient with respect to α=0.01; however, we choose m=1000 to increase the accuracy of our test and prove the robustness of our system). For each sequence, xo,p1,p2,L1,L2 were randomly chosen and the 15 tests were applied with the results listed in Table 1. To interpret these empirical results, an acceptable proportion range called the confidence region is determined using(6)confidence interval=p^±3p^1−p^m,where p^=1−α and α=0.01. For any test, the evidence that the data is not random is manifested when a result proportion falls outside this interval.Table 1
NIST STS result for 1000 sequences generated by randomly selectedxo,p1,p2,L1,L2.
TestP-valuesPassing ratioResultFrequency0.0235450.992PASSBlock frequency0.1019170.984PASSCumulative sums0.5483140.993PASSRuns0.173770.988PASSLongest run0.4208270.99PASSRank0.7278510.991PASSFFT0.6786860.992PASSNonoverlapping template0.9688630.993PASSOverlapping template0.061260.983PASSUniversal0.159910.991PASSApproximate entropy0.5442540.989PASSRandom excursions0.8153290.9947PASSRandom excursions variant0.8781070.9947PASSSerial0.9723820.991PASSLinear complexity0.0295980.989PASSSubstituting in (6), we get the confidence interval of [0.9805607, 0.9994392]. The proportion of sequences that passes a test and the confidence region is shown in Figure 9, where all proportions lie within the confidence interval region. This is an indication that (1) can be used as PRBG suitable for cryptographic applications.Figure 9
All proportions passing the test lie within the confidence interval.


## 2.3.1. Statistical Testing

The statistical analysis was conducted by the suite provided by the National Institute of Standards and Technology (NIST STS) [32]. NIST package comprises 15 tests that target the discovery of nonrandom patterns in the generated sequence. It tests for two types of hypotheses: null hypothesis H0 (i.e., the sequence under test is random) and the alternative hypothesis Ha (i.e., the sequence under test is not random). After each test, a decision is produced with two possible outcomes, either accept H0 or accept Ha. These decisions are based on calculating the probability (P-value) and comparing it with a significance level α. For cryptographic applications, common values of α are about 0.01. Hence, of P-value ≥α, then the null hypothesis is accepted (random sequence). If P-value <α, then the null hypothesis is rejected (not random).After the test is conducted, the resultantP-values are counted and distributed over ten subintervals in the range of [0, 1]. Overall distribution of these P-values is determined using the incomplete gamma function P‐values=igamc9/2,χ2/2, where χ2 is the chi-square of the resultant P-values of a given test and is calculated using(5)χ2=∑i=110Fi−m/102m/10,where m is the sample size and Fi is the number of P-values in the ith subinterval. NIST considers the sequences to be uniformly distributed if P-values ≥0.0001.The generator is tested by producingm=1000 sequences with a length of 106 bits each (m=100 should be sufficient with respect to α=0.01; however, we choose m=1000 to increase the accuracy of our test and prove the robustness of our system). For each sequence, xo,p1,p2,L1,L2 were randomly chosen and the 15 tests were applied with the results listed in Table 1. To interpret these empirical results, an acceptable proportion range called the confidence region is determined using(6)confidence interval=p^±3p^1−p^m,where p^=1−α and α=0.01. For any test, the evidence that the data is not random is manifested when a result proportion falls outside this interval.Table 1
NIST STS result for 1000 sequences generated by randomly selectedxo,p1,p2,L1,L2.
TestP-valuesPassing ratioResultFrequency0.0235450.992PASSBlock frequency0.1019170.984PASSCumulative sums0.5483140.993PASSRuns0.173770.988PASSLongest run0.4208270.99PASSRank0.7278510.991PASSFFT0.6786860.992PASSNonoverlapping template0.9688630.993PASSOverlapping template0.061260.983PASSUniversal0.159910.991PASSApproximate entropy0.5442540.989PASSRandom excursions0.8153290.9947PASSRandom excursions variant0.8781070.9947PASSSerial0.9723820.991PASSLinear complexity0.0295980.989PASSSubstituting in (6), we get the confidence interval of [0.9805607, 0.9994392]. The proportion of sequences that passes a test and the confidence region is shown in Figure 9, where all proportions lie within the confidence interval region. This is an indication that (1) can be used as PRBG suitable for cryptographic applications.Figure 9
All proportions passing the test lie within the confidence interval.


## 3. Application to Image Encryption

Throughout the years, various techniques were devised to achieve the highest possible levels of encryption efficiency [33]. Like other types of data that these methods have been applied to, image encryption is a real challenge due to the evolution in both cryptanalysis techniques and the electronic devices used to apply them [34]. In 1998, Fridrich et al. [35] introduced a scheme based on the baker map; since then, various schemes based on chaotic maps were given in literature [36–51]. The algorithms based on the tent map and skew tent maps have also been investigated. For example, Li et al. [52] proposed image encryption based on a pure chaotic tent map. However, [53] showed that this system suffered from multiple drawbacks since it is very simple and depends only on the diffusion step while omitting the permutation phase. The skew tent map was used in [54] with the orthogonal matrix and in [55] with cellular automata to produce a robust and secure image encryption schemes.In this section, we introduce a new image encryption scheme based on the presented 1D chaotic function along with its security analysis.


### 3.1. The Proposed Scheme

The proposed scheme (Figure10) has four rounds with each round consisting of five horizontal stages as follows:(1)
The dimensionM×N of the image I is calculated and fed along with a key to X=fk1 and Y=gk2. Each function will produce a stream of chaotic random-like numbers with the length l+M×N×4+G×3, where l is the number of eliminated iterations from each chaotic function and G is a gap length used to separate subsequences.(2)
Four subsequencesX1,X2,X3, and X4 are extracted from X transformed to M×N matrices.(3)
Four permutation matricesPM1,PM2,PM3, and PM4 are formed using X1,X2,X3, and X4.(4)
According to the round number, an image is permutedPIn using the permutation matrix PMn.(5)
Four subsequencesY1,Y2,Y3, and Y4 are extracted from Y with Yn used for the diffusion step of PIn to produce Cn.Figure 10
The proposed encryption scheme using two PRNG incorporating the chaotic map described in (1).


#### 3.1.1. Secret Key Structure

Two unique keysk1,k2 are fed to f,g for generating a random-like stream. As seen from Figure 11, the whole key is divided into two subkeys, with each containing the necessary parameters for (1) to operate efficiently, namely, xo,p1,p2,L1,L2,h. As described in the previous section, h is the height of the map and is usually equal to L2. However, it was found that choosing h=L2−δ, where δ is smaller than 1×10−3 will produce numerical sequences with better uniform distribution and random-like properties, thus leading to expanding the key space and increasing the security of the system.Figure 11
Key structure for the proposed scheme.Here, we select the first five variables to be 32 bits each andδ to be 10 bits long. As a result, each key will have a length of 170 bits with an overall of 340 bits for the whole key. The first five variables in each key are calculated based on fixed-point representation using the following formula:(7)var=∑i=−1302−iBi+1.However,δ is calculated using(8)δ=∑i=−14−232i,wherevar represents any of the variables xo,p1,p2,L1,L2, and h. Bi+1 represents the bit position from left to right, structured for two bits as the integer part and 30 bits for the fraction. This directly tackles the weak key property discussed in [56] especially when using floating-point representation to construct the key.


#### 3.1.2. Permutation Stage

The redundancy characteristic in a digital image leads to a high correlation between its adjacent pixels. Hence, breaking this correlation by pixel permutation is an important step for securing a scheme against statistical attacks. In this manuscript, we used a simple and effective permutation algorithm to attain this task (Figure12). We start by using the dimension of the original image M×N and the subkey k1 to generate the following sequence using fx,k1:(9)X=xl,xl+1,xl+2,xl+3,…,xl+M×N×4+G×3,where l and G are the eliminated iterations and the gap between the extracted subsequences. The next step is to extract four equal subsequences from X according to the following formulae:(10)X1=XS1:S2,X2=XS3:S4,X2=XS5:S6,X2=XS7:S8,where(11)S1=l,S2=S1+M×N−1,S3=S2+G,S4=S3+M×N−1,S5=S4+G,S6=S5+M×N−1,S7=S6+G,S8=S7+M×N−1.Figure 12
Steps of constructing the permutation matrix.The extractedX1,X2,X3, and X4 are converted to 2D matrices with dimensions of M×N. For the first round, the 2D matrix from X1 will be sorted first by columns and then by rows, while taking into account the retention of the original location of each cell. The pixels of the original image are then permutated according to these matrices. The same steps are used to permutate the ciphered image from each round.


#### 3.1.3. Diffusion Stage

To increase the resistance against differential attacks, any small change in the original image should lead to nonuniform spreading across the ciphered image. After the permutation stage, the diffusion phase is designed to attain this goal by replacing the bit level value of each encrypted pixel with the previously encrypted pixel and the generated key streamYn according to the following formula:(12)ci=Ai⊕Ei,where Ai is equivalent to I or Cn according to the encryption round. Ei is defined by(13)Ei=1+Y1n×1010mod256,ci−1⊕Yin×1010mod2561+Yin×1010256mod256.Similarly, by reversing the steps in Figure12 and using (12), decryption of the encrypted image can be achieved.


### 3.2. Experimental Results and Security Analysis

An encryption scheme is said to be robust if it withstands its security against all types of known attacks like key brute-force attack, statistical attacks, and differential attack. In this section, the proposed scheme is subjected to various security analysis methods to verify its robustness. All calculations were performed using a 64-bit double-precision floating-point representation. The experimental analysis was done using 64-bit MATLAB (R2015a) running under Windows 10 installed on a Core i7 2.2 GHz machine with 8 GB of RAM.


#### 3.2.1. Security of the Key Space

In the presented algorithm, the secret key consists of two subkeys (k1 and k2, with an overall of 340 bits composing the whole key. Hence, 2340 or ∼10102 attempts are required to brute-force the key. This verifies that the key space is large enough to withstand a brute-force attack.


#### 3.2.2. Key Sensitivity Analysis

An encryption scheme is sensitive to its secret key if (a) a change of one bit in the key will produce a completely different ciphered image and (b) a change of one bit in the key will produce a completely different decrypted image. In Figure5, we proved the sensitivity of the proposed chaotic map to any small change in the initial condition or control parameters. Similarly, the effect of changing the least significant bit in the key on the encrypted image is depicted in Figure 13, where Figure 13(a) is the original image. Then, we used the values listed in Table 2 to initially construct the key=k1,k2. The key is then used to encrypt the original image as shown in Figure 13(b) (we call the encrypted image C1). Figure 13(c) is another encryption (C2) of the original image but by flipping the LSB in one of the control parameters in the original key. To verify if changing only one bit produces a completely different encrypted image, absolute pixel-by-pixel subtraction was performed between C1 and C2C1−C2. The result of this subtraction is shown in Figure 13(d), The noisy figure is an indication that two different encrypted images were produced with a slight change in the original key.Figure 13
Key sensitivity of the proposed algorithm. The effect of changing one bit in the key on the encrypted images: (a) original image, (b) encrypted imageC1 using xo=0×9AC32BC4 in k1 (corresponding to 2.4181622900068759918212890625 in decimal form using (7)), (c) encrypted image C2 using xo = 0 × 9AC32BC4 ⊕ 0 × 000000001 for k1, and (d) absolute pixel-by-pixel difference C1−C2 indicating two different encrypted images were produced.
(a)(b)(c)(d)Table 2
Values used to test for key sensitivity in the proposed algorithm (these values can be converted to their decimal form using (7)).
xop1p2L1L2δk10 × 9AC32BC40 × 3AB3C17D0 × 7CCD1CEB0 × 73C14EB60 × ABDFC4A100101001002k20 × 73C5A4270 × 205AC54F0 × 6213B75A0 × 4147B2170 × 7B241FCA11110101112To further elaborate on this, the previously described test was repeated for all parameters ink1 and k2. The mean square error (MSE) and peak signal-to-noise ratio (PSNR) were calculated according to (14) and (15) and listed in Table 3. The obtained numbers confirm the sensitivity of the scheme to all key parameters. Since k1 is for permuting the pixels and k2 is for changing the gray levels, the results in the table prove that the scheme has good confusion-diffusion properties:(14)MSE=∑i=1M∑j=1NE1i,j−E2i,j2M×N,(15)PSNR=20log10255MSE.Table 3
MSE and PSNR of two encrypted images:C1 by the key in Table 2 and C2 using the same key but changing one parameter.
Changed parameterNew valueMSEPSNR (dB)xo0 × 9AC32BC4, 0×00000001⊕0 × 9AC32BC510.858×1037.7730p10 × 3AB3C17D, 0×00000001⊕0 × 3AB3C17C10.984×1037.7230p20 × 7CCD1CEB, 0 × 00000001⊕0 × 7CCD1CEA10.942×1037.7396L10 × 73C14EB6, 0 × 00000001⊕0 × 73C14EB710.935×1037.7425L20 × ABDFC4A1, 0 × 00000001⊕0 × ABDFC4A010.892×1037.7594δ(0010100100)2 ,(0000000001)2⊕(0010100101)210.974×1037.7268xo0 × 73C5A427, 0×00000001⊕0 × 73C5A42610.961×1037.7320p10 × 205AC54F, 0×00000001⊕0 × 205AC54E10.934×1037.7429p20 × 6213B75A, 0×00000001⊕0 × 6213B75B10.935×1037.7423L10 × 4147B217, 0×00000001⊕0 × 4147B21610.930×1037.7445L20 × 7B241FCA, 0×00000001⊕ 0 × 7B241FCB10.956×1037.7342δ(1111010111)2,(0000000001)2⊕(1111010110)210.878×1037.7653


#### 3.2.3. Histogram Analysis

Histogram shows the distribution of color intensities in an image. A good encryption scheme would produce a ciphered image with a uniformly distributed histogram even for images with weak color intensity distribution.In Figure14, each histogram of an original image shows unique intensity distribution, while all those of the encryption result exhibit a uniform shape. This indicates that the proposed algorithm can resist statistical attacks.Figure 14
Histogram analysis for different images and their ciphered ones (vertically), (i.e., (a) original image, (e) its histogram, (i) encryption of (a), and (m) histogram of the ciphered image.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)


#### 3.2.4. Correlation Analysis

Since the high correlation of adjacent pixels in an image makes it vulnerable to statistical attacks, a robust encryption scheme should be able to break this correlation in the vertical (V), horizontal (H), and diagonal (D) directions. To calculate the correlation coefficientrxy, S random pairs of adjacent pixels are selected and substituted in the following equations:(16)rxy=covx,yDxDy,Dx=1S∑i=1Sxi−Ex2,Dy=1S∑i=1Syi−Ey2,Ex=1S∑i=1Sxi,Ey=1S∑i=1Syi,covx,y=1S∑i=1Sxi−Exyi−Ey.A visual display forS=3000 pixels of such calculations is shown in Figure 15. It is visibly clear that pixel correlation is strong and compacted in the original image, while it is scattered and weak in the ciphered image. The result of subjecting different images to that test is listed in Table 4. All the numbers for the ciphered images suggest weak correlation and robustness against statistical attacks.Figure 15
Correlation analysis using 3000 adjacent pixels, (a) original image, (b) vertical correlation, (c) horizontal correlation, (d) diagonal correlation, (e) ciphered image, (f) vertical correlation, (g) horizontal correlation, and (h) diagonal correlation.
(a)(b)(c)(d)(e)(f)(g)(h)Table 4
Vertical, horizontal, and diagonal correlation of some images and their encrypted ones (source of the original images [57]).
File nameOriginal imageCiphered imageV-correlationH-correlationD-correlationV-correlationH-correlationD-correlation5.1.140.880370.947130.84129−0.008326−0.0611980.0573525.2.080.950970.941370.90008−0.0170240.0144250.0742885.2.090.886810.896320.82119−0.0183920.0096520.0691885.2.100.934300.939940.87766−0.033006−0.0411430.0100295.3.010.983660.972220.967490.0370970.0470650.0750355.3.020.895030.902690.85448−0.0226560.017415−0.0140407.1.010.923720.958240.895540.042068−0.0020030.039041


#### 3.2.5. Information Entropy Analysis

In physics, entropy is a measure of “knowledge”, or its opposite “uncertainty” about a certain system. Applying this definition to cryptography shows that the less information we can extract from the ciphered message, the more secure the ciphering algorithm is. In 1949, Shannon [58] mathematically linked this definition to information security. For image encryption, this equation is given by(17)Hm=−∑i=12nPmilog2Pmi,where n is the number of bits representing the color intensity and Pmi is the probability of a color intensity mi in an image I. For a grayscale image, n  = 8 bits with total gray levels of 256 0∼255; if all gray levels in an image have the same probability Pmi=1/256 which is equivalent to a uniform histogram, then the result of (17) would be 8. This indicates that, as the entropy value increases (very close to 8), less information can be extracted from it. In other words, histogram and entropy are both quantitative measures of “uncertainty”: one with visual representation and the other with a numerical result. In Table 5, the result for the entropy analysis of several ciphered images is listed and confirms the uniform distribution of gray levels in them. Another important factor is to calculate the local Shannon entropy (LSE) of nonoverlapping portions of the image using(18)Hk,TBI=∑i=1kHIBik,where k is the number of blocks, TB is the number of pixels in each block, and HIBi is the Shannon entropy of the block. Table 5 shows the comparison of LSE of the proposed scheme with other schemes using significant value α=0.05, k=30, and TB=1936. This led to a critical interval of (7.901901305, 7.903037329). The table shows that the proposed scheme falls within these critical values for different image sizes.Table 5
Entropy analysis of sample grayscale images.
File nameGlobal entropyLSEOriginalCipheredProposed schemeReference [59]Reference [60]Reference [61]5.1.147.3424327.9971887.9029117.9028377.9027957.9030775.2.087.2010077.9991977.9023427.902797.9028317.9034395.2.096.9939947.9994197.9029707.9029727.9030287.9024955.2.105.7055607.9992437.9020737.9024647.9035117.9029595.3.017.5237377.9998237.9023187.9036617.9031067.9034865.3.026.8303297.9998277.9021187.9025457.9032637.9028427.1.016.0274157.9992777.9025157.9029347.9033627.903452


#### 3.2.6. Resist to Differential Attack Analysis

A robust encryption scheme should also be sensitive to small error in the plaintext. That is, while using the same key, a change in one pixel in the plain image would produce a completely different ciphered image. If a scheme possesses this property, then it has the ability to resist differential attacks. In practice, number of pixels’ change rate (NPCR) and unified average changing intensity (UACI) are the two common methods for measuring this type of sensitivity. Consider two imagesI and I′, where I′ is slightly different from I by one pixel only. Encrypting both images with the same key will produce C and C′.NPCR measures the absolute number of pixels with the same position inC and C′ that changed value(19)NPCRC,C′=∑i,jDi,jT,Di,j=0,whenCi,j=C′i,j,1,whenCi,j≠C′i,j,whereT=M×N is the number of pixels in the image. An ideal scheme would produce NPCR=1 which implies that no relation between C and C′ can be achieved. But since this value is difficult to attain, values very close to unity could be accepted under a certain criterion.UACI measures the average intensity difference betweenC and C′ using the following equation:(20)UACIC,C′=∑i,jCi,j−Ci,jT×L,where L is the maximum level of color intensity. Criterions for accepting the results of both tests were given in [41]. For NPCR, a test result is accepted when it is greater than or equal a one sided hypotheses N with α as its significance level:(21)Nα∗=L+Φ−1αL/TL+1,where Φ⋅−1 is the inverse CDF of the standard normal distribution ℕ0,1.For UACI test, the result of an encryption is considered a pass if its value falls inside the intervalUα∗−,Uα∗+ as follows:(22)Uα∗−=μU−Φ−1α2σU,Uα∗+=μU+Φ−1α2σU,μU=L+23L+3,σU=L+2L2+2L+318L+12LT.Usingα=0.05, typical values of Nα∗, Uα∗−, and Uα∗+ for different image sizes are listed in Table 6.Table 6
Typical values ofNα∗, Uα∗−, and Uα∗+ for different image sizes using α=0.05.
File sizeNPCR (%)UACINα∗Uα∗−Uα∗+256 × 25699.569333.2824%33.6447%512 × 51299.589333.3730%33.5541%1024 × 102499.599433.4183%33.5088%For the proposed algorithm, 26 gray scale images with different sizes were subjected to theNPCR and UACI test α=0.05. The results are listed in Table 7 with all scores passing the tests. These results are a good indication that the proposed algorithm is robust and can withstand differential attacks.Table 7
NPCR and UACI score results for 26 images with different sizes.
File nameNPCR test resultUACI test resultScore%StatusReference [59]Reference [60]Reference [61]Score %StatusReference [59]Reference [60]Reference [61]Dimension 256 × 256Nα∗≥99.5693%Uα∗−,Uα∗+=33.2824%,33.6447%5.1.09.tiff99.5941Pass99.60399.59989.41533.4722Pass33.55233.2900.6985.1.10.tiff99.5728Pass99.63699.62716.20133.6179Pass33.45333.2730.0645.1.11.tiff99.5743Pass99.94299.63552.48933.5225Pass33.58633.3230.4125.1.12.tiff99.5758Pass99.79299.61728.14433.3374Pass33.45333.5350.4405.1.13.tiff99.6459Pass99.79299.6248.67733.5497Pass33.52033.4590.0345.1.14.tiff99.6170Pass99.62199.63248.37833.5752Pass33.44033.39612.094Dimension 512 × 512Nα∗≥99.5893%Uα∗−,Uα∗+=33.3730%,33.5541%5.2.08.tiff99.5918Pass99.96099.61130.74033.4202Pass33.69233.4520.1215.2.09.tiff99.6040Pass99.87699.63223.05033.3967Pass33.54833.4440.0905.2.10.tiff99.5987Pass99.65499.60299.60833.5028Pass33.45433.52733.447.1.01.tiff99.6014Pass99.95799.61311.19233.4886Pass33.64833.5250.0447.1.02.tiff99.6056Pass99.91899.61961.22633.4162Pass33.46533.5310.2407.1.03.tiff99.5975Pass99.84999.61010.53533.5348Pass33.27333.4010.0417.1.04.tiff99.6006Pass99.99199.61822.98933.4449Pass33.20233.5200.1807.1.05.tiff99.6109Pass99.94299.58694.70733.4587Pass33.83033.5052.9717.1.06.tiff99.6113Pass99.67099.60067.93333.4813Pass33.62733.4370.5357.1.07.tiff99.5968Pass99.98399.60847.19733.4569Pass33.60933.5110.1857.1.08.tiff99.6117Pass99.81899.6055.81733.4746Pass33.37533.4180.0237.1.09.tiff99.6151Pass99.87499.61758.37433.4900Pass33.53033.4050.2297.1.10.tiff99.5941Pass99.69799.60699.59533.4539Pass33.43833.53633.39boat.512.tiff99.6009Pass99.71599.6154.51333.3759Pass33.37433.4760.018gray21.512.tiff99.5937Pass99.64399.60935.44333.4828Pass33.50733.4830.279ruler.512.tiff99.6021Pass99.63799.6238.24833.4163Pass33.41533.3530.032Dimension 512 × 512Nα∗≥99.5994%Uα∗−,Uα∗+=33.4183%,33.5088%5.3.01.tiff99.6078Pass99.95099.61312.85233.4706Pass33.50833.4790.1015.3.02.tiff99.6009Pass99.98299.61399.60133.4801Pass33.51433.48233.4197.2.01.tiff99.6010Pass99.98099.60660.13033.4664Pass33.48733.4740.236


#### 3.2.7. Perceptual Security: Peak Signal-to-Noise Ratio (PSNR)

Another indication of encryption quality is to calculate the PSNR between the original image and the ciphered one.(23)PSNR=10log10M×N×2552∑i=0M−1∑j=0N−1Pi,j−Ci,j2,where M×N is the image size and P and C are the plain and ciphered images, respectively. Table 8 lists the PSNR of multiple images, where values greater than 25 indicate good encryption quality.Table 8
Peak signal-to-noise ratio (PSNR) between the plain imageP and the ciphered image C
File nameSizePSNR dB5.1.14.tiff256 × 25628.435.2.08.tiff512 × 51227.98935.2.09.tiff512 × 51225.835.2.10.tiff512 × 51227.98935.3.01.tiff1024 × 102429.135.3.02.tiff1024 × 102429.52


## 3.1. The Proposed Scheme

The proposed scheme (Figure10) has four rounds with each round consisting of five horizontal stages as follows:(1)
The dimensionM×N of the image I is calculated and fed along with a key to X=fk1 and Y=gk2. Each function will produce a stream of chaotic random-like numbers with the length l+M×N×4+G×3, where l is the number of eliminated iterations from each chaotic function and G is a gap length used to separate subsequences.(2)
Four subsequencesX1,X2,X3, and X4 are extracted from X transformed to M×N matrices.(3)
Four permutation matricesPM1,PM2,PM3, and PM4 are formed using X1,X2,X3, and X4.(4)
According to the round number, an image is permutedPIn using the permutation matrix PMn.(5)
Four subsequencesY1,Y2,Y3, and Y4 are extracted from Y with Yn used for the diffusion step of PIn to produce Cn.Figure 10
The proposed encryption scheme using two PRNG incorporating the chaotic map described in (1).


### 3.1.1. Secret Key Structure

Two unique keysk1,k2 are fed to f,g for generating a random-like stream. As seen from Figure 11, the whole key is divided into two subkeys, with each containing the necessary parameters for (1) to operate efficiently, namely, xo,p1,p2,L1,L2,h. As described in the previous section, h is the height of the map and is usually equal to L2. However, it was found that choosing h=L2−δ, where δ is smaller than 1×10−3 will produce numerical sequences with better uniform distribution and random-like properties, thus leading to expanding the key space and increasing the security of the system.Figure 11
Key structure for the proposed scheme.Here, we select the first five variables to be 32 bits each andδ to be 10 bits long. As a result, each key will have a length of 170 bits with an overall of 340 bits for the whole key. The first five variables in each key are calculated based on fixed-point representation using the following formula:(7)var=∑i=−1302−iBi+1.However,δ is calculated using(8)δ=∑i=−14−232i,wherevar represents any of the variables xo,p1,p2,L1,L2, and h. Bi+1 represents the bit position from left to right, structured for two bits as the integer part and 30 bits for the fraction. This directly tackles the weak key property discussed in [56] especially when using floating-point representation to construct the key.


### 3.1.2. Permutation Stage

The redundancy characteristic in a digital image leads to a high correlation between its adjacent pixels. Hence, breaking this correlation by pixel permutation is an important step for securing a scheme against statistical attacks. In this manuscript, we used a simple and effective permutation algorithm to attain this task (Figure12). We start by using the dimension of the original image M×N and the subkey k1 to generate the following sequence using fx,k1:(9)X=xl,xl+1,xl+2,xl+3,…,xl+M×N×4+G×3,where l and G are the eliminated iterations and the gap between the extracted subsequences. The next step is to extract four equal subsequences from X according to the following formulae:(10)X1=XS1:S2,X2=XS3:S4,X2=XS5:S6,X2=XS7:S8,where(11)S1=l,S2=S1+M×N−1,S3=S2+G,S4=S3+M×N−1,S5=S4+G,S6=S5+M×N−1,S7=S6+G,S8=S7+M×N−1.Figure 12
Steps of constructing the permutation matrix.The extractedX1,X2,X3, and X4 are converted to 2D matrices with dimensions of M×N. For the first round, the 2D matrix from X1 will be sorted first by columns and then by rows, while taking into account the retention of the original location of each cell. The pixels of the original image are then permutated according to these matrices. The same steps are used to permutate the ciphered image from each round.


### 3.1.3. Diffusion Stage

To increase the resistance against differential attacks, any small change in the original image should lead to nonuniform spreading across the ciphered image. After the permutation stage, the diffusion phase is designed to attain this goal by replacing the bit level value of each encrypted pixel with the previously encrypted pixel and the generated key streamYn according to the following formula:(12)ci=Ai⊕Ei,where Ai is equivalent to I or Cn according to the encryption round. Ei is defined by(13)Ei=1+Y1n×1010mod256,ci−1⊕Yin×1010mod2561+Yin×1010256mod256.Similarly, by reversing the steps in Figure12 and using (12), decryption of the encrypted image can be achieved.


## 3.1.1. Secret Key Structure

Two unique keysk1,k2 are fed to f,g for generating a random-like stream. As seen from Figure 11, the whole key is divided into two subkeys, with each containing the necessary parameters for (1) to operate efficiently, namely, xo,p1,p2,L1,L2,h. As described in the previous section, h is the height of the map and is usually equal to L2. However, it was found that choosing h=L2−δ, where δ is smaller than 1×10−3 will produce numerical sequences with better uniform distribution and random-like properties, thus leading to expanding the key space and increasing the security of the system.Figure 11
Key structure for the proposed scheme.Here, we select the first five variables to be 32 bits each andδ to be 10 bits long. As a result, each key will have a length of 170 bits with an overall of 340 bits for the whole key. The first five variables in each key are calculated based on fixed-point representation using the following formula:(7)var=∑i=−1302−iBi+1.However,δ is calculated using(8)δ=∑i=−14−232i,wherevar represents any of the variables xo,p1,p2,L1,L2, and h. Bi+1 represents the bit position from left to right, structured for two bits as the integer part and 30 bits for the fraction. This directly tackles the weak key property discussed in [56] especially when using floating-point representation to construct the key.


## 3.1.2. Permutation Stage

The redundancy characteristic in a digital image leads to a high correlation between its adjacent pixels. Hence, breaking this correlation by pixel permutation is an important step for securing a scheme against statistical attacks. In this manuscript, we used a simple and effective permutation algorithm to attain this task (Figure12). We start by using the dimension of the original image M×N and the subkey k1 to generate the following sequence using fx,k1:(9)X=xl,xl+1,xl+2,xl+3,…,xl+M×N×4+G×3,where l and G are the eliminated iterations and the gap between the extracted subsequences. The next step is to extract four equal subsequences from X according to the following formulae:(10)X1=XS1:S2,X2=XS3:S4,X2=XS5:S6,X2=XS7:S8,where(11)S1=l,S2=S1+M×N−1,S3=S2+G,S4=S3+M×N−1,S5=S4+G,S6=S5+M×N−1,S7=S6+G,S8=S7+M×N−1.Figure 12
Steps of constructing the permutation matrix.The extractedX1,X2,X3, and X4 are converted to 2D matrices with dimensions of M×N. For the first round, the 2D matrix from X1 will be sorted first by columns and then by rows, while taking into account the retention of the original location of each cell. The pixels of the original image are then permutated according to these matrices. The same steps are used to permutate the ciphered image from each round.


## 3.1.3. Diffusion Stage

To increase the resistance against differential attacks, any small change in the original image should lead to nonuniform spreading across the ciphered image. After the permutation stage, the diffusion phase is designed to attain this goal by replacing the bit level value of each encrypted pixel with the previously encrypted pixel and the generated key streamYn according to the following formula:(12)ci=Ai⊕Ei,where Ai is equivalent to I or Cn according to the encryption round. Ei is defined by(13)Ei=1+Y1n×1010mod256,ci−1⊕Yin×1010mod2561+Yin×1010256mod256.Similarly, by reversing the steps in Figure12 and using (12), decryption of the encrypted image can be achieved.


## 3.2. Experimental Results and Security Analysis

An encryption scheme is said to be robust if it withstands its security against all types of known attacks like key brute-force attack, statistical attacks, and differential attack. In this section, the proposed scheme is subjected to various security analysis methods to verify its robustness. All calculations were performed using a 64-bit double-precision floating-point representation. The experimental analysis was done using 64-bit MATLAB (R2015a) running under Windows 10 installed on a Core i7 2.2 GHz machine with 8 GB of RAM.


### 3.2.1. Security of the Key Space

In the presented algorithm, the secret key consists of two subkeys (k1 and k2, with an overall of 340 bits composing the whole key. Hence, 2340 or ∼10102 attempts are required to brute-force the key. This verifies that the key space is large enough to withstand a brute-force attack.


### 3.2.2. Key Sensitivity Analysis

An encryption scheme is sensitive to its secret key if (a) a change of one bit in the key will produce a completely different ciphered image and (b) a change of one bit in the key will produce a completely different decrypted image. In Figure5, we proved the sensitivity of the proposed chaotic map to any small change in the initial condition or control parameters. Similarly, the effect of changing the least significant bit in the key on the encrypted image is depicted in Figure 13, where Figure 13(a) is the original image. Then, we used the values listed in Table 2 to initially construct the key=k1,k2. The key is then used to encrypt the original image as shown in Figure 13(b) (we call the encrypted image C1). Figure 13(c) is another encryption (C2) of the original image but by flipping the LSB in one of the control parameters in the original key. To verify if changing only one bit produces a completely different encrypted image, absolute pixel-by-pixel subtraction was performed between C1 and C2C1−C2. The result of this subtraction is shown in Figure 13(d), The noisy figure is an indication that two different encrypted images were produced with a slight change in the original key.Figure 13
Key sensitivity of the proposed algorithm. The effect of changing one bit in the key on the encrypted images: (a) original image, (b) encrypted imageC1 using xo=0×9AC32BC4 in k1 (corresponding to 2.4181622900068759918212890625 in decimal form using (7)), (c) encrypted image C2 using xo = 0 × 9AC32BC4 ⊕ 0 × 000000001 for k1, and (d) absolute pixel-by-pixel difference C1−C2 indicating two different encrypted images were produced.
(a)(b)(c)(d)Table 2
Values used to test for key sensitivity in the proposed algorithm (these values can be converted to their decimal form using (7)).
xop1p2L1L2δk10 × 9AC32BC40 × 3AB3C17D0 × 7CCD1CEB0 × 73C14EB60 × ABDFC4A100101001002k20 × 73C5A4270 × 205AC54F0 × 6213B75A0 × 4147B2170 × 7B241FCA11110101112To further elaborate on this, the previously described test was repeated for all parameters ink1 and k2. The mean square error (MSE) and peak signal-to-noise ratio (PSNR) were calculated according to (14) and (15) and listed in Table 3. The obtained numbers confirm the sensitivity of the scheme to all key parameters. Since k1 is for permuting the pixels and k2 is for changing the gray levels, the results in the table prove that the scheme has good confusion-diffusion properties:(14)MSE=∑i=1M∑j=1NE1i,j−E2i,j2M×N,(15)PSNR=20log10255MSE.Table 3
MSE and PSNR of two encrypted images:C1 by the key in Table 2 and C2 using the same key but changing one parameter.
Changed parameterNew valueMSEPSNR (dB)xo0 × 9AC32BC4, 0×00000001⊕0 × 9AC32BC510.858×1037.7730p10 × 3AB3C17D, 0×00000001⊕0 × 3AB3C17C10.984×1037.7230p20 × 7CCD1CEB, 0 × 00000001⊕0 × 7CCD1CEA10.942×1037.7396L10 × 73C14EB6, 0 × 00000001⊕0 × 73C14EB710.935×1037.7425L20 × ABDFC4A1, 0 × 00000001⊕0 × ABDFC4A010.892×1037.7594δ(0010100100)2 ,(0000000001)2⊕(0010100101)210.974×1037.7268xo0 × 73C5A427, 0×00000001⊕0 × 73C5A42610.961×1037.7320p10 × 205AC54F, 0×00000001⊕0 × 205AC54E10.934×1037.7429p20 × 6213B75A, 0×00000001⊕0 × 6213B75B10.935×1037.7423L10 × 4147B217, 0×00000001⊕0 × 4147B21610.930×1037.7445L20 × 7B241FCA, 0×00000001⊕ 0 × 7B241FCB10.956×1037.7342δ(1111010111)2,(0000000001)2⊕(1111010110)210.878×1037.7653


### 3.2.3. Histogram Analysis

Histogram shows the distribution of color intensities in an image. A good encryption scheme would produce a ciphered image with a uniformly distributed histogram even for images with weak color intensity distribution.In Figure14, each histogram of an original image shows unique intensity distribution, while all those of the encryption result exhibit a uniform shape. This indicates that the proposed algorithm can resist statistical attacks.Figure 14
Histogram analysis for different images and their ciphered ones (vertically), (i.e., (a) original image, (e) its histogram, (i) encryption of (a), and (m) histogram of the ciphered image.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)


### 3.2.4. Correlation Analysis

Since the high correlation of adjacent pixels in an image makes it vulnerable to statistical attacks, a robust encryption scheme should be able to break this correlation in the vertical (V), horizontal (H), and diagonal (D) directions. To calculate the correlation coefficientrxy, S random pairs of adjacent pixels are selected and substituted in the following equations:(16)rxy=covx,yDxDy,Dx=1S∑i=1Sxi−Ex2,Dy=1S∑i=1Syi−Ey2,Ex=1S∑i=1Sxi,Ey=1S∑i=1Syi,covx,y=1S∑i=1Sxi−Exyi−Ey.A visual display forS=3000 pixels of such calculations is shown in Figure 15. It is visibly clear that pixel correlation is strong and compacted in the original image, while it is scattered and weak in the ciphered image. The result of subjecting different images to that test is listed in Table 4. All the numbers for the ciphered images suggest weak correlation and robustness against statistical attacks.Figure 15
Correlation analysis using 3000 adjacent pixels, (a) original image, (b) vertical correlation, (c) horizontal correlation, (d) diagonal correlation, (e) ciphered image, (f) vertical correlation, (g) horizontal correlation, and (h) diagonal correlation.
(a)(b)(c)(d)(e)(f)(g)(h)Table 4
Vertical, horizontal, and diagonal correlation of some images and their encrypted ones (source of the original images [57]).
File nameOriginal imageCiphered imageV-correlationH-correlationD-correlationV-correlationH-correlationD-correlation5.1.140.880370.947130.84129−0.008326−0.0611980.0573525.2.080.950970.941370.90008−0.0170240.0144250.0742885.2.090.886810.896320.82119−0.0183920.0096520.0691885.2.100.934300.939940.87766−0.033006−0.0411430.0100295.3.010.983660.972220.967490.0370970.0470650.0750355.3.020.895030.902690.85448−0.0226560.017415−0.0140407.1.010.923720.958240.895540.042068−0.0020030.039041


### 3.2.5. Information Entropy Analysis

In physics, entropy is a measure of “knowledge”, or its opposite “uncertainty” about a certain system. Applying this definition to cryptography shows that the less information we can extract from the ciphered message, the more secure the ciphering algorithm is. In 1949, Shannon [58] mathematically linked this definition to information security. For image encryption, this equation is given by(17)Hm=−∑i=12nPmilog2Pmi,where n is the number of bits representing the color intensity and Pmi is the probability of a color intensity mi in an image I. For a grayscale image, n  = 8 bits with total gray levels of 256 0∼255; if all gray levels in an image have the same probability Pmi=1/256 which is equivalent to a uniform histogram, then the result of (17) would be 8. This indicates that, as the entropy value increases (very close to 8), less information can be extracted from it. In other words, histogram and entropy are both quantitative measures of “uncertainty”: one with visual representation and the other with a numerical result. In Table 5, the result for the entropy analysis of several ciphered images is listed and confirms the uniform distribution of gray levels in them. Another important factor is to calculate the local Shannon entropy (LSE) of nonoverlapping portions of the image using(18)Hk,TBI=∑i=1kHIBik,where k is the number of blocks, TB is the number of pixels in each block, and HIBi is the Shannon entropy of the block. Table 5 shows the comparison of LSE of the proposed scheme with other schemes using significant value α=0.05, k=30, and TB=1936. This led to a critical interval of (7.901901305, 7.903037329). The table shows that the proposed scheme falls within these critical values for different image sizes.Table 5
Entropy analysis of sample grayscale images.
File nameGlobal entropyLSEOriginalCipheredProposed schemeReference [59]Reference [60]Reference [61]5.1.147.3424327.9971887.9029117.9028377.9027957.9030775.2.087.2010077.9991977.9023427.902797.9028317.9034395.2.096.9939947.9994197.9029707.9029727.9030287.9024955.2.105.7055607.9992437.9020737.9024647.9035117.9029595.3.017.5237377.9998237.9023187.9036617.9031067.9034865.3.026.8303297.9998277.9021187.9025457.9032637.9028427.1.016.0274157.9992777.9025157.9029347.9033627.903452


### 3.2.6. Resist to Differential Attack Analysis

A robust encryption scheme should also be sensitive to small error in the plaintext. That is, while using the same key, a change in one pixel in the plain image would produce a completely different ciphered image. If a scheme possesses this property, then it has the ability to resist differential attacks. In practice, number of pixels’ change rate (NPCR) and unified average changing intensity (UACI) are the two common methods for measuring this type of sensitivity. Consider two imagesI and I′, where I′ is slightly different from I by one pixel only. Encrypting both images with the same key will produce C and C′.NPCR measures the absolute number of pixels with the same position inC and C′ that changed value(19)NPCRC,C′=∑i,jDi,jT,Di,j=0,whenCi,j=C′i,j,1,whenCi,j≠C′i,j,whereT=M×N is the number of pixels in the image. An ideal scheme would produce NPCR=1 which implies that no relation between C and C′ can be achieved. But since this value is difficult to attain, values very close to unity could be accepted under a certain criterion.UACI measures the average intensity difference betweenC and C′ using the following equation:(20)UACIC,C′=∑i,jCi,j−Ci,jT×L,where L is the maximum level of color intensity. Criterions for accepting the results of both tests were given in [41]. For NPCR, a test result is accepted when it is greater than or equal a one sided hypotheses N with α as its significance level:(21)Nα∗=L+Φ−1αL/TL+1,where Φ⋅−1 is the inverse CDF of the standard normal distribution ℕ0,1.For UACI test, the result of an encryption is considered a pass if its value falls inside the intervalUα∗−,Uα∗+ as follows:(22)Uα∗−=μU−Φ−1α2σU,Uα∗+=μU+Φ−1α2σU,μU=L+23L+3,σU=L+2L2+2L+318L+12LT.Usingα=0.05, typical values of Nα∗, Uα∗−, and Uα∗+ for different image sizes are listed in Table 6.Table 6
Typical values ofNα∗, Uα∗−, and Uα∗+ for different image sizes using α=0.05.
File sizeNPCR (%)UACINα∗Uα∗−Uα∗+256 × 25699.569333.2824%33.6447%512 × 51299.589333.3730%33.5541%1024 × 102499.599433.4183%33.5088%For the proposed algorithm, 26 gray scale images with different sizes were subjected to theNPCR and UACI test α=0.05. The results are listed in Table 7 with all scores passing the tests. These results are a good indication that the proposed algorithm is robust and can withstand differential attacks.Table 7
NPCR and UACI score results for 26 images with different sizes.
File nameNPCR test resultUACI test resultScore%StatusReference [59]Reference [60]Reference [61]Score %StatusReference [59]Reference [60]Reference [61]Dimension 256 × 256Nα∗≥99.5693%Uα∗−,Uα∗+=33.2824%,33.6447%5.1.09.tiff99.5941Pass99.60399.59989.41533.4722Pass33.55233.2900.6985.1.10.tiff99.5728Pass99.63699.62716.20133.6179Pass33.45333.2730.0645.1.11.tiff99.5743Pass99.94299.63552.48933.5225Pass33.58633.3230.4125.1.12.tiff99.5758Pass99.79299.61728.14433.3374Pass33.45333.5350.4405.1.13.tiff99.6459Pass99.79299.6248.67733.5497Pass33.52033.4590.0345.1.14.tiff99.6170Pass99.62199.63248.37833.5752Pass33.44033.39612.094Dimension 512 × 512Nα∗≥99.5893%Uα∗−,Uα∗+=33.3730%,33.5541%5.2.08.tiff99.5918Pass99.96099.61130.74033.4202Pass33.69233.4520.1215.2.09.tiff99.6040Pass99.87699.63223.05033.3967Pass33.54833.4440.0905.2.10.tiff99.5987Pass99.65499.60299.60833.5028Pass33.45433.52733.447.1.01.tiff99.6014Pass99.95799.61311.19233.4886Pass33.64833.5250.0447.1.02.tiff99.6056Pass99.91899.61961.22633.4162Pass33.46533.5310.2407.1.03.tiff99.5975Pass99.84999.61010.53533.5348Pass33.27333.4010.0417.1.04.tiff99.6006Pass99.99199.61822.98933.4449Pass33.20233.5200.1807.1.05.tiff99.6109Pass99.94299.58694.70733.4587Pass33.83033.5052.9717.1.06.tiff99.6113Pass99.67099.60067.93333.4813Pass33.62733.4370.5357.1.07.tiff99.5968Pass99.98399.60847.19733.4569Pass33.60933.5110.1857.1.08.tiff99.6117Pass99.81899.6055.81733.4746Pass33.37533.4180.0237.1.09.tiff99.6151Pass99.87499.61758.37433.4900Pass33.53033.4050.2297.1.10.tiff99.5941Pass99.69799.60699.59533.4539Pass33.43833.53633.39boat.512.tiff99.6009Pass99.71599.6154.51333.3759Pass33.37433.4760.018gray21.512.tiff99.5937Pass99.64399.60935.44333.4828Pass33.50733.4830.279ruler.512.tiff99.6021Pass99.63799.6238.24833.4163Pass33.41533.3530.032Dimension 512 × 512Nα∗≥99.5994%Uα∗−,Uα∗+=33.4183%,33.5088%5.3.01.tiff99.6078Pass99.95099.61312.85233.4706Pass33.50833.4790.1015.3.02.tiff99.6009Pass99.98299.61399.60133.4801Pass33.51433.48233.4197.2.01.tiff99.6010Pass99.98099.60660.13033.4664Pass33.48733.4740.236


### 3.2.7. Perceptual Security: Peak Signal-to-Noise Ratio (PSNR)

Another indication of encryption quality is to calculate the PSNR between the original image and the ciphered one.(23)PSNR=10log10M×N×2552∑i=0M−1∑j=0N−1Pi,j−Ci,j2,where M×N is the image size and P and C are the plain and ciphered images, respectively. Table 8 lists the PSNR of multiple images, where values greater than 25 indicate good encryption quality.Table 8
Peak signal-to-noise ratio (PSNR) between the plain imageP and the ciphered image C
File nameSizePSNR dB5.1.14.tiff256 × 25628.435.2.08.tiff512 × 51227.98935.2.09.tiff512 × 51225.835.2.10.tiff512 × 51227.98935.3.01.tiff1024 × 102429.135.3.02.tiff1024 × 102429.52


## 3.2.1. Security of the Key Space

In the presented algorithm, the secret key consists of two subkeys (k1 and k2, with an overall of 340 bits composing the whole key. Hence, 2340 or ∼10102 attempts are required to brute-force the key. This verifies that the key space is large enough to withstand a brute-force attack.


## 3.2.2. Key Sensitivity Analysis

An encryption scheme is sensitive to its secret key if (a) a change of one bit in the key will produce a completely different ciphered image and (b) a change of one bit in the key will produce a completely different decrypted image. In Figure5, we proved the sensitivity of the proposed chaotic map to any small change in the initial condition or control parameters. Similarly, the effect of changing the least significant bit in the key on the encrypted image is depicted in Figure 13, where Figure 13(a) is the original image. Then, we used the values listed in Table 2 to initially construct the key=k1,k2. The key is then used to encrypt the original image as shown in Figure 13(b) (we call the encrypted image C1). Figure 13(c) is another encryption (C2) of the original image but by flipping the LSB in one of the control parameters in the original key. To verify if changing only one bit produces a completely different encrypted image, absolute pixel-by-pixel subtraction was performed between C1 and C2C1−C2. The result of this subtraction is shown in Figure 13(d), The noisy figure is an indication that two different encrypted images were produced with a slight change in the original key.Figure 13
Key sensitivity of the proposed algorithm. The effect of changing one bit in the key on the encrypted images: (a) original image, (b) encrypted imageC1 using xo=0×9AC32BC4 in k1 (corresponding to 2.4181622900068759918212890625 in decimal form using (7)), (c) encrypted image C2 using xo = 0 × 9AC32BC4 ⊕ 0 × 000000001 for k1, and (d) absolute pixel-by-pixel difference C1−C2 indicating two different encrypted images were produced.
(a)(b)(c)(d)Table 2
Values used to test for key sensitivity in the proposed algorithm (these values can be converted to their decimal form using (7)).
xop1p2L1L2δk10 × 9AC32BC40 × 3AB3C17D0 × 7CCD1CEB0 × 73C14EB60 × ABDFC4A100101001002k20 × 73C5A4270 × 205AC54F0 × 6213B75A0 × 4147B2170 × 7B241FCA11110101112To further elaborate on this, the previously described test was repeated for all parameters ink1 and k2. The mean square error (MSE) and peak signal-to-noise ratio (PSNR) were calculated according to (14) and (15) and listed in Table 3. The obtained numbers confirm the sensitivity of the scheme to all key parameters. Since k1 is for permuting the pixels and k2 is for changing the gray levels, the results in the table prove that the scheme has good confusion-diffusion properties:(14)MSE=∑i=1M∑j=1NE1i,j−E2i,j2M×N,(15)PSNR=20log10255MSE.Table 3
MSE and PSNR of two encrypted images:C1 by the key in Table 2 and C2 using the same key but changing one parameter.
Changed parameterNew valueMSEPSNR (dB)xo0 × 9AC32BC4, 0×00000001⊕0 × 9AC32BC510.858×1037.7730p10 × 3AB3C17D, 0×00000001⊕0 × 3AB3C17C10.984×1037.7230p20 × 7CCD1CEB, 0 × 00000001⊕0 × 7CCD1CEA10.942×1037.7396L10 × 73C14EB6, 0 × 00000001⊕0 × 73C14EB710.935×1037.7425L20 × ABDFC4A1, 0 × 00000001⊕0 × ABDFC4A010.892×1037.7594δ(0010100100)2 ,(0000000001)2⊕(0010100101)210.974×1037.7268xo0 × 73C5A427, 0×00000001⊕0 × 73C5A42610.961×1037.7320p10 × 205AC54F, 0×00000001⊕0 × 205AC54E10.934×1037.7429p20 × 6213B75A, 0×00000001⊕0 × 6213B75B10.935×1037.7423L10 × 4147B217, 0×00000001⊕0 × 4147B21610.930×1037.7445L20 × 7B241FCA, 0×00000001⊕ 0 × 7B241FCB10.956×1037.7342δ(1111010111)2,(0000000001)2⊕(1111010110)210.878×1037.7653


## 3.2.3. Histogram Analysis

Histogram shows the distribution of color intensities in an image. A good encryption scheme would produce a ciphered image with a uniformly distributed histogram even for images with weak color intensity distribution.In Figure14, each histogram of an original image shows unique intensity distribution, while all those of the encryption result exhibit a uniform shape. This indicates that the proposed algorithm can resist statistical attacks.Figure 14
Histogram analysis for different images and their ciphered ones (vertically), (i.e., (a) original image, (e) its histogram, (i) encryption of (a), and (m) histogram of the ciphered image.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)


## 3.2.4. Correlation Analysis

Since the high correlation of adjacent pixels in an image makes it vulnerable to statistical attacks, a robust encryption scheme should be able to break this correlation in the vertical (V), horizontal (H), and diagonal (D) directions. To calculate the correlation coefficientrxy, S random pairs of adjacent pixels are selected and substituted in the following equations:(16)rxy=covx,yDxDy,Dx=1S∑i=1Sxi−Ex2,Dy=1S∑i=1Syi−Ey2,Ex=1S∑i=1Sxi,Ey=1S∑i=1Syi,covx,y=1S∑i=1Sxi−Exyi−Ey.A visual display forS=3000 pixels of such calculations is shown in Figure 15. It is visibly clear that pixel correlation is strong and compacted in the original image, while it is scattered and weak in the ciphered image. The result of subjecting different images to that test is listed in Table 4. All the numbers for the ciphered images suggest weak correlation and robustness against statistical attacks.Figure 15
Correlation analysis using 3000 adjacent pixels, (a) original image, (b) vertical correlation, (c) horizontal correlation, (d) diagonal correlation, (e) ciphered image, (f) vertical correlation, (g) horizontal correlation, and (h) diagonal correlation.
(a)(b)(c)(d)(e)(f)(g)(h)Table 4
Vertical, horizontal, and diagonal correlation of some images and their encrypted ones (source of the original images [57]).
File nameOriginal imageCiphered imageV-correlationH-correlationD-correlationV-correlationH-correlationD-correlation5.1.140.880370.947130.84129−0.008326−0.0611980.0573525.2.080.950970.941370.90008−0.0170240.0144250.0742885.2.090.886810.896320.82119−0.0183920.0096520.0691885.2.100.934300.939940.87766−0.033006−0.0411430.0100295.3.010.983660.972220.967490.0370970.0470650.0750355.3.020.895030.902690.85448−0.0226560.017415−0.0140407.1.010.923720.958240.895540.042068−0.0020030.039041


## 3.2.5. Information Entropy Analysis

In physics, entropy is a measure of “knowledge”, or its opposite “uncertainty” about a certain system. Applying this definition to cryptography shows that the less information we can extract from the ciphered message, the more secure the ciphering algorithm is. In 1949, Shannon [58] mathematically linked this definition to information security. For image encryption, this equation is given by(17)Hm=−∑i=12nPmilog2Pmi,where n is the number of bits representing the color intensity and Pmi is the probability of a color intensity mi in an image I. For a grayscale image, n  = 8 bits with total gray levels of 256 0∼255; if all gray levels in an image have the same probability Pmi=1/256 which is equivalent to a uniform histogram, then the result of (17) would be 8. This indicates that, as the entropy value increases (very close to 8), less information can be extracted from it. In other words, histogram and entropy are both quantitative measures of “uncertainty”: one with visual representation and the other with a numerical result. In Table 5, the result for the entropy analysis of several ciphered images is listed and confirms the uniform distribution of gray levels in them. Another important factor is to calculate the local Shannon entropy (LSE) of nonoverlapping portions of the image using(18)Hk,TBI=∑i=1kHIBik,where k is the number of blocks, TB is the number of pixels in each block, and HIBi is the Shannon entropy of the block. Table 5 shows the comparison of LSE of the proposed scheme with other schemes using significant value α=0.05, k=30, and TB=1936. This led to a critical interval of (7.901901305, 7.903037329). The table shows that the proposed scheme falls within these critical values for different image sizes.Table 5
Entropy analysis of sample grayscale images.
File nameGlobal entropyLSEOriginalCipheredProposed schemeReference [59]Reference [60]Reference [61]5.1.147.3424327.9971887.9029117.9028377.9027957.9030775.2.087.2010077.9991977.9023427.902797.9028317.9034395.2.096.9939947.9994197.9029707.9029727.9030287.9024955.2.105.7055607.9992437.9020737.9024647.9035117.9029595.3.017.5237377.9998237.9023187.9036617.9031067.9034865.3.026.8303297.9998277.9021187.9025457.9032637.9028427.1.016.0274157.9992777.9025157.9029347.9033627.903452


## 3.2.6. Resist to Differential Attack Analysis

A robust encryption scheme should also be sensitive to small error in the plaintext. That is, while using the same key, a change in one pixel in the plain image would produce a completely different ciphered image. If a scheme possesses this property, then it has the ability to resist differential attacks. In practice, number of pixels’ change rate (NPCR) and unified average changing intensity (UACI) are the two common methods for measuring this type of sensitivity. Consider two imagesI and I′, where I′ is slightly different from I by one pixel only. Encrypting both images with the same key will produce C and C′.NPCR measures the absolute number of pixels with the same position inC and C′ that changed value(19)NPCRC,C′=∑i,jDi,jT,Di,j=0,whenCi,j=C′i,j,1,whenCi,j≠C′i,j,whereT=M×N is the number of pixels in the image. An ideal scheme would produce NPCR=1 which implies that no relation between C and C′ can be achieved. But since this value is difficult to attain, values very close to unity could be accepted under a certain criterion.UACI measures the average intensity difference betweenC and C′ using the following equation:(20)UACIC,C′=∑i,jCi,j−Ci,jT×L,where L is the maximum level of color intensity. Criterions for accepting the results of both tests were given in [41]. For NPCR, a test result is accepted when it is greater than or equal a one sided hypotheses N with α as its significance level:(21)Nα∗=L+Φ−1αL/TL+1,where Φ⋅−1 is the inverse CDF of the standard normal distribution ℕ0,1.For UACI test, the result of an encryption is considered a pass if its value falls inside the intervalUα∗−,Uα∗+ as follows:(22)Uα∗−=μU−Φ−1α2σU,Uα∗+=μU+Φ−1α2σU,μU=L+23L+3,σU=L+2L2+2L+318L+12LT.Usingα=0.05, typical values of Nα∗, Uα∗−, and Uα∗+ for different image sizes are listed in Table 6.Table 6
Typical values ofNα∗, Uα∗−, and Uα∗+ for different image sizes using α=0.05.
File sizeNPCR (%)UACINα∗Uα∗−Uα∗+256 × 25699.569333.2824%33.6447%512 × 51299.589333.3730%33.5541%1024 × 102499.599433.4183%33.5088%For the proposed algorithm, 26 gray scale images with different sizes were subjected to theNPCR and UACI test α=0.05. The results are listed in Table 7 with all scores passing the tests. These results are a good indication that the proposed algorithm is robust and can withstand differential attacks.Table 7
NPCR and UACI score results for 26 images with different sizes.
File nameNPCR test resultUACI test resultScore%StatusReference [59]Reference [60]Reference [61]Score %StatusReference [59]Reference [60]Reference [61]Dimension 256 × 256Nα∗≥99.5693%Uα∗−,Uα∗+=33.2824%,33.6447%5.1.09.tiff99.5941Pass99.60399.59989.41533.4722Pass33.55233.2900.6985.1.10.tiff99.5728Pass99.63699.62716.20133.6179Pass33.45333.2730.0645.1.11.tiff99.5743Pass99.94299.63552.48933.5225Pass33.58633.3230.4125.1.12.tiff99.5758Pass99.79299.61728.14433.3374Pass33.45333.5350.4405.1.13.tiff99.6459Pass99.79299.6248.67733.5497Pass33.52033.4590.0345.1.14.tiff99.6170Pass99.62199.63248.37833.5752Pass33.44033.39612.094Dimension 512 × 512Nα∗≥99.5893%Uα∗−,Uα∗+=33.3730%,33.5541%5.2.08.tiff99.5918Pass99.96099.61130.74033.4202Pass33.69233.4520.1215.2.09.tiff99.6040Pass99.87699.63223.05033.3967Pass33.54833.4440.0905.2.10.tiff99.5987Pass99.65499.60299.60833.5028Pass33.45433.52733.447.1.01.tiff99.6014Pass99.95799.61311.19233.4886Pass33.64833.5250.0447.1.02.tiff99.6056Pass99.91899.61961.22633.4162Pass33.46533.5310.2407.1.03.tiff99.5975Pass99.84999.61010.53533.5348Pass33.27333.4010.0417.1.04.tiff99.6006Pass99.99199.61822.98933.4449Pass33.20233.5200.1807.1.05.tiff99.6109Pass99.94299.58694.70733.4587Pass33.83033.5052.9717.1.06.tiff99.6113Pass99.67099.60067.93333.4813Pass33.62733.4370.5357.1.07.tiff99.5968Pass99.98399.60847.19733.4569Pass33.60933.5110.1857.1.08.tiff99.6117Pass99.81899.6055.81733.4746Pass33.37533.4180.0237.1.09.tiff99.6151Pass99.87499.61758.37433.4900Pass33.53033.4050.2297.1.10.tiff99.5941Pass99.69799.60699.59533.4539Pass33.43833.53633.39boat.512.tiff99.6009Pass99.71599.6154.51333.3759Pass33.37433.4760.018gray21.512.tiff99.5937Pass99.64399.60935.44333.4828Pass33.50733.4830.279ruler.512.tiff99.6021Pass99.63799.6238.24833.4163Pass33.41533.3530.032Dimension 512 × 512Nα∗≥99.5994%Uα∗−,Uα∗+=33.4183%,33.5088%5.3.01.tiff99.6078Pass99.95099.61312.85233.4706Pass33.50833.4790.1015.3.02.tiff99.6009Pass99.98299.61399.60133.4801Pass33.51433.48233.4197.2.01.tiff99.6010Pass99.98099.60660.13033.4664Pass33.48733.4740.236


## 3.2.7. Perceptual Security: Peak Signal-to-Noise Ratio (PSNR)

Another indication of encryption quality is to calculate the PSNR between the original image and the ciphered one.(23)PSNR=10log10M×N×2552∑i=0M−1∑j=0N−1Pi,j−Ci,j2,where M×N is the image size and P and C are the plain and ciphered images, respectively. Table 8 lists the PSNR of multiple images, where values greater than 25 indicate good encryption quality.Table 8
Peak signal-to-noise ratio (PSNR) between the plain imageP and the ciphered image C
File nameSizePSNR dB5.1.14.tiff256 × 25628.435.2.08.tiff512 × 51227.98935.2.09.tiff512 × 51225.835.2.10.tiff512 × 51227.98935.3.01.tiff1024 × 102429.135.3.02.tiff1024 × 102429.52


## 4. Execution Speed Analysis

To test the execution speed for both the proposed map and encryption scheme. A laptop with Intel(R) Core(TM) i7-4702MQ CPU @ 2.20 GHz and 8 GB RAM was used to perform the experiment. The average execution speed of the proposed maps runs at 6.2 ms while the conventional tent map executes at an average of 5.2 ms. The running speeds of the proposed encryption scheme for different image sizes are listed in Table9. These running speeds are acceptable considering the high level of security of the proposed scheme.Table 9
Speed analysis of the proposed scheme for different image sizes.
File nameSizeEncryption speed (second)5.1.14.tiff256 × 2560.35455.1.09.tiff256 × 2560.35485.1.10.tiff256 × 2560.35195.2.08.tiff512 × 5121.45985.2.09.tiff512×5121.44745.3.01.tiff1024×10246.05165.3.02.tiff1024×10245.9146


## 5. Conclusion

Recently, chaos theory has been linked to cryptographic applications. One-dimensional chaotic map has the simplest form of mathematical and hardware representation but suffers from many security problems like collapsing and limited effect of its control parameters. This paper introduced a 1D chaotic function with five variable control parameters in addition to the initial conditionxo. The function proved to be topologically mixing with dense periodic orbits and sensitivity to its initial condition and control parameters. A simple PRNG based on the map was constructed and tested using NIST sts; the results gave a good indication of the strong cryptographic property of the presented map. Based on the presented map, a new image encryption scheme was presented. Several analyses proved the scheme to be robust against various types of attacks with good diffusion and confusion property.



---

*Source: 7647421-2020-10-21.xml*