# Analytic Study of a Novel Color Image Encryption Method Based on the Chaos System and Color Codes

Authors: Shamsa Kanwal; Saba Inam; Omar Cheikhrouhou; Kinza Mahnoor; Atef Zaguia; Habib Hamam
Journal: Complexity
 (2021)

---

## Abstract

Due to the growing of the use of Internet and communication media, image encryption is rapidly increased. Image sharing through unsafe open channels is vulnerable for attacking and stealing. For protecting the images from attacks, encryption techniques are required. Recently, new and efficient chaos-based techniques have been suggested to develop secure image encryption. This study presents a novel image encryption framework based on integrating the chaotic maps and color codes. Three phases are involved in the proposed image encryption technique. Piecewise chaotic linear map (PWLCM) is used in the first phase for permuting the digital image. In the second phase, substitution is done using Hill cipher which is the mixing of color codes with the permuted image. The third phase is implemented by XORing, a sequence generated by the chaotic logistic map (CLM). The proposed approach enhances the diffusion ability of the image encryption making the encrypted images resistant to the statistical differential attacks. The results of several analyses such as information entropy, histogram correlation of adjacent pixels, unified average changing intensity (UACI), number of pixel change rate (NPCR), and peak signal-to-noise ratio (PSNR) guarantee the security and robustness of the proposed algorithm. The measurements show that the proposed algorithm is a noble overall solution for image encryption. Thorough comparison with other image encryption algorithms is also carried out.


---

## Body

## 1. Introduction

Images are a substantial source of information not limited to the daily routine of a common person, but having diverse applications in various fields of military, medical, and industry. For example, we may enumerate military image records, trusted video conferencing, satellite imagery, planetary motion images, and keeping a person’s medical record [1]. The requirements of consistent, fast, and robust techniques to store and transmit digital images have led to the development of novel encryption techniques. The information conveyed through images is very complex as compared to simple text. Data sent through open channels such as Internet can be illegally accessed and restored. Therefore, the progress in the field of image encryption creates diverse opportunities and applications in upcoming future. Several assessment criteria including the information entropy, correlation between adjacent pixels, peak signal-to-noise ratio (PSNR), the number of pixels change rate (NPCR), and unified average changing intensity (UACI) related to the image encryption are essential for performance evaluation of the encryption algorithms. The algorithm for which the values of these criteria fulfill the standard expectation level can resist the statistical and differential attacks [2]. Moreover, for resisting the brute-force attacks, an algorithm with large key space and sensitive to initial conditions is recommended.Imaging technology meets chaos and propagation requirements compared with traditional encryption systems; chaotic systems [3] have powerful features, such as nonperiodicity, nonlinearity, unpredictability, and extreme sensitivity to initial conditions [4]. Matthews [5] introduced the concept of chaotic function in cryptography. He suggested that a random sequence can be generated by iterating a nonlinear function with certain conditions. In 1998, [6] Friedrich first applied the chaotic system to image encryption. Since then, image encryption based on chaotic systems has gradually become the main field of cryptography [7]. Chen and Mao used chaotic 3D cat maps [8] and Baker maps [9] to create permuted image in their proposals. Guan used a chaotic 2D cat map [10] to swap pixels in 2005. Patidar et al. [11] presented image encryption scheme based on substitution-diffusion using chaotic standard map and chaotic logistic maps.In 2014, [12] Zhang and Wang proposed a new multiimage encryption algorithm based on mixed pixels and piecewise linear chaotic mapping. It is the fastest way to solve the problem. Many researchers have designed image encryption techniques by using various combinations of chaotic maps such as logistic map and Baker map [13], tent and logistic map [14], and the logistic-sine-coupling map [15]. The security and efficiency of algorithms is improved by these suggestions. Liao et al. [16] recently implemented a shorthand strategy based on the enlarged channel model’s probability. He also used critical functions and pixel correlation functions [17] for stenographic purpose.Chaos system plays a vital role in the different fields of mathematics. Many complicated systems can be investigating through chaos systems. Chaotic maps have very interesting features such as sensitivity to the initial value: a completely different sequence is generated with the small change in the initial value. Other features may include nonperiodicity, the map which is used to generate the chaotic sequence is nonperiodic, and randomness behavior, the chaotic sequences which are generated by the chaotic map are mostly pseudorandom sequences with complex structures. Due to these features, security of image encryption can be improved because without knowing the correct values of control parameters and initial conditions, an attacker cannot predict the chaos map. These features of chaotic maps enable them to be highly recommended for creating the confusion and diffusion in image encryption. For instance, see references [18–23].The present study is inspired by the above cited investigations and their applications to different areas. The core goal of this work is to make advanced venture in the regime of image encryption using chaotic maps. More accurately, this manuscript deals with developing and analyzing a novel image encryption that comprises three phases: pixel permutation process, substitution process, and pixel diffusion process. The permutation sequence for the first phase is generated by PWLCM, and the pixels of the plain image are then permuted according to the permutation sequence. Instead of using S-boxes for substitution phase, the substitution of pixels in the permuted image is determined by Hill cipher whose key is generated by color codes. The same key is used in the decryption process because it is self-invertible. At the end, the diffusion process is completed by CLM to ensure the secrecy of the entire image encryption technique. The effectiveness of the proposal is shown by several experimental results. By using information entropy analysis along with other indicative parameters such as entropy, PSNR, UACI, NPCR, and correlation factors, the proposed image encryption technique is compared with some existing techniques.The remaining study is outlined as follows. The proposed image encryption algorithm is given in Section2. In Section 3, we present the decryption process. Section 4 is based on the details of implementation results generated by executing the encryption and decryption algorithm to some test images. Section 5 consists of assessments of the algorithm in different aspects. Section 6 concludes the presented work.


## 2. The Proposed Image Encryption Algorithm

To develop an algorithm, following three aspects should be considered:(1)
The evaluation and implementation of the algorithm must be simple and easy(2)
The design of the encryption algorithm must resist the known attacks(3)
For the algorithms, the concepts and basic ideas must be well established and reliableKeeping in mind all the three aspects, an efficient and secure technique for image encryption is proposed here, using the chaotic logistic map and color codes.For the image selection, the size ofm×n×3 pixels image is recommended for its encryption. The original image is processed into one-dimensional array for encryption, but the encrypted image is again of the size m×n×3.There are three phases involved in encryption; pixel permutation, substitution process using Hill cipher with color codes, and pixel diffusion. In the first phase, the piecewise linear chaotic map is used for permuting the pixels, so that the statistical structure of the plain image is dissipated into long-range statistics of the cipher image. The permuted image is then mixed with a self-invertible key matrix generated by secret color codes, in the second phase. Finally, confusion is achieved by XORing with another chaotic map to make the relationship between the statistics of the cipher image and the value of the key as complex as possible to thwart attempts of cryptanalyst. The designed flowchart shown in Figure1 summarizes our proposed encryption algorithm.Figure 1
Flowchart of the proposed image encryption algorithm.


### 2.1. Permutation Process

Three keysK1,K2,andK3 are used in three phases, respectively, of our proposed encryption algorithm. The first phase changes the position of pixels of the original image I. The piecewise chaotic linear map is used to permute the pixels. Using K1, iterate the piecewise chaotic linear map (PWLCM) to get a chaotic sequence and sort the obtained chaotic sequence in ascending order. By comparing the positions of the chaotic sequence and sorted sequence, obtain the permutation sequence. This permutation sequence is used to permute the one-dimensional array of the plain image.


#### 2.1.1. Piecewise Linear Chaotic Map (PWLCM)

There are many different ways to generate the chaotic sequences or the piecewise chaotic maps for the encryption. The authors of [24] proposed hyperchaotic encryption based on multiscroll piecewise linear systems. The manuscript [25] describes maximal unstable dissipative interval to preserve multiscroll attractors via multisaturated functions.The piecewise linear chaotic map is defined [26] as(1)ξn+1=fξn,η=ξnη,if0≤ξn≤η,ξn−η0.5−η,ifη<ξn≤0.5,1−ξn,if0.5<ξn<1,has many dynamic properties, for example, Lyapunov exponent, random-like behavior, and uniform unvarying density function. For these attributes, PWLCM is highly recommended for cryptographic purposes. The conditions and parameters of PWLCM are as follows:(1)
ξ0∈0,1, where ξ0 is the initial value(2)
η∈0,0.5, where η is the control parameter(3)
K1=ξ0,η, where K1 is the secret key of the permutation processThe following Algorithm1 describes the permutation process.Algorithm 1: (Pixel permutation).
Input. Color imageI, secret key K1 = (ξ0, η), PWLCM (1)Output. Image arrayPM with scrambled pixelsStep 1. One-dimensional arrayP of size L=m×n×3 is created by reshaping the original image matrix I to one-dimensional array, where m,n are the number of rows and columns, respectively, of the original image matrix IStep 2. Using PWLCM (1) with the keyK1, generate the chaotic sequence X=x1,x2,...,xL and sort the resulting sequence X¯=x¯1,x¯2,...,x¯L in ascending orderStep 3. Compute the position vector ofX in X¯ and note down the transformed positions TRAN=p1,p2,...,pLStep 4. The arrayP is permuted using TRAN to get PM


### 2.2. Substitution Process Using Hill Cipher and Color Codes

The Hill cipher [27, 28] is a polygraphic block cipher invented by Lester S. Hill in 1929. It serves a significant role in cryptography because of its simplicity, high speed, high throughput, and resistance against frequency analysis attack.The Hill cipher method requires an invertible key matrix, so that the decryption can be allowed. To overcome the difficulty of having an invertible key matrix, self-invertible matrix is introduced by Acharya et al. [29]. The substitution process is carried out by employing Hill cipher which uses the self-invertible key matrix based on color codes, making the substitution phase simple and efficient.RGB color format is a model that adds red, blue, and green colors in different quantities and produces new colors. Total bits that each color uses are 8, and hence, they can have any integer value from 0 to 255. There are256×256×256=16777216 possibilities of generating different colors. Any three colors, color1, color2, and color3, from these possible colors can be selected as our second secret keyK2. Now, K2is used to generate a self-invertible matrix of order 6 × 6. The permuted image array PM is divided into L/6 submatrices of order 6 × 1. These submatrices are multiplied one by one withK2. The resulting matrices are combined once again to make a one-dimensional array Q. Figure 2 shows the schematic representation of key mixing with color codes. The Algorithm 2 describes the substitution process.Figure 2
Schematic representation of key mixing with color codes.Algorithm 2: (Key mixing with color codes).
Input. Permuted array PM,K2=color1,color2,color3, where color1=R1,G1,B1,color2=R2,G2,B2, and color3=R3,G3,B3 are any three random secret colors in R,G,B format and k is any random integer, such that gcdk,256=1.Output. An arrayQ of order LStep 1. Computing self-invertible matrix(a)
Make a matrixK11mod256 of order 3 × 3 as K11=R1G1B1R2G2B2R3G3B3(b)
Take a random integerk∈1,256, such that gcdk,256=1(c)
CalculateK12=kI3−K11mod256,K21=k−1I3+K11mod256,andK22=−K11mod256,whereI3 is the identity matrix.(d)
Form a 6 × 6 self-invertible matrixKp as Kp=K11K12K21K22Step 2. Making submatricesMi(a)
Convert one-dimensional array PM into submatrices of order6×1. The ith matrix is Mi, where i=1,2,…,L/6.(b)
Key mixing is performed using the subsequent formula of Hill cipherCi=Kp×Mimod256.(c)
Concatenate all theCi’s in the form of one-dimensional array again as  Q=C1‖C2…CL/6.


### 2.3. Pixel Diffusion Process

In the final phase, using keyK3, a sequence of real numbers, is generated by iterating CLM (2) and converted into integer’s sequence using Algorithm 3. To create diffusion, one-dimensional array Q is bitwise XORed with the integer sequence. The resulting one-dimensional array is reshaped as a matrix of order m×n×3 again, and cipher image is generated by this matrix.Algorithm 3: (Pixel diffusion).
Input. An arrayQ, secret key K3=ϕ0,β, CLM (2).Output. Encrypted imageCIStep 1. With keyK3 and CLM (2), generate a sequence R=r1,r2,…,rLStep 2. The sequenceR is transformed into a sequence of integers using the following formula: DF=floormodRi×1014,256.Step 3. Bitwise XOR each element ofQ with element of DF at the corresponding positions and preceding ciphered pixel as Ci=DFi⊕Qi⊕Ci−1, i=1,2,…,L.Step 4. Reshape arrayC in the form of a matrix CI of order L=m×n×3Step 5. Convert resulting matrix in step (4) to get the cipher image


#### 2.3.1. Chaotic Logistic Map (CLM)

The final phase is a combination of a chaotic logistic map and XOR operation to apply the diffusion of pixels. Due to this change of pixel value, the pixels of the cipher image drastically change with even small one bit change in the plain image. For this process, we generate a random sequence using CLM which is defined as follows:(2)ϕn+1=gϕn=βϕn1−ϕn.The conditions and parameters of CLM are defined as(1)
ϕ0∈0,1, where ϕ0 is the initial state of the system(2)
β∈0,4, where β is the bifurcation control parameterThe chaotic behavior of the CLM with infinite period is shown in Figure3.Figure 3
Bifurcation diagram of CLM.The following Algorithm3 describes the diffusion process.


## 2.1. Permutation Process

Three keysK1,K2,andK3 are used in three phases, respectively, of our proposed encryption algorithm. The first phase changes the position of pixels of the original image I. The piecewise chaotic linear map is used to permute the pixels. Using K1, iterate the piecewise chaotic linear map (PWLCM) to get a chaotic sequence and sort the obtained chaotic sequence in ascending order. By comparing the positions of the chaotic sequence and sorted sequence, obtain the permutation sequence. This permutation sequence is used to permute the one-dimensional array of the plain image.


### 2.1.1. Piecewise Linear Chaotic Map (PWLCM)

There are many different ways to generate the chaotic sequences or the piecewise chaotic maps for the encryption. The authors of [24] proposed hyperchaotic encryption based on multiscroll piecewise linear systems. The manuscript [25] describes maximal unstable dissipative interval to preserve multiscroll attractors via multisaturated functions.The piecewise linear chaotic map is defined [26] as(1)ξn+1=fξn,η=ξnη,if0≤ξn≤η,ξn−η0.5−η,ifη<ξn≤0.5,1−ξn,if0.5<ξn<1,has many dynamic properties, for example, Lyapunov exponent, random-like behavior, and uniform unvarying density function. For these attributes, PWLCM is highly recommended for cryptographic purposes. The conditions and parameters of PWLCM are as follows:(1)
ξ0∈0,1, where ξ0 is the initial value(2)
η∈0,0.5, where η is the control parameter(3)
K1=ξ0,η, where K1 is the secret key of the permutation processThe following Algorithm1 describes the permutation process.Algorithm 1: (Pixel permutation).
Input. Color imageI, secret key K1 = (ξ0, η), PWLCM (1)Output. Image arrayPM with scrambled pixelsStep 1. One-dimensional arrayP of size L=m×n×3 is created by reshaping the original image matrix I to one-dimensional array, where m,n are the number of rows and columns, respectively, of the original image matrix IStep 2. Using PWLCM (1) with the keyK1, generate the chaotic sequence X=x1,x2,...,xL and sort the resulting sequence X¯=x¯1,x¯2,...,x¯L in ascending orderStep 3. Compute the position vector ofX in X¯ and note down the transformed positions TRAN=p1,p2,...,pLStep 4. The arrayP is permuted using TRAN to get PM


## 2.1.1. Piecewise Linear Chaotic Map (PWLCM)

There are many different ways to generate the chaotic sequences or the piecewise chaotic maps for the encryption. The authors of [24] proposed hyperchaotic encryption based on multiscroll piecewise linear systems. The manuscript [25] describes maximal unstable dissipative interval to preserve multiscroll attractors via multisaturated functions.The piecewise linear chaotic map is defined [26] as(1)ξn+1=fξn,η=ξnη,if0≤ξn≤η,ξn−η0.5−η,ifη<ξn≤0.5,1−ξn,if0.5<ξn<1,has many dynamic properties, for example, Lyapunov exponent, random-like behavior, and uniform unvarying density function. For these attributes, PWLCM is highly recommended for cryptographic purposes. The conditions and parameters of PWLCM are as follows:(1)
ξ0∈0,1, where ξ0 is the initial value(2)
η∈0,0.5, where η is the control parameter(3)
K1=ξ0,η, where K1 is the secret key of the permutation processThe following Algorithm1 describes the permutation process.Algorithm 1: (Pixel permutation).
Input. Color imageI, secret key K1 = (ξ0, η), PWLCM (1)Output. Image arrayPM with scrambled pixelsStep 1. One-dimensional arrayP of size L=m×n×3 is created by reshaping the original image matrix I to one-dimensional array, where m,n are the number of rows and columns, respectively, of the original image matrix IStep 2. Using PWLCM (1) with the keyK1, generate the chaotic sequence X=x1,x2,...,xL and sort the resulting sequence X¯=x¯1,x¯2,...,x¯L in ascending orderStep 3. Compute the position vector ofX in X¯ and note down the transformed positions TRAN=p1,p2,...,pLStep 4. The arrayP is permuted using TRAN to get PM


## 2.2. Substitution Process Using Hill Cipher and Color Codes

The Hill cipher [27, 28] is a polygraphic block cipher invented by Lester S. Hill in 1929. It serves a significant role in cryptography because of its simplicity, high speed, high throughput, and resistance against frequency analysis attack.The Hill cipher method requires an invertible key matrix, so that the decryption can be allowed. To overcome the difficulty of having an invertible key matrix, self-invertible matrix is introduced by Acharya et al. [29]. The substitution process is carried out by employing Hill cipher which uses the self-invertible key matrix based on color codes, making the substitution phase simple and efficient.RGB color format is a model that adds red, blue, and green colors in different quantities and produces new colors. Total bits that each color uses are 8, and hence, they can have any integer value from 0 to 255. There are256×256×256=16777216 possibilities of generating different colors. Any three colors, color1, color2, and color3, from these possible colors can be selected as our second secret keyK2. Now, K2is used to generate a self-invertible matrix of order 6 × 6. The permuted image array PM is divided into L/6 submatrices of order 6 × 1. These submatrices are multiplied one by one withK2. The resulting matrices are combined once again to make a one-dimensional array Q. Figure 2 shows the schematic representation of key mixing with color codes. The Algorithm 2 describes the substitution process.Figure 2
Schematic representation of key mixing with color codes.Algorithm 2: (Key mixing with color codes).
Input. Permuted array PM,K2=color1,color2,color3, where color1=R1,G1,B1,color2=R2,G2,B2, and color3=R3,G3,B3 are any three random secret colors in R,G,B format and k is any random integer, such that gcdk,256=1.Output. An arrayQ of order LStep 1. Computing self-invertible matrix(a)
Make a matrixK11mod256 of order 3 × 3 as K11=R1G1B1R2G2B2R3G3B3(b)
Take a random integerk∈1,256, such that gcdk,256=1(c)
CalculateK12=kI3−K11mod256,K21=k−1I3+K11mod256,andK22=−K11mod256,whereI3 is the identity matrix.(d)
Form a 6 × 6 self-invertible matrixKp as Kp=K11K12K21K22Step 2. Making submatricesMi(a)
Convert one-dimensional array PM into submatrices of order6×1. The ith matrix is Mi, where i=1,2,…,L/6.(b)
Key mixing is performed using the subsequent formula of Hill cipherCi=Kp×Mimod256.(c)
Concatenate all theCi’s in the form of one-dimensional array again as  Q=C1‖C2…CL/6.


## 2.3. Pixel Diffusion Process

In the final phase, using keyK3, a sequence of real numbers, is generated by iterating CLM (2) and converted into integer’s sequence using Algorithm 3. To create diffusion, one-dimensional array Q is bitwise XORed with the integer sequence. The resulting one-dimensional array is reshaped as a matrix of order m×n×3 again, and cipher image is generated by this matrix.Algorithm 3: (Pixel diffusion).
Input. An arrayQ, secret key K3=ϕ0,β, CLM (2).Output. Encrypted imageCIStep 1. With keyK3 and CLM (2), generate a sequence R=r1,r2,…,rLStep 2. The sequenceR is transformed into a sequence of integers using the following formula: DF=floormodRi×1014,256.Step 3. Bitwise XOR each element ofQ with element of DF at the corresponding positions and preceding ciphered pixel as Ci=DFi⊕Qi⊕Ci−1, i=1,2,…,L.Step 4. Reshape arrayC in the form of a matrix CI of order L=m×n×3Step 5. Convert resulting matrix in step (4) to get the cipher image


### 2.3.1. Chaotic Logistic Map (CLM)

The final phase is a combination of a chaotic logistic map and XOR operation to apply the diffusion of pixels. Due to this change of pixel value, the pixels of the cipher image drastically change with even small one bit change in the plain image. For this process, we generate a random sequence using CLM which is defined as follows:(2)ϕn+1=gϕn=βϕn1−ϕn.The conditions and parameters of CLM are defined as(1)
ϕ0∈0,1, where ϕ0 is the initial state of the system(2)
β∈0,4, where β is the bifurcation control parameterThe chaotic behavior of the CLM with infinite period is shown in Figure3.Figure 3
Bifurcation diagram of CLM.The following Algorithm3 describes the diffusion process.


## 2.3.1. Chaotic Logistic Map (CLM)

The final phase is a combination of a chaotic logistic map and XOR operation to apply the diffusion of pixels. Due to this change of pixel value, the pixels of the cipher image drastically change with even small one bit change in the plain image. For this process, we generate a random sequence using CLM which is defined as follows:(2)ϕn+1=gϕn=βϕn1−ϕn.The conditions and parameters of CLM are defined as(1)
ϕ0∈0,1, where ϕ0 is the initial state of the system(2)
β∈0,4, where β is the bifurcation control parameterThe chaotic behavior of the CLM with infinite period is shown in Figure3.Figure 3
Bifurcation diagram of CLM.The following Algorithm3 describes the diffusion process.


## 3. Image Decryption Process

The following image decryption algorithm is used to revert back to the encryption algorithm for getting the original image. The decryption process also comprises three stages. In the first stage, the XOR operation is eradicated with the sequence generated with keyK3. The effect of color mixing is wiped out by multiplying with the self-invertible key matrix generated by key K2. Finally, a random sequence and ultimately the inverse of permutation is constructed using key K1. To reverse the permutation, the inverse permutation is used. The original image is obtained by transforming the subsequent array into image form.The following Algorithm4 describes the decryption process.Algorithm 4: (Image decryption).
Input. Encrypted imageCI, secret keys K1,K2,K3, PWLCM (1), CLM (2).Output. Plain color imageIStep 1. The encrypted image matrixCI is placed in an array of size L=m×n×3Step 2. As in step 1 and step 2 in Algorithm3, the receiver generates a sequence R of size L by secret key K3 and CLM (2)Step 3. Each element ofCI in step 2 is passing through the following formula:Dj=CIj⊕DFj⊕Dj−1, j=1,2,…,L.Step 4. By using keyK2, receiver generates matrix Kp as in Algorithm 2, which is self-invertible matrixStep 5.Convert one-dimensional arrayD into submatrices DMjof order 6×1Step 6. Key mixing is reversed by using the formulaBj=Kp×DMjmod256,j=1,2,…,L.Step 7. Rewrite allBj’s in the form of one-dimensional array DQStep 8. By iterating the PWLCM and using the shared secret keyK1, get a sequence X and get X¯ by sorting X in ascending orderStep 9. The permutation array is computed by inverse transform positionTRAN−1Step 10. UseTRAN−1 on DQ to get PStep 11. ReshapeP in a matrix form of order L=m×n×3 and converted to image I


## 4. Implementation of Proposed Algorithms

For the evaluation of the proposed scheme, we used Matlab 2018a. The algorithms of pixel permutation, key mixing using Hill cipher with color codes, and pixel diffusion are executed to get the encrypted image and decryption algorithm to again get the plain image back. The standard colored images of Lena with (256 × 256) pixels are taken for the testing of our proposal. We perform the encryption usingK1=0.766,0.3432, K2=purple haze, bright neon pink, fire brick,123, and K3=0.7666,3.999. For comparison purpose, we take image of Lena to compare our results with many other schemes present in the literature. The sample input and output of Lena image by proposed algorithms is shown in Figure 4. The proposed algorithm takes 12.41 seconds to encrypt the Lena image.Figure 4
Sample Lena (colored 256 × 256 pixels). (a) Original image. (b) Encrypted image. (c) Decrypted image.
(a)(b)(c)


## 5. Results, Analysis, and Performance Evaluation

In this section, proposed algorithm is evaluated by analyzing the statistical and differential parameters. We have developed the guidelines, both generally and specifically to compare the algorithm with different techniques. For performing correct encryption and decryption, these guidelines should be followed when choosing certain parameters involved in the algorithms.


### 5.1. Statistical Histogram Analysis

Figure5 shows the histogram of red, green, and blue channels of the cipher image. It is clearly observed that the histogram of the cipher image is fairly uniform. It is evident that no information is leaked from the cipher image of the dispersal of pixels in the original image.Figure 5
Histogram analysis of encrypted image of Lena (colored 256 × 256 pixels). (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)


### 5.2. Correlation Analysis of Adjacent Pixels

The confusion and diffusion can be tested by using correlation analysis between neighboring pixels in the original image and the corresponding encrypted image. The correlation is calculated by using the following formula:(3)Cr=n∑t=1nxtyt−∑t=1nxt∑t=1nytn∑t=1nxt2−∑t=1nxt2n∑t=1nyt2−∑t=1nyt2,where xt and yt are the values of two neighboring pixels and n is the total number of pixels taken for calculating correlation. The highest value of correlation coefficient equals 1 and shows that the adjacent pixels are having high correlation. So, our encryption algorithm must encrypt the image with correlation coefficients very small and near to zero, so that the cryptanalyst cannot get any valuable information. Figures 6–8 display the correlation of the original image pixels in row, column, and diagonal directions, respectively. Figures 9–11 show the correlation of the cipher image pixels in row, column, and diagonal directions, respectively. Table 1 gives the values of correlation of scattering pixels in the horizontal, vertical, and diagonal directions for the plain and cipher image. The value obtained from equation (3) for cipher image is close to zero which shows that adjacent pixels in cipher image are almost uncorrelated.Figure 6
Correlation (row wise) of original image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 7
Correlation (column wise) of original image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 8
Correlation (diagonal wise wise) of original image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 9
Correlation (row wise) of encrypted image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 10
Correlation (column wise) of encrypted image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 11
Correlation (diagonal wise) of encrypted image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Table 1
Lena (colored 256 × 256 pixels) image correlation coefficient values.
DirectionRedGreenBlueOriginalCipherOriginalCipherOriginalCipherHorizontal0.99100.00460.98890.00050.98460.0084Vertical0.97810.00090.97410.00280.9709−0.0032Diagonal0.9648−0.00120.96130.00300.9563−0.0022


### 5.3. Information Entropy Analysis

Entropy is a measurement of unpredictability of the pixel concentrations in the encrypted image. For an 8 bit image, the encryption algorithm with a value of the entropy close to 8 is considered as a good algorithm. It is calculated by the following equation:(4)HC=∑i=02N−1PCilog21PCi,where C be a ciphered image and PCi is the probability of character Ci in encrypted image. For the security of the image encryption algorithm, it should be least possible to predict the original image from the encrypted image. With the entropy value 8, there are less chances of predicting plain image from cipher image. Using Matlab R2018a, the entropy value of encrypted image obtained from the proposed encryption turns out to be 7.9990. Table 2 gives a brief comparison of obtained information entropy value with various image encryption algorithms. The resulting value depicts that entropy of the proposed encryption is close enough to the ideal value 8. It guarantees that there is no loss of information.Table 2
The comparison of values of information entropy.
Image encryption algorithmEntropy valuesReference [30]7.9967Reference [31]7.9970Proposed algorithm7.9990


### 5.4. Sensitivity Analysis of the Proposed Algorithm

The net pixel change rate (NPCR) and unified average changing intensity (UACI) are two measuring criteria used for investigating the effect of altering one pixel of the plain image on the cipher image. Both indicators are defined by the following formulas, respectively:(5)NPCR=∑i,jKi,jw×h×100,(6)UACI=1w×h∑i,jXi,j−X′i,j255×100,where w and h show the width and height of ciphered image, respectively. X represents cipher image corresponding to plain image, while X′ represents the cipher image corresponding to plain image with change of one pixel, respectively. IfXi,j≠X′i,j,thenKi,j=1;else,Ki,j=0.The NPCR and UACI measures indicate the resistance of the algorithm against differential attacks, such as a ciphertext-only attack, a plaintext attack, or a known plaintext attack. The higher values of NPCR and UACI give the best security measures. The comparison of the NPCR and UACI values of encrypted Lena image is given in Table3. The estimate of critical values of NPCR and UACI of proposed scheme is given in Table 4.Table 3
Comparison of NCPR and UACI values.
Image encryption algorithmNPCRUACIReference [30]99.6133.46Reference [31]99.2233.40Reference [32]99.6133.41Proposed algorithm99.6133.46Table 4
Estimate of critical values of NPCR and UACI.
Image encryption algorithmObtained valueNPCR test results0.05 level0.01 level0.001 levelTheoretical NPCR values99.5693%99.5527%99.5341%Proposed algorithm99.61%PassPassPassUACI test results0.05 level0.01 level0.001 levelTheoretical UACI values33.2824–33.6447%33.2255–33.7016%33.1594–33.7677%Proposed algorithm33.46%PassPassPass


### 5.5. Mean Square Error Analysis

In the cipher image of test image Lena, we add 1%, 5%, and 10% salt and pepper noise as shown in Figures12(a), 13(a), and 14(a) , respectively. The corresponding decrypted images of noised cipher images are shown in Figures 12(b), 13(b), and 14(b), respectively. From these figures, it is evident that when the cipher image bear salt and pepper noise or data loss attacks, the decrypted image preserves huge majority of original image information having only a small portion of uniformly distributed noise.Figure 12
Experimental results for the performance evaluation of data loss attacks. (a), (b) Cipher images and decryption result of corresponding images using our algorithm with 1% salt and pepper noise.
(a)(b)Figure 13
Experimental results for the performance evaluation of data loss attacks. (a), (b) Cipher images and decryption result of corresponding images using our algorithm with 5% salt and pepper noise.
(a)(b)Figure 14
Experimental results for the performance evaluation of data loss attacks. (a), (b) Cipher images and decryption result of corresponding images using our algorithm with 10% salt and pepper noise.
(a)(b)The mean square error (MSE) is the measurement of difference between the original and cipher images. The high value of MSE is related to a high difference between original image and cipher image. It can be calculated by the following equation:(7)MSE=1m×n×3∑i=0m−1∑i=0n−1IPi,j−IDi,j2,where m,n represent the number of rows and columns, respectively. IP and IDrepresent the plain image and cipher image, respectively. For the difference between the plain image and cipher image, MSE ≥ 30  db. The MSE of proposed image algorithm is given in Table 5.Table 5
Performance of MSE and PSNR.
Salt and pepper noise (%)MSEPSNR18716.68.727358815.98.8263108926.29.6253


### 5.6. Peak Signal-to-Noise Ratio Analysis

The peak signal-to-noise ratio (PSNR) measures the conformity between the plain and cipher images. It can be calculated using the following formula:(8)PSN=10.log2552MSEdb.The value of PSNR should be as low as possible between the plain and cipher images for good encryption algorithms. The value of PSNR of the proposed algorithm is given in Table5.The proposed algorithms are also applied to another sample colored image of onion (198 × 135 pixels). The entropy value of onion image is 7.9975. The resulting encrypted and decrypted images are shown in Figure15. The histogram of cipher image and correlation of neighboring pixels of plain and cipher images are shown in Figures 16–22 , respectively. Table 6 illustrates the values of correlation of neighboring pixels of cipher image of onion.Figure 15
Sample onion (colored 198 × 135 pixels). (a) Original image. (b) Encrypted image. (c) Decrypted image.
(a)(b)(c)Figure 16
Histogram of cipher image of onion (colored 198 × 135 pixels). (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 17
Correlation (row wise) plot of plain onion image. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 18
Correlation (row wise) plot of color components of onion cipher image. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 19
Correlation (column wise) of original image of onion. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 20
Correlation (column wise) of encrypted image of onion. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 21
Correlation (diagonal wise) of original image of onion. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 22
Correlation (diagonal wise) of encrypted image of onion. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Table 6
Correlation coefficient values of two adjacent pixels of onion (198 × 135 pixels) ciphered image.
DirectionRedGreenBlueOriginal imageCipher imageOriginal imageCipher imageOriginal imageCipher imageHorizontal0.9826−0.00070.9786−0.00680.96480.0003Vertical0.9900−0.00340.98800.00460.9751−0.0018Diagonal0.9721−0.00540.9675−0.00830.9427−0.0021


### 5.7. Key Space Analysis

The key space is all the possibilities of keys that can be utilized in the encryption algorithm. The size of key space is treated as a significant aspect of the algorithm. It should be huge enough to avoid brute-force attacks. With today’s computing abilities, an algorithm can resist exhaustive attacks [33] if the size of key space is larger than 2128. There are three keys involved in our proposed image encryption algorithm. The secret keys K1and K3contain parameters of associated chaotic maps which are ξ0,η,ϕ0,andβ.By considering the precision of these parameters to be 252, the total number of possibilities of choosing these two keys will be 2522×2522=2208. The key K2=color1,color2,color3,k is a combination of three random colors and a random number k. The number of possibilities for choosing three colors are P167772163=4.722365638×1021=272. The integers that satisfy the condition gcdk,256=1 are 128=27. So the total possibilities of choosing K2 are 272×22=274. The total size of key space is 2208×274=2282>2128. Therefore, our proposed algorithm is resistant against the brute-force attacks because the size of the key space is large enough. Table 7 lists the key space size of several schemes.Table 7
Comparison of size of key space.
Image encryption algorithmsSize of key spaceReference [30]2193Reference [31]2233Reference [32]2138Reference [34]2194Proposed algorithm2282The computational complexity is analyzed as follows.Assume that a fastest computer can calculate280 computations in one second. So, in one year, the number of computations performed by the computer is 280×365days×24hr×60min×60sec. Hence, the total of 2282/280×365×24×60×60=1053 years is required. To resist the brute-force attack against this encryption algorithm, this computational load is large enough.


### 5.8. Key Sensitivity Analysis

An image encryption algorithm should be highly sensitive to its secret key, that is, a variation of single bit in secret key should yield a totally different cipher result. A highly sensitive key may contribute towards the security of the image encryption algorithm. The output of our decryption algorithm is totally changed with a slight modification in any part of the keyK=K1,K2,K3. Making even a slight variation in value of one part of encryption key ξ0 as 0.7660000000000001, the image will be produced but not same as plain image. So, it is observed that the cipher image does not contain any clue or gesture about the original image. The proposed algorithm is highly sensitive to secret keys.


## 5.1. Statistical Histogram Analysis

Figure5 shows the histogram of red, green, and blue channels of the cipher image. It is clearly observed that the histogram of the cipher image is fairly uniform. It is evident that no information is leaked from the cipher image of the dispersal of pixels in the original image.Figure 5
Histogram analysis of encrypted image of Lena (colored 256 × 256 pixels). (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)


## 5.2. Correlation Analysis of Adjacent Pixels

The confusion and diffusion can be tested by using correlation analysis between neighboring pixels in the original image and the corresponding encrypted image. The correlation is calculated by using the following formula:(3)Cr=n∑t=1nxtyt−∑t=1nxt∑t=1nytn∑t=1nxt2−∑t=1nxt2n∑t=1nyt2−∑t=1nyt2,where xt and yt are the values of two neighboring pixels and n is the total number of pixels taken for calculating correlation. The highest value of correlation coefficient equals 1 and shows that the adjacent pixels are having high correlation. So, our encryption algorithm must encrypt the image with correlation coefficients very small and near to zero, so that the cryptanalyst cannot get any valuable information. Figures 6–8 display the correlation of the original image pixels in row, column, and diagonal directions, respectively. Figures 9–11 show the correlation of the cipher image pixels in row, column, and diagonal directions, respectively. Table 1 gives the values of correlation of scattering pixels in the horizontal, vertical, and diagonal directions for the plain and cipher image. The value obtained from equation (3) for cipher image is close to zero which shows that adjacent pixels in cipher image are almost uncorrelated.Figure 6
Correlation (row wise) of original image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 7
Correlation (column wise) of original image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 8
Correlation (diagonal wise wise) of original image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 9
Correlation (row wise) of encrypted image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 10
Correlation (column wise) of encrypted image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 11
Correlation (diagonal wise) of encrypted image of Lena. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Table 1
Lena (colored 256 × 256 pixels) image correlation coefficient values.
DirectionRedGreenBlueOriginalCipherOriginalCipherOriginalCipherHorizontal0.99100.00460.98890.00050.98460.0084Vertical0.97810.00090.97410.00280.9709−0.0032Diagonal0.9648−0.00120.96130.00300.9563−0.0022


## 5.3. Information Entropy Analysis

Entropy is a measurement of unpredictability of the pixel concentrations in the encrypted image. For an 8 bit image, the encryption algorithm with a value of the entropy close to 8 is considered as a good algorithm. It is calculated by the following equation:(4)HC=∑i=02N−1PCilog21PCi,where C be a ciphered image and PCi is the probability of character Ci in encrypted image. For the security of the image encryption algorithm, it should be least possible to predict the original image from the encrypted image. With the entropy value 8, there are less chances of predicting plain image from cipher image. Using Matlab R2018a, the entropy value of encrypted image obtained from the proposed encryption turns out to be 7.9990. Table 2 gives a brief comparison of obtained information entropy value with various image encryption algorithms. The resulting value depicts that entropy of the proposed encryption is close enough to the ideal value 8. It guarantees that there is no loss of information.Table 2
The comparison of values of information entropy.
Image encryption algorithmEntropy valuesReference [30]7.9967Reference [31]7.9970Proposed algorithm7.9990


## 5.4. Sensitivity Analysis of the Proposed Algorithm

The net pixel change rate (NPCR) and unified average changing intensity (UACI) are two measuring criteria used for investigating the effect of altering one pixel of the plain image on the cipher image. Both indicators are defined by the following formulas, respectively:(5)NPCR=∑i,jKi,jw×h×100,(6)UACI=1w×h∑i,jXi,j−X′i,j255×100,where w and h show the width and height of ciphered image, respectively. X represents cipher image corresponding to plain image, while X′ represents the cipher image corresponding to plain image with change of one pixel, respectively. IfXi,j≠X′i,j,thenKi,j=1;else,Ki,j=0.The NPCR and UACI measures indicate the resistance of the algorithm against differential attacks, such as a ciphertext-only attack, a plaintext attack, or a known plaintext attack. The higher values of NPCR and UACI give the best security measures. The comparison of the NPCR and UACI values of encrypted Lena image is given in Table3. The estimate of critical values of NPCR and UACI of proposed scheme is given in Table 4.Table 3
Comparison of NCPR and UACI values.
Image encryption algorithmNPCRUACIReference [30]99.6133.46Reference [31]99.2233.40Reference [32]99.6133.41Proposed algorithm99.6133.46Table 4
Estimate of critical values of NPCR and UACI.
Image encryption algorithmObtained valueNPCR test results0.05 level0.01 level0.001 levelTheoretical NPCR values99.5693%99.5527%99.5341%Proposed algorithm99.61%PassPassPassUACI test results0.05 level0.01 level0.001 levelTheoretical UACI values33.2824–33.6447%33.2255–33.7016%33.1594–33.7677%Proposed algorithm33.46%PassPassPass


## 5.5. Mean Square Error Analysis

In the cipher image of test image Lena, we add 1%, 5%, and 10% salt and pepper noise as shown in Figures12(a), 13(a), and 14(a) , respectively. The corresponding decrypted images of noised cipher images are shown in Figures 12(b), 13(b), and 14(b), respectively. From these figures, it is evident that when the cipher image bear salt and pepper noise or data loss attacks, the decrypted image preserves huge majority of original image information having only a small portion of uniformly distributed noise.Figure 12
Experimental results for the performance evaluation of data loss attacks. (a), (b) Cipher images and decryption result of corresponding images using our algorithm with 1% salt and pepper noise.
(a)(b)Figure 13
Experimental results for the performance evaluation of data loss attacks. (a), (b) Cipher images and decryption result of corresponding images using our algorithm with 5% salt and pepper noise.
(a)(b)Figure 14
Experimental results for the performance evaluation of data loss attacks. (a), (b) Cipher images and decryption result of corresponding images using our algorithm with 10% salt and pepper noise.
(a)(b)The mean square error (MSE) is the measurement of difference between the original and cipher images. The high value of MSE is related to a high difference between original image and cipher image. It can be calculated by the following equation:(7)MSE=1m×n×3∑i=0m−1∑i=0n−1IPi,j−IDi,j2,where m,n represent the number of rows and columns, respectively. IP and IDrepresent the plain image and cipher image, respectively. For the difference between the plain image and cipher image, MSE ≥ 30  db. The MSE of proposed image algorithm is given in Table 5.Table 5
Performance of MSE and PSNR.
Salt and pepper noise (%)MSEPSNR18716.68.727358815.98.8263108926.29.6253


## 5.6. Peak Signal-to-Noise Ratio Analysis

The peak signal-to-noise ratio (PSNR) measures the conformity between the plain and cipher images. It can be calculated using the following formula:(8)PSN=10.log2552MSEdb.The value of PSNR should be as low as possible between the plain and cipher images for good encryption algorithms. The value of PSNR of the proposed algorithm is given in Table5.The proposed algorithms are also applied to another sample colored image of onion (198 × 135 pixels). The entropy value of onion image is 7.9975. The resulting encrypted and decrypted images are shown in Figure15. The histogram of cipher image and correlation of neighboring pixels of plain and cipher images are shown in Figures 16–22 , respectively. Table 6 illustrates the values of correlation of neighboring pixels of cipher image of onion.Figure 15
Sample onion (colored 198 × 135 pixels). (a) Original image. (b) Encrypted image. (c) Decrypted image.
(a)(b)(c)Figure 16
Histogram of cipher image of onion (colored 198 × 135 pixels). (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 17
Correlation (row wise) plot of plain onion image. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 18
Correlation (row wise) plot of color components of onion cipher image. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 19
Correlation (column wise) of original image of onion. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 20
Correlation (column wise) of encrypted image of onion. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 21
Correlation (diagonal wise) of original image of onion. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Figure 22
Correlation (diagonal wise) of encrypted image of onion. (a) Red component. (b) Green component. (c) Blue component.
(a)(b)(c)Table 6
Correlation coefficient values of two adjacent pixels of onion (198 × 135 pixels) ciphered image.
DirectionRedGreenBlueOriginal imageCipher imageOriginal imageCipher imageOriginal imageCipher imageHorizontal0.9826−0.00070.9786−0.00680.96480.0003Vertical0.9900−0.00340.98800.00460.9751−0.0018Diagonal0.9721−0.00540.9675−0.00830.9427−0.0021


## 5.7. Key Space Analysis

The key space is all the possibilities of keys that can be utilized in the encryption algorithm. The size of key space is treated as a significant aspect of the algorithm. It should be huge enough to avoid brute-force attacks. With today’s computing abilities, an algorithm can resist exhaustive attacks [33] if the size of key space is larger than 2128. There are three keys involved in our proposed image encryption algorithm. The secret keys K1and K3contain parameters of associated chaotic maps which are ξ0,η,ϕ0,andβ.By considering the precision of these parameters to be 252, the total number of possibilities of choosing these two keys will be 2522×2522=2208. The key K2=color1,color2,color3,k is a combination of three random colors and a random number k. The number of possibilities for choosing three colors are P167772163=4.722365638×1021=272. The integers that satisfy the condition gcdk,256=1 are 128=27. So the total possibilities of choosing K2 are 272×22=274. The total size of key space is 2208×274=2282>2128. Therefore, our proposed algorithm is resistant against the brute-force attacks because the size of the key space is large enough. Table 7 lists the key space size of several schemes.Table 7
Comparison of size of key space.
Image encryption algorithmsSize of key spaceReference [30]2193Reference [31]2233Reference [32]2138Reference [34]2194Proposed algorithm2282The computational complexity is analyzed as follows.Assume that a fastest computer can calculate280 computations in one second. So, in one year, the number of computations performed by the computer is 280×365days×24hr×60min×60sec. Hence, the total of 2282/280×365×24×60×60=1053 years is required. To resist the brute-force attack against this encryption algorithm, this computational load is large enough.


## 5.8. Key Sensitivity Analysis

An image encryption algorithm should be highly sensitive to its secret key, that is, a variation of single bit in secret key should yield a totally different cipher result. A highly sensitive key may contribute towards the security of the image encryption algorithm. The output of our decryption algorithm is totally changed with a slight modification in any part of the keyK=K1,K2,K3. Making even a slight variation in value of one part of encryption key ξ0 as 0.7660000000000001, the image will be produced but not same as plain image. So, it is observed that the cipher image does not contain any clue or gesture about the original image. The proposed algorithm is highly sensitive to secret keys.


## 6. Conclusion

This study presents a novel color image scheme based on chaotic maps. In contrast to the traditional chaos-based cryptosystems, the suggested cryptosystem is proposed using Hill cipher and color codes. The confusion phase is done by the piecewise chaotic linear map. The Hill cipher with color codes is employed for the substitution phase. The diffusion process is performed by a chaotic logistic map and bitwise XOR. The key space size of the encryption algorithm is adequately high to combat brute-force attacks. Also, the algorithm is highly sensitive to keys. Several experimental tests have been carried out with detailed numerical analysis which exhibits the robustness of the suggested algorithm against numerous attacks such as statistical and differential attacks. The proposed image encryption algorithm is highly secure which is demonstrated by performing different assessment tests. The results of these experiments and performance tests are compared with different algorithms and summarized in Table8.Table 8
Summary of properties comparison of different algorithms.
AlgorithmsNPCRUACICorrelation coefficientsEntropyHorizontalVerticalDiagonalReference [31]99.2233.400.00420.00330.00247.9967Reference [32]99.6133.41−0.0026−0.00380.00177.9970Reference [35]99.6133.47−0.0075−0.0011−0.00127.9998Reference [36]99.6230.91−0.00490.00670.00107.9960Proposed algorithm99.6133.460.00450.00016−0.00137.9990



---

*Source: 5499538-2021-06-03.xml*