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

Deparment of Mathematical Sciences, Faculty of Science and Technology, Fatima Jinnah Women University, e Mall, Rawalpindi, Pakistan CES Laboratory, ENIS, University of Sfax, Sfax 3038, Tunisia College of Computers and Information Technology, Taif University, P.O. Box 11099, Taif 21944, Saudi Arabia Faculty of Engineering, Uni de Moncton, Moncton, Canada International Institute of Technology (IIT), Sfax, Tunisia


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]. e requirements of consistent, fast, and robust techniques to store and transmit digital images have led to the development of novel encryption techniques. e 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. erefore, 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-tonoise 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. e 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 Concatenate the resulting columns in one-dimensional array Input. Color image I, secret key K 1 � (ξ 0 , η), PWLCM (1) Output. Image array PM with scrambled pixels Step 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 I Step 2. Using PWLCM (1) with the keyK 1 , generate the chaotic sequence X � x 1 , x 2 , ..., x L and sort the resulting sequence X � x 1 , x 2 , ..., x L in ascending order Step 3. Compute the position vector of X in X and note down the transformed positions TRAN � p 1 , p 2 , ..., p L Step 4. e array P is permuted using TRAN to get PM ALGORITHM 1: (Pixel permutation).
2 Complexity [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]. e 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 Input. Permuted array PM, K 2 � (color 1, color 2, color 3), where color 1 � (R 1 , G 1 , B 1 ),color 2 � (R 2 , G 2 , B 2 ), and color 3 � (R 3 , G 3 , B 3 ) are any three random secret colors in (R, G, B) format and k is any random integer, such that gcd(k, 256) � 1.
Output. An array Q of order L Step 1. Computing self-invertible matrix (a) Make a matrix K 11 (mod256) of order 3 × 3 as K 11 � ALGORITHM 2: (Key mixing with color codes).
Step 3. Bitwise XOR each element of Q with element of DF at the corresponding positions and preceding ciphered pixel as Step 4. Reshape array C in the form of a matrix CI of order L � m × n × 3 Step 5. Convert resulting matrix in step (4) to get the cipher image ALGORITHM 3: (Pixel diffusion).

Complexity 3
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. ese features of chaotic maps enable them to be highly recommended for creating the confusion and diffusion in image encryption. For instance, see references [18][19][20][21][22][23]. e present study is inspired by the above cited investigations and their applications to different areas. e core goal of this work is to make advanced venture in the regime Input. Encrypted imageCI, secret keys K 1 , K 2 , K 3 , PWLCM (1), CLM (2). Output. Plain color image I Step 1. e encrypted image matrix CI is placed in an array of size L � m × n × 3 Step 2. As in step 1 and step 2 in Algorithm 3, the receiver generates a sequence R of size L by secret key K 3 and CLM (2) Step 3. Each element of CI in step 2 is passing through the following formula: Step 4. By using key K 2 , receiver generates matrix K p as in Algorithm 2, which is self-invertible matrix Step 5.Convert one-dimensional array D into submatrices DM j of order 6 × 1 Step 6. Key mixing is reversed by using the formula Step 7. Rewrite all B j 's in the form of one-dimensional array DQ Step 8. By iterating the PWLCM and using the shared secret key K 1 , get a sequence X and get X by sorting X in ascending order Step 9. e permutation array is computed by inverse transform position (TRAN) − 1 Step 10. Use (TRAN) − 1 on DQ to get P Step 11. Reshape P in a matrix form of order L � m × n × 3 and converted to image I ALGORITHM 4: (Image decryption).    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. e 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. e 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.

Orignal
e 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.
e remaining study is outlined as follows. e proposed image encryption algorithm is given in Section 2. 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.

The Proposed Image Encryption Algorithm
To develop an algorithm, following three aspects should be considered: (1) e evaluation and implementation of the algorithm must be simple and easy (2) e design of the encryption algorithm must resist the known attacks (3) For the algorithms, the concepts and basic ideas must be well established and reliable Keeping 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 of m × n × 3 pixels image is recommended for its encryption. e original image is processed into one-dimensional array for encryption, but the encrypted image is again of the size m × n × 3.    ere 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. e 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. e designed flowchart shown in Figure 1 summarizes our proposed encryption algorithm.

Permutation Process.
ree keys K 1 , K 2 , and K 3 are used in three phases, respectively, of our proposed encryption algorithm. e first phase changes the position of pixels of the original image I. e piecewise chaotic linear map is used to permute the pixels. Using K 1 , 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.
is permutation sequence is used to permute the one-dimensional array of the plain image.

Piecewise Linear Chaotic Map (PWLCM).
ere are many different ways to generate the chaotic sequences or the piecewise chaotic maps for the encryption. e authors of [24] proposed hyperchaotic encryption based on multiscroll piecewise linear systems. e manuscript [25] describes maximal unstable dissipative interval to preserve multiscroll attractors via multisaturated functions. e piecewise linear chaotic map is defined [26] as      Complexity 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. e 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 where K 1 is the secret key of the permutation process    10 Complexity e following Algorithm 1 describes the permutation process.

Substitution Process Using Hill Cipher and Color Codes.
e 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. e 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]. e 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. ere are 256 × 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 keyK 2 . Now, K 2 is used to generate a self-invertible matrix of order 6 × 6. e permuted image array PM is divided into (L/6) submatrices of order 6 × 1.
ese submatrices are multiplied one by one withK 2. e resulting matrices are combined once again to make a one-dimensional array Q. Figure 2 shows the schematic representation of key mixing   12 Complexity with color codes. e Algorithm 2 describes the substitution process.

Pixel Diffusion Process.
In the final phase, using key K 3 , 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. e resulting one-dimensional array is reshaped as a matrix of order m × n × 3 again, and cipher image is generated by this matrix.

Chaotic Logistic Map (CLM).
e 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) e 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 parameter e chaotic behavior of the CLM with infinite period is shown in Figure 3. e following Algorithm 3 describes the diffusion process.

Image Decryption Process
e following image decryption algorithm is used to revert back to the encryption algorithm for getting the original image. e decryption process also comprises three stages. In the first stage, the XOR operation is eradicated with the sequence generated with key K 3 . e effect of color mixing is wiped out by multiplying with the self-invertible key matrix generated by key K 2 . Finally, a random sequence and ultimately the inverse of permutation is constructed using key K 1 . To reverse the

Implementation of Proposed Algorithms
For the evaluation of the proposed scheme, we used Matlab 2018a. e 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. e standard colored images of Lena with (256 × 256) pixels are taken for the testing of our proposal. We perform the encryption using K 1 � (0.766, 0.3432), K 2 � (purple haze, bright neon pink, fire brick, 123), and K 3 � (0.7666, 3.999). For comparison purpose, we take image of Lena to compare our results with many other schemes present in the literature. e sample input and output of Lena image by proposed algorithms is shown in Figure 4. e proposed algorithm takes 12.41 seconds to encrypt the Lena image.

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. Figure 5 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.

Correlation Analysis of Adjacent Pixels.
e confusion and diffusion can be tested by using correlation analysis between neighboring pixels in the original image and the  e correlation is calculated by using the following formula: where x t and y t are the values of two neighboring pixels and n is the total number of pixels taken for calculating correlation. e 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. e value obtained from equation (3) for cipher image is close to zero which shows that adjacent pixels in cipher image are almost uncorrelated.

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: where C be a ciphered image and P(C i ) is the probability of character C i 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. e 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.  e 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: 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. If X(i, j) ≠ X ′ (i, j), then K(i, j) � 1; else, K(i, j) � 0. e 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. e higher values of NPCR and UACI give the best security measures. e comparison of the NPCR and UACI values of encrypted Lena image is given in Table 3. e estimate of critical values of NPCR and UACI of proposed scheme is given in Table 4.

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 Figures 12(a), 13(a), and 14(a) , respectively. e 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. e mean square error (MSE) is the measurement of difference between the original and cipher images. e high value of MSE is related to a high difference between original image and cipher image. It can be calculated by the following equation:   16 Complexity where m, n represent the number of rows and columns, respectively. I P and I D represent the plain image and cipher image, respectively. For the difference between the plain image and cipher image, MSE ≥ 30 db. e MSE of proposed image algorithm is given in Table 5.

Peak
Signal-to-Noise Ratio Analysis. e peak signalto-noise ratio (PSNR) measures the conformity between the plain and cipher images. It can be calculated using the following formula: e value of PSNR should be as low as possible between the plain and cipher images for good encryption algorithms. e value of PSNR of the proposed algorithm is given in Table 5.    e proposed algorithms are also applied to another sample colored image of onion (198 × 135 pixels). e entropy value of onion image is 7.9975. e resulting encrypted and decrypted images are shown in Figure 15. e 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.

Key Space Analysis.
e key space is all the possibilities of keys that can be utilized in the encryption algorithm. e 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 2 128 . ere are three keys involved in our proposed image encryption algorithm. e secret keys K 1 and K 3 contain parameters of associated chaotic maps which are ξ 0 , η, ϕ 0 , and β.By considering the precision of these parameters to be 2 52 , the total number of possibilities of choosing these two keys will be (2 52 ) 2 × (2 52 ) 2 � 2 208 . e key K 2 � (color 1, color 2, color 3, k) is a combination of three random colors and a random number k. e number of possibilities for choosing three colors are 16777216 P 3 � 4.722365638 × 10 21 � 2 72 . e integers that satisfy the condition gcd(k, 256) � 1 are 128 � 2 7 . So the total possibilities of choosing K 2 are 2 72 × 2 2 � 2 74 . e total size of key space is 2 208 × 2 74 � 2 282 > 2 128 . erefore, 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. e computational complexity is analyzed as follows. Assume that a fastest computer can calculate 2 80 computations in one second. So, in one year, the number of computations performed by the computer is 2 80 × 365(days) × 24(hr) × 60(min) × 60(sec). Hence, the total of (2 282 /2 80 × 365 × 24 × 60 × 60) � 10 53 years is required. To resist the brute-force attack against this encryption algorithm, this computational load is large enough.

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. e output of our decryption algorithm is totally changed with a slight modification in any part of the key K � (K 1 , K 2 , K 3 ). 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. e proposed algorithm is highly sensitive to secret keys.

Conclusion
is 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. e confusion phase is done by the piecewise chaotic linear map. e Hill cipher with color codes is employed for the substitution phase. e diffusion process is performed by a chaotic logistic map and bitwise XOR.
e 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. e proposed image encryption algorithm is highly secure which is demonstrated by performing different assessment tests. e results of these experiments and performance tests are compared with different algorithms and summarized in Table 8.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that they have no conflicts of interest.