Chaotic Dynamical State Variables Selection Procedure Based Image Encryption Scheme

Nowadays, in the modern digital era, the use of computer technologies such as smartphones, tablets and the Internet, as well as the enormous quantity of confidential information being converted into digital form have resulted in raised security issues. This, in turn, has led to rapid developments in cryptography, due to the imminent need for system security. Low-dimensional chaotic systems have low complexity and key space, yet they achieve high encryption speed. An image encryption scheme is proposed that, without compromising the security, uses reasonable resources. We introduced a chaotic dynamic state variables selection procedure (CDSVSP) to use all state variables of a hyper-chaotic four-dimensional dynamical system. As a result, less iterations of the dynamical system are required, and resources are saved, thus making the algorithm fast and suitable for practical use. The simulation results of security and other miscellaneous tests demonstrate that the suggested algorithm excels at robustness, security and high speed encryption.


Introduction
Along with the swift advancement of communications and computer literacy, the use of multimedia applications has progressed quickly in all sections of society, because of their simple perspective and appealing appearance.In the meantime, the difficulties in maintaining the security of these applications have motivated a great deal of interest.Multimedia data have some inherent properties, for instance high redundancy [1] and large data capacity; therefore, the long-established encryption algorithms such as RSA, DES and AES are no longer suitable for such data.Many different image encryption algorithms, for example hash [2,3], Fibonacci [4], chaos [5][6][7][8][9][10][11][12], transform domain [13,14] and DNA [15], have been proposed to meet the security requirements.
In the theory of cryptanalysis, the security of an encryption algorithm is determined by its key space.The key space of an encryption method should be large enough to withstand a brute force attack at an obtainable computing capability.The classical permutation and diffusion encryption schemes required a higher amount of chaotic data.Generally, this need is fulfilled by one-dimensional or higher-dimensional chaotic maps, like the Arnold cat map, tent map, standard map, Beker's map, etc.Meanwhile, many encryption systems [16][17][18][19][20][21][22][23] have been successfully broken.The main reasons for the insecurity include: insufficient key space against brute force attacks, more dependence on secret keys, vulnerability against differential attack, poor sensitivity and also, with the advances in chaotic signal estimation technologies, the possibility to find chaotic orbits corresponding to the initial values (secret keys).The usage of two independent keys in the permutation and diffusion stage, which is breakable by a known plaintext attack, can be pointed out as another drawback.
These deficiencies can be counteracted by using higher-dimensional chaotic maps or chaotic dynamical systems, as well as by some improvements, such as time-varying delays [24], couple map lattices, S-box [25], etc.In [26], Chen proposed an encryption scheme based on a dynamical state variable selection mechanism (DSVSM), which is not only fast, but also secure.Its main features are: the use of the same secret key in both the permutation and diffusion stages, involving pixels of the plain image, the use of a higher-dimensional chaotic dynamical system with great sensitivity to initial values and different key streams for different plain images by use of the same secret keys.As a result, higher security is achieved without exhausting much of the resources.
In this paper, we propose the chaotic dynamical state variable selection procedure (CDSVSP) by using a chaotic tent map.The architecture of our image encryption scheme is based on standard permutation and the diffusion system [1].In the permutation stage, we also create the confusion with the use of the chaotic tent map, and in the diffusion stage, we use the time-varying delays.The simulation demonstrated an achievement of better results than Chen [26].This cryptosystem can provide the security necessities recommended in [27,28] and deal with the defects present in the broken cryptosystems by making improvements in the following features:

•
Chaotic state variables are generated from four-dimensional chaotic systems; a minor alteration in the secret key will not only influence the diffusion stage, but also manipulate the permutation at the same time.

•
In CDSVSP, the pixels of plain images are used to choose the state variable for encryption.Thus, different key streams will be generated for each individual plain image, even if the same secret keys are used.Therefore, by encrypting individual images, the attacker is unable to extract helpful information.This characteristic guarantees the security against the known-plaintext attacks.

•
In the permutation stage, the added confusion procedure can also, to some extent, create a diffusion effect.As a result, the whole effect of diffusion is increased.
The remaining part of this paper is composed as follows.The chaotic dynamic state variables selection procedure (CDSVSP) is presented in Section 2. In Section 3, the image encryption/decryption scheme is formulated and explained.Section 4 is dedicated to the numerical results and analysis of our proposed image encryption scheme.Finally, we provide the concluding remarks in Section 5.

Selection Procedure
In the field of cryptography, chaos is widely used.The algorithms based on chaos have exposed some exceptional features, such as complexity and security.Normally, area-preserving maps like the logistic map, bakermap and Lorenz map are used to permute the pixels of the plain image without changing the pixel values.However, in our scheme, in addition to permutation, pixel values are also changed.For this purpose, we use the chaotic tent map.The discretized tent map [29] can be defined as: where a ∈ (0, ρ) is an integer.
In this paper, we used Lü's hyperchaotic system [30] as an example illustrating CDSVSP, as described by the following set of equations.
The initial system variables x 0 , y 0 , z 0 and w 0 act as the secret keys.In each iteration of the Lü's hyperchaotic system, we get four state variables, denoted as X, Y, Z and W, respectively.For the currently processed image with MN pixels, the pixels are arranged in a one-dimensional array P = {P(0), P(1), . . ., P(MN − 1)} from the upper-left corner to the lower-right corner of the image.In CDSVSP, the chaotic state variables are selected with the use of the previously processed pixel and the chaotic tent map.Additionally, the value used for the first pixel is included in the secret keys.In order to demonstrate the CDSVSP properly, the following definitions are needed.
1. Let S = {X i , Y j , Z k , W l } where X i , Y j , Z k and W l are the states of X, Y, Z and W in the i-th, j-th, k-th and l-th iteration, respectively.It should be noted that i, j, k and l do not need to be equal to each other.2. We define slt(L) as the selected variable in {X i , Y j , Z k , W l } that will be used to generate the key stream element for P(L).The decision will be made by an indicator index(L), defined below: where f (a, ρ, x) is a tent map and both a and ρ are parts of the secret keys.
For the first pixel value, P(−1) has to be set as a seed.
The procedure of CDSVSP is described as follows: Choose i 0 , j 0 , k 0 , l 0 sufficiently large and different from each other to act as secret keys.Iterate over Lü's hyperchaotic system max{i 0 , j 0 , k 0 , l 0 } times to get S = {X i 0 , Y j 0 , Z k 0 , W l 0 } as shown in Figure 1, for the first pixel P(0), and then, select the state variable for P(0) by computing index(0).
Based on this index, the system state is updated as follows: Subsequently, select the state variable from updated S for P(1) by computing index(1).Inductively, get the updated state variable set S for P(n), and select the state variable from S by computing index(n).Let us have the state {X i , Y j , Z k , W l } for the P(n), and we can assume, without loss of generality, that index(n) = 0.In this case, the state value X i is chosen for P(n), and the combination of state variables is reorganized to {X i+1 , Y j , Z k , W l }.Similarly, calculate index(n + 1), and let index(n + 1) = 1.The state value Y j will be given to P(n + 1), and the combination state variables transform to {X i+1 , Y j+1 , Z k , W l }.Without loss of generality, it can be assumed that index(n + 2) = 2.The state value Z k will be selected for ciphering P(n + 2).Then, the state variable combination changes to {X i+1 , Y j+1 , Z k+1 , W l }.Let us assume that index(n + 3) = 3, without loss of generality.The state value W l will be chosen for ciphering P(n + 3).Since W l is the last element of the chaotic state W, Lü's system should be iterated enough times to produce a sufficient number of state variables for all the pixels. . . .Based on this index, the system state is updated as follows: Subsequently, select the state variable from updated S for P(1) by computing index(1).value W l will be chosen for ciphering P(n + 3).Since W l is the last element of the chaotic state W, 93 Lü's system should be iterated enough times to produce a sufficient number of state variables for all 94 the pixels.

Proposed Image Encryption Scheme
The proposed algorithm is a new chaotic image encryption scheme.The entire procedure of encryption is presented concisely in the flowchart in Figure 2. Confusion and diffusion terms are required to be more specifically defined.The confusion and diffusion are properties of the operation of a secure cipher.The confusion term refers to making the relationship between the key and the ciphertext as complex and as involved as possible.Diffusion means that if we change a single bit of the image, then statistically, half of the bits in the ciphertext should change [31].The features of the encryption procedure are as follows.

Confusion Algorithm
The key stream k c (n) is produced by using the following formula: where f loor(x) returns the nearest integer value less than or equal to x, abs(x) represents the absolute value of x and mod(x, y) is the remainder when x is divided by y.First, we use a discretized tent map (1) to change the value of each pixel of the plain image.Since the grey components in 8-bit images range from 0-255, set ρ = 255.The discretized tent map as f (k c (n), 255, P(n)) is used h 1 times to iteratively change each pixel value of the plain image.
After the above transformation, the plaintext P is converted into P = {P (0), P (1), . . ., P (MN − 1)}.Secondly, in the permutation stage, the discretized tent map f (w, MN − 1, x) is used h 2 times to rearrange the position of each pixel, where w = ∑ MN−1 i=1 P (i) mod (MN − 1), and the input variable x = {0, 1, 2, . . ., MN − 1} indicates the index number of each pixel of P .Since the tent map is a one-to-one mapping, it will give us a permutation σ(x).Apply this permutation to P in a way that each pixel will be sent to the place of its index value in σ(x).

Diffusion algorithm 129
In the diffusion algorithm, the key stream k c (n) is generated by the same formula 3 as in the 130 confusion algorithm, but the CDSVSP will be applied on the confused image.

131
To calculate the cipher-pixel value, we use the values of current and previous pixels according to where P(n), C(n) and t(n) are, respectively, the currently operated pixel, output pixel and time-varying delay determined by the discretized tent map 1 as follows Here, the initial values t(0) and ρ t are the keys.Also, whenever n − t(n) < 0, we use a constant time 132 delay that is a part of the secret keys.In order to test the confusion and permutation effects of our proposed image encryption scheme, we performed simulations on the Lena gray scale standard test image and its modified version, achieved by changing only one pixel value.The number of pixel changing rate (NPCR) and unified averaged changed intensity (UACI) criteria are generally useful to study the performance of our approach.The formulae to calculate NPCR and U ACIare as follows: where W represents the width and H represents the height of the image.C and C are respectively the ciphered images before and after one pixel of the plain image is changed.D(i, j) can be defined as: The control parameters (x 0 = −25.0,y 0 = 15.0,z 0 = −121.0and w 0 = −18.0)are used in the Lü chaotic system to generate chaotic state variables.The results, according to our confusion algorithms NPCR and UACI, are shown in Table 1 with comparison to the existing techniques.
The inspection of Table 1 will reveal the clear superiority of the proposed confusion algorithm: not only are the NPCR and UACI values much higher than Chen's result [26] and others, they are also more secure.In the sense that the attacker can by pass the permutation stage by taking the same value for all the pixels and try to break the diffusion algorithm, in the proposed algorithm, however, the pixel values are also changed, as well as permuted, so it is more secure against the known plaintext and chosen plaintext attacks.

Diffusion Algorithm
In the diffusion algorithm, the key stream k c (n) is generated by the same formula (3) as in the confusion algorithm, but the CDSVSP will be applied on the confused image.
To calculate the cipher-pixel value, we use the values of current and previous pixels according to: where P(n), C(n) and t(n) are, respectively, the currently operated pixel, output pixel and time-varying delay determined by the discretized tent map (1) as follows: Here, the initial values t(0) and ρ t are the keys.Furthermore, whenever n − t(n) < 0, we use a constant time delay that is a part of the secret keys.

Proposed Algorithm for Image Encryption and Decryption
The flowchart of the proposed cryptosystem is in Figure 2, and the encryption scheme is given below: Step 1: Iterate the Lü chaotic system (2) with (x 0 , y 0 , z 0 , w 0 ) for N 0 times continuously to avoid the harmful effect of the transitional procedure.
Step 2: Obtain the current state variable by means of CDSVSP.An initial value is set as the secret key for the first pixel; iterate the Lü system (2) if needed.
Step 3: Calculate the key stream for the current pixel with Equation (3).
Step 4: The discretized tent map (1) is used to change the current pixel's value.
Step 5: Go back to Step 2 until the values of all pixels are changed.
Step 6: Permute the pixels by using the discretized tent map (1) as described in the confusion algorithm.
Step 8: Obtain the current state variable by means of CDSVSP applied on the currently processed pixel of the confused image.The initial value is set as the secret key for the first pixel.
Step 9: Calculate the key stream for the current pixel with Equation (3).
Step 10: Calculate the time-varying delays using the discretized tent map (1).
Step 11: Mask the values of the currently processed pixel using Equation (4).
Step 12: Go back to Step 8 until all pixels are encrypted.
Step 13: Repeat all these steps n times to ensure the security requirements are met.
Our proposed encryption algorithm consists of two parts: confusion and diffusion.The decryption is performed in the reverse order to the encryption.The inverse formula of masking (Equation ( 4)) is given in Equation ( 5).The discretized chaotic tent map is invertible, with the inverse given in Equation ( 6); for more detail of the inverse, see [29]: The decryption is done as follows.
Step 1: Iterate over the Lü chaotic system (2) with (x 0 , y 0 , z 0 , w 0 ) for N 0 times continuously to avoid the harmful effect of the transitional procedure.
Step 2: Obtain the current state variable by means of CDSVSP.The initial value is known for the first pixel; iterate over the Lü chaotic system (2) if needed.
Step 3: Calculate the key stream for current pixel by Equation (3).
Step 4: Calculate the time-varying delays using the discretized tent map (1).
Step 5: Unmask the values of the currently processed pixel by using Equation (5).
Step 6: Go back to Step 2 until all pixels are undiffused.
Step 7: Apply the reverse of permutation.
Step 8: Obtain the current state variable by means of CDSVSP applied on the currently processed pixel of the image found after Step 7. The initial value is known for the first pixel.
Step 9: Calculate the key stream for the current pixel by Equation (3).
Step 10: Apply the inverse of the discretized tent map (6) to get the pixel value of the plain image.
Step 11: Go back to Step 8 until all the pixels are unconfused.
Step 13: Repeat all these steps n times to get the plain image.

Analysis and Simulation Results
Numerous different experiments were performed with many standard gray scale 512 × 512-sized plain images and many encryption rounds to display the success and competence of the suggested encryption scheme.The proposed algorithm was tested in the MATLAB 2015 version with 64-bit double-precision according to IEEE [32] standard 754.The steps taken were small enough in solving the hyper chaotic Lü's dynamical system to avoid unwanted behavior [33] and degradation effects [34].The parameters of the Lü's hyperchaotic system are x 0 = −25.0,y 0 = 15.0,z 0 = −121.0and w 0 = −18.

Effectiveness Analysis
We took five standard gray scale test images and made their modified versions by changing the last bit of the lower right corner pixel of these test images.The proposed image cryptosystem is applied to these images.The NPCR and UACI between the encrypted test images and the cipher images of their modified versions are shown in Table 2. Hence, a single round of encryption is enough to get effective cipher images.Furthermore NPCR > 99.6% and UACI > 33.4 in all cases, proving that the proposed image encryption scheme is secure and protected against many attacks like differential attack.A change of a single pixel will result in obtaining entirely different cipher images, so that a known plaintext attack is successfully defended.The above simulation results proved the effectiveness of our proposed scheme.

Efficiency Comparisons
For an efficient encryption algorithm, NPCR and UACI should be greater than 99.6% and 33.4%, respectively.The efficiency of any algorithm is measured in terms of achieving these levels with minimum resources.Wong et al. [12,35] pointed out that efficiency is reflected by the average chaotic variables and average quantization operations, required in the encryption process.Thus, a comparison of the efficiency between the proposed encryption algorithm and five typical encryption algorithms [11,26,[36][37][38] based on these parameters is presented in Table 3.The proposed encryption algorithm needs only one round of encryption to achieve NPCR >99.6 and UACI >33.4,so for Chen's algorithm [26] and Fu's algorithm [36].However, it is more secure, as already discussed in Section 3.1.For encryption of the gray scale 512 × 512 sized image, only 65,650 iterations of Lü's hyperchaotic system are needed.Thus 65,650 × 4 = 262,600 state variables are used to generate the key stream, and therefore, 1.002 chaotic variables are required to cypher each pixel on average.Hence, the proposed encryption algorithm is better in comparison to [11,26,[36][37][38], in one way or another.

Key Space Analysis
The key is a very essential aspect of every cryptosystem.An algorithm is only as secure as its key.Even if an algorithm is very strong and well designed, if the key is chosen poorly or the key space is too small, the cryptosystem will be broken eventually.The strength of any cryptographic algorithm depends on the size of its key space to make brute force attack unfeasible.In our proposed algorithm, the secret key consists of four parameters X 0 , Y 0 , Z 0 and W 0 of the Lü's chaotic system.For the simulation of the proposed scheme, we use 64-bit double precision.According to IEEE floating point standards, the computational accuracy is 10 15 .As a result, the total number of likely values of the secret key is around 10 15 × 4, which is large enough to resist a brute-force attack.

Key Sensitivity Analysis
The key sensitivity analysis guarantees the security of the cryptosystems against the brute-force attack.For any cryptosystem, the key sensitivity means that the two cipher images should be entirely independent of each other if the attacker uses two slightly different keys to encrypt the same plain image.To assess the key sensitivity, at first, we did the single-round encryption with keys (x 0 = −25.0,y 0 = 15.0,z 0 = −121.0and w 0 = −18).Then, we added 10 −14 to one of the parameters, whilst all others stayed unchanged, and we performed the encryption process again.The corresponding cipher images and the differential images are shown in Figure 3.The differences between the corresponding cipher images are computed and given in Table 4.The results clearly demonstrate that the cipher images have no relation between each other, and there is no considerable correlation that could be observed in the differential images.In the first step, the number of pairs of neighboring pixels should be chosen.Based on the 238 literature study, we can assume that the four most commonly used variants are 3000, 4000, 8000 239 and 10000 randomly selected pairs [4,20,42].We have conducted research on all these variants, 240 nevertheless, the best results were obtained for the variant containing 3000 pairs.The comparison 241 of the results is presented in Table 5. Due to its best results, the 3000 pairs' variant will be presented

Correlation Analysis
In the first step, the number of pairs of neighboring pixels should be chosen.Based on the literature study, we can assume that the four most commonly-used variants are 3000, 4000, 8000 and 10,000 randomly-selected pairs [39][40][41].We have conducted research on all of these variants; nevertheless, the best results were obtained for the variant containing 3000 pairs.The comparison of the results is presented in Table 5. Due to having the best results, the 3000-pair variant will be presented in detail.If less than 3000 pairs were selected, the correlation between the neighboring pixels would not be exhibited comprehensively.A set of 3000 randomly-selected pairs of neighboring pixels (in the vertical, horizontal and diagonal directions) was collected from the plain and ciphered images, and the correlation coefficients of each two neighboring pixels were calculated according to the following formulas:  The correlation coefficients of the adjacent pixels in the plain image and its cipher image are listed in Table 5.Both the calculated correlation coefficients and Figures 5 and 6 indicate that the correlation of the two adjacent pixels of the plain image is large, while that of the encrypted image is very small, so the encryption effect is satisfactory.

Entropy Measure Analysis
In 1949, Shannon found the unpredictability and randomness of an information source, called information entropy [42].It is a mathematical property.The entropy measure H(s) of a message source s is defined as: where N is the number of bits to represent the symbol s i and P(s i ) is the probability of the symbol s i .The entropy measure is N for a truly random source consisting of 2 N symbols.The ideal entropy for a 256 gray scale level image is eight.The lesser the entropy, the lesser the randomness and security.Information entropy was calculated for six different 256 gray scale test images of 512 × 512 in size before and after the first round of encryption.The values are given in Table 6.The analysis of the values from Table 6 shows that the entropy values of the cipher images are very close to eight, which guarantees the randomness and unpredictability of the cipher image.

Conclusions
The main contribution of the paper is to propose an image cryptosystem utilizing a four-dimensional chaotic system in order to get highly secure results.For this purpose, a new chaotic dynamic state variables selection procedure (CDSVSP) was developed.Low-dimensional chaotic systems are a useful tool for achieving low complexity and relatively small key space, yet obtaining high encryption speed at the same time.
The paper presents the theoretical foundations of the proposed approach, ensuring a very high level of security of the presented system.The chaotic sequence can be utilized to produce a key stream, which is then used in the confusion and diffusion stages.Furthermore, the discretized tent map increases the security even more by changing the pixel values, which creates some sort of diffusion.The proposed approach is also consistent with the current research trends on increasing the level of system security.
We verified the security of the image encryption scheme against numerous attacks, which allowed us to reach the conclusion that our image encryption scheme is highly secure and most suitable for image encryption.The results of the presented numerical example show that the entropy values of the cipher images ensure the randomness and unpredictability of the cipher images.
During the research, some possible areas of improvement have been identified.The potential future work directions could focus on: • practical utilization of the proposed procedure and system; • broader comparison of the obtained results with other approaches; • searching for possibilities to increase the level of system security even further.

Iterations of 4 -D chaotic system 81 Figure 1 .
Figure 1.The starting dynamical system variables 95

Figure 1 .
Figure 1.The starting dynamical system variables.

242
in detail.If less than 3000 pairs were selected, the correlation between the neighboring pixels would 243 not be exhibited comprehensively.A set of 3000 randomly selected pairs of neighboring pixels (in 244 vertical, horizontal and diagonal directions) were collected from the plain and ciphered images, and 245 the correlation coefficients of each two neighboring pixels were calculated according to the following 246 formulas:

Figure 5 .
Figure 5. Correlation of 3000 adjacent random pixels of the plain image: (a) horizontal adjacent pixels; (b) vertical adjacent pixels; (c) diagonal adjacent pixels.

Figure 6 .
Figure 6.Correlation of 3000 adjacent random pixels of the cipher image: (a) horizontal adjacent pixels; (b) vertical adjacent pixels; (c) diagonal adjacent pixels.

Table 1 .
Test results of our proposed confusion algorithm.NPCR, number of pixel changing rate; UACI, unified averaged changed intensity.

Table 2 .
Effectiveness test results of our proposed cryptosystem.

Table 3 .
Efficiency analysis of the image encryption schemes to achieve a satisfactory security level.

Table 4 .
Differences between cipher images produced by slightly different keys.

Table 5 .
Correlation coefficients of adjacent pixels at the first iteration.

Table 6 .
Entropy measures of plain images and cipher images.