A Novel Dynamic Secret Key Generation for an Efficient Image Encryption Algorithm

Today, the security of digital images is considered a significant essential and a strong secret key plays a major role in the image encryption. In this paper, a novel method for generating dynamic non-linear secret keys for a symmetric block cipher using XOR-operation is proposed. The dynamic non-linear secret keys generation is based on a combination of logistic and piecewise chaotic map methods with a new automatic creation of initial seed values. The automatic initial seed values creation depends on the development of a novel strategy for seeds creation based on sunflower spiral points. The experimental results indicate that the proposed key generator algorithm has the advantage of large key space with a safety protection of brute force attack. Therefore, the performance analysis of image encryption reveals a correlation coefficient of about (-0.0001) and entropy greater than (7.9978). Furthermore, the results show high security for encryption based on strong dynamic secret key properties.


Introduction
Recently, high safety is a mandatory requirement in transmitting images over communication networks.As a result of the significant rise in multimedia data usage in computers, there is greater need to verify security and image fidelity.In cryptography, a key is a portion of information that influences the eventual function of a cryptographic algorithm or cipher.In the absence of a key, the algorithm would be to produce a result.A beneficial encryption algorithm must be precise to the cipher keys, and the key space must be sufficiently large to ensure protection against all attacker types such as brute-force attacks (Ephin et al., 2013;Čitavičius & Jonavičius, 2009).The generation of pseudo-random numbers classified as critical subject in a large number of applications such as statistical mechanics, numerical simulations, gaming industry, communication or cryptography.The term "pseudo-random" is used to indicate that the numbers appear to be random are generated from an algorithmic process generator.From a single initial parameter (or seed), the generator will always produce the same pseudo-random sequence.The main advantages of such generators are the rapidity and the repeatability of the sequences and the requirement of less memory for algorithm storage.One interesting way to design such generators is connected to chaos theory.Moreover, during this last decade several pseudo-random number generators have been successfully developed.However, a rigorous analysis is necessary to evaluate the randomness level and the global security of the generator (Saraere et al., 2013).
Today's world is significantly computerized with high interconnectedness, with increasing focus on the usage of digital chaotic systems that offer opportunities to enhance the security of cryptographic algorithms.The benefits of using chaotic dynamics for security problems lie in their unpredictable nature and in the mathematics-based Theory of Chaos.This theory utilizes several qualitative and quantitative tools, including ergodicity, entropy, expansively, and sensitive reliance on start-up conditions.These tools enable the scrutiny of the disorder randomness produced by the system used (Hua, 2009;BashirAbugharsa et al., 2012).Many researchers have noticed that chaos maps are fit for developing cipher method based on the chaos map fundamental concepts of high sensitivity to the initial parameters and conditions.Chaotic maps are easily impacted by even very small changes in start-up conditions and parameters; it covers a small area of data over the total phase space through iterations.As a result of the sensitive nature of chaotic maps, chaos-based encryption is a novel and effective way of dealing with the persistent challenge of simple but highly significant encryption of secure images (Ahmad et al., 2013).The majority of these novel applications employ chaotic maps as pseudo-random number generators to get a sequence keys, such as that for symmetric encryption.Generators that produce random number are crucial in various fields like the study of statistics, for the purpose of simulation (needed to evaluate performance) or cryptography (Wang et al., 2009).
The nature of the chaotic maps has led cryptographers to produce new algorithms of encryption.The importance of the information encryption is now a popular research direction.Chaos-based schemes deliver a good combination of velocity, complexity, high security, and acceptance efficiency.Nevertheless, most existing protection techniques still suffer from major gabs like slow speed performance, small key size, slow speed performance and weak security (Ahmad et al., 2013).Many researchers combine various chaotic systems with an image encryption system for greater secrecy.
Furthermore, the secret key generator directly determines the security and efficiency of enhancing the image encryption algorithm that is never-ending.In this paper a block-based image encrypting technique for RGB color images is proposed, whereby the matrix secret key is generated using a combination of a non-linear dynamic chaotic system with new automatic initial seed creation.The main idea of this article is to use two nonlinear chaotic methods with new automatic generation of seed values in order to increase the robustness of the generator.To preserve such robustness, we have to avoid collision that may occur with incorrect initial values that will lead to identical series of numbers.
The rest of this paper is organized as follows: section 2 views the preliminary works while, the proposed algorithm is explained in Section 3. The next section describes the security performances and Section 5 explains the comparison.Finally, the conclusion of the presented work is presented in Section 6.

Permanent Works
In this section, two main subjects will be explained in detail to clarify the concept of using each one of them.The first part is the chaotic map method while the second one is the sunflower spiral technique.

Chaotic Map Methods
Chaos Theory is the major researched source in the field of key generation of an image encryption based on its properties of sensitivity of initial value, random behaviors, non-periodic, unpredictable and Correlation properties (Fu et al., 2007).The Chaos system comprises two main phases: confusion and diffusion phases.Diffusion implies extending the impact of a one plaintext digit on many cipher text digits, such that the statistical composition of the plaintext loses clarity.On the other hand, confusion means using transformations that reduce the similarity between cipher and plain text (Parameshachari et al., 2013).Different polynomial dynamical systems are used to generate the chaos sequence such as Piecewise map and logistic map.In this paper the generation of chaotic sequence using the piecewise and logistic maps is studied through the analysis of the bifurcation diagram for each of them.The one dimensional logistic map is used for generating the diffusion stage, which is represented as (Taneja et al., 2012): ) where x i ϵ [0, 1].Furthermore, x 0 is an initial secret key and µ is the initial parameter of the eq.1 with value 3.57 < µ < 4.This map is widely employed by cryptographers to produce a pseudo-random sequence because of its highly sensitivity and chaotic behavior.
Moreover, piecewise linear chaotic maps (called PWLCM) is the main class of chaotic maps which its constantly turbulent for each value of the control parameters of the discrete dynamic systems.The PWLCM is used to generate dynamic secret expressed as (Rhouma et al., 2009): (2) where x i and m are the iterative value and the system parameter symbolizes the total number of blocks in the image, respectively.To obtain random and non-periodic numbers m is restricted to a range from 0 to 1 (Wang & Liao, 2012).

Sunflower Spiral Technique
Sunflowers are not just beautiful based on the complex and uniform structure, but it is also a mathematical marvel (Zeng & Pu, 2010).As shown in Figure 1(a), the generating spirals of sunflowers start in the center and there are two series of curves that wind in opposite directions; one starts at the center and stretches out to the petals, and each seed sits at a certain angle from the neighboring seeds.In order to optimally fill the seeds in the center of the flower, the most irrational number is chosen, in other words, the one that is the least well approximated by a fraction.This number is exactly the golden mean.The corresponding angle, the golden angle, is 137.5 degrees.This angle needs to be selected with great precision: as the optimization can be totally destroyed by any changes in degree.When the angle is precisely the golden mean, and only this one, two families of spirals (one in each direction) can be seen and their numbers correspond to the numerator and denominator of one of the fractions which approximates the golden mean.Therefore, the sunflower spiral is a popular and pretty pattern often observable in the way the leaves are arranged or other features in plants, closely connected to the uniform randomness as explained in Figure 1(b).
Mathematically-based on the characteristics of the sunflower spiral, it can be considered a suitable strategy for solving the problems of random number generation with a good uniform distribution characteristic of the sunflower spiral; it can be used for creating automatic seed values with good distribution.The full model proposed by H. Vogel in (1979) defined as, the sunflower spiral is provided by the function S: N → R2, written in polar coordinates as (Segerman, 2010;Ridley, 1982) (4) where r is the radius while n is the point θ is the golden angle, while φ is the golden ration φ = (√5 − 1)/2 = φ −1, finally, the golden ratio is (Segerman, 2010), (5) As explained in Figure 1

Proposed Algorithm
Firstly, the plain image is partitioned into n*n blocks where n=16 and the new matrix secret key is dynamically generated based on PWLCM and logistic map with one initial key K0 and develops new automatic initial seed values.Lastly, each block is encrypted using XOR-operations between the block contents and the matrix key and an overview of image encryption and decryption method is explained in Figure 2. The proposed method comprises two main phases: the first phase generates dynamic matrix secret key to be used in the second phase of encrypting each block using XOR-Operation.The first phase consists of two sub-phases to get the final matrix secret key as shown in Figure 3 with the overview block diagram.The first sub-phase creates the automatic initial seeds as explained in a clear example in Figure 4.Moreover, the second sub-phase is used for generating random matrix secret keys dynamically based on the initial seed values from the first sub-phase as shown in Figure 5.These three phases are explained below in more detail.

New Algorithm for Creating Automatic Initial Seeds
The choice of the starting seed values should not be neglected.Selecting the initial seed for nonlinear dynamic secret key is the first and critical step that determines the strength and the randomness of the sequence for secret key creation.Actually, the initial seed value of the chaotic map method is between [0 and 1].Therefore, selecting the initial seeds for the chaotic map method is a critical challenge.In this proposed method, a novel strategy is used for selecting this initial seed value automatically using the sunflower spiral points.Based on plotting the Sunflower spiral points for creating the positions of a large number of seeds based on a radius R where R is the total number of seed values.Therefore, Figure 4 gives a good example of creating n initial seed where n=100, that is n takes values from 1 to 100, a perfect sunflower head is generated when the distance between points used is 1.Algorithm (1) explains the automatic creation of seed points.

Algorithm1:
Step0: Let R be the total number of initial seed values.
Step1: Determine the radius of sunflower spiral using eq.3 Step2: Evaluate the Golden angle using eq.4 and eq.5 Step3: Determine the position of each seed using eq.6 and eq.7, respectively.
Step4: Plot the positions of R initial seed.
Step5: Store the X and Y positions of each point in K 1..R .

Dynamic Secret Keys Generation
In this step the generated matrix secret key will be used in encryption steps.An input parameter for generating matrix secret key is considered with the one seed input secret key (K0).Then, based on the value of K0 a set of secret keys is generated using a combination of logistic and piecewise chaotic map methods.Furthermore, the total number of secret keys remains the same as the number of blocks.The piecewise chaotic map method is used to generate these sets (Wang & Liao, 2012).Figure 5

Performance Analysis
Analyzing security involves the identification of the shortcomings of a cryptosystem and retrieval either as a whole or partially of a ciphered image or locating the secret key when the decryption key or the algorithm is unknown.Several experiments are carried out to gauge the efficiency and the effectiveness of our work.We have implemented statistical analysis by computing the histogram, entropy, correlation of two adjacent pixels in the original and encrypted image, the size of key space and the secret key sensitivity.The experiments are evaluated using a standard data set of eight well-known color images accessible in the USC-SIPI Image Database (available online at: http://sipi.usc.edu/database/) with size 512*512.Furthermore, the image that is used to apply this improved algorithm is Lena as a standard image.The results of experimental and statistical analysis explain that our proposed algorithm supports an efficient and safe manner for protection image via network.

Histogram Analysis
The histogram of an image is considered one of the statistical analyzing features that analyze the distribution of cipher image pixels at individual levels of color intensity.The histograms of ciphered and original image Lena are explained in Figure 6 for red, green and blue channels.To prevent the leakage of information to attackers, it is important to ensure that encrypted and original images do not have any statistical similarities (Huang, 2012 ).
Figure 6 shows that the almost uniform distribution of the histograms of encrypted images which differ considerably from the respective histograms of the original image.
Figure 6.Histograms of original and encrypted image

Correlation Coefficient Analysis
Lower correlation is a concept to measure the security efficiency of the proposed algorithm based on the fact that the adjacency pixels in an input image are strongly correlated (Usama et al., 2010).Figure 7 utilized correlation the adjacent pixels in the original image and encrypted image.This was followed by randomly selecting 1000 pairs of two adjacent in (vertical, horizontal, and diagonal direction) pixels from an image.Next, with reference to (Wang, & Wang, 2014), the correlation coefficient was measured using the following formula: where E(x) and D(y) are the estimated expectation and variance of x, and v is the number of random pairs.Here, Cov(x,y) is the estimated covariance of gray scale values x and y of the two adjacent pixels in the image.In Table 1 and Table 2, the correlation coefficient results are shown and Figure 8 explains the two adjacent pixels are distributed in both vertical and horizontal directions respectively in all dataset original images and their encrypted images.A comparison between the distributed way of cipher and plain images shows it is obvious, that pixels in the original image are of high concentration, whereas the encrypted image pixels are uniformly spread.
As a result, Table 1 provides an excellent presentation of the neighbor pixels in both directions of the original image which are strongly correlated as shown in Figure 8. Correlation coefficients are (+0.0010)and (-0.0012) in horizontal and vertical directions in the encrypted image which is negligible.Thus the analyses of these correlations confirm that the proposed encryption procedure meets zero correlation.Therefore, it could be known that there are no detectable correlations exist between the plain image and its corresponding cipher images.

Entropy
The entropy is used to quantify the threat-prone rate for retrieving the original image without knowing the key.
The value of entropy closer to eight signifies excellent performance.Other values of entropy are considered as the perceptual threat fidelity (Kaur & Singh, 2013).The expression for entropy yields is: where P(si) is the probability of the ith event of the image Si and n is the total number of image pixels.A value of entropy, H(s) = 8 corresponds to a truly random source.
Essentially, the security performance of the proposed method in terms of entropy is applied for all dataset images to confirm the protection performances of the proposed algorithm and the calculated value of entropy is listed in Table 3.Moreover, all entropy values in Table 3 are shown in Figure 9 all at the same level, implying that all dataset encrypted images cannot be broken by threat.All the results are generated from the random secret keys that are used for each image and the original image content itself.

Key Space Size
An ideal generator of secret key should possess a large key space to ensure that brute-force attacks and exhaustive attack are not possible.It is generally accepted that a key space of size smaller than 2 128 is not sufficiently secure (Janke, 2002).Here, the key space is constructed from the initial value between (0 and 1) which is used as input of the total number of initial seed values which is needed to generate a dynamic matrix key ( as explained in in Section 3.2) therefore, the key space size of the secret key is about 2 256 .As such, the key space size is sufficiently large to repel brute-force attacks.Such a large space of keys is a crucial necessity, but not adequate enough.Indeed, all the product keys must also be cryptographically strong and uncorrelated.

Key Sensitivity Analysis
Indeed, a good image encryption algorithm has to be sensitive to the cipher keys and the key space should be appropriately large to repel brute-force attacks.The key space analysis and testing of the proposed algorithm are carefully performed.The total number of pixels in each block is used to generate the secret keys.Therefore, the number of initial keys is varied based on the number of blocks used for encryption.Consequently, the key space depends on the number of pixels for each block.Even for the same initial key the generated key is completely different and nonlinear.The encryption key sensitivity is further tested by comparing the achieved ciphered image by considering a 16-cipher key.The following steps are performed: 1.An original image in Figure 10  Figure 10 shows the original image together with the three encrypted images.The comparison of the encrypted images by simply observing these images is not easy.Therefore, the correlation between the corresponding pixels of the three encrypted images is calculated using equation 8 except the fact that x and y are the values of corresponding pixels in the two compared encrypted images.The results of the correlation coefficients between the corresponding pixels of the three encrypted images A, B and C are presented in Table 4.It is evident that no correlation exists among the three encrypted images even though they are produced by using slightly different secret keys.This result indicates that the proposed algorithm is very sensitive to any small change in the values of the secret key.So the proposed scheme can resist against brute-force attack.

Statistical Analysis of Secret key
Any new secret key must be analyzed against attacks in order to check if the generator cannot be broken.Here, the resistance of the generator against the brute-force attack which is a standard attack that can be used against any secret key.Hence, the purpose of this section is to present the approaches which are used to analyze the qualities of the produced secret key sequences.These qualities are examined properties randomness of each individual sequence and the correlation between multiple sequences.In order to achieve this objective, frequency test is applied and Figure 11 explains the distribution of the secret key sequence sample.To determine the randomness of all random number generation with various seed keys (0-4), we can find the three curves almost overlap and the variation ranges from (0 -4) as shown in Table 4.In fact, less variance means the best randomness value (Han et al., 2013).Therefore, we conclude that, when (seed> 0.79), then the random distribution of the random secret key sequences is better.
Results from Table 5 and the graphic representation of the randomness results in Figure 12 are shown to meet the requirements for the uniform distribution.As such, it can be concluded that random key generated by proposing dynamic secret key generation is uniformly distributed.

Comparing the Proposed Method and Others
In this section, the comparison between the proposed algorithm with several algorithms which use the same dataset in gray or color scales.The CC and entropy of the ciphered images are computed for each algorithm and the results are provided in Table 6 and Table 7 that clearly display the superior security level of the proposed algorithm compared to others.The possibility of threat is minimal and no one can break the cipher without knowing the secret key.Data in Table 6 and Table 7 exhibit the achievement of highest entropy and lowest correlation coefficients for all CC directions using the proposed technique at different color scales compared to several other techniques.This comparison reveals that the proposed technique is able to achieve the best security performance.

Conclusion
We conclude that a secret key plays a very important role in encryption security, so that a good key generation unit is required.This paper, proposed a new dynamic random number generation employing a combination of two chaotic map methods based on the properties of chaos functions and the possibility of creating very long length keys.Based on the key's large space in the combined chaos functions, this technique is very robust.Moreover, it is very sensitive to even minute modifications in key so even with knowing the key's approximate values it is still not possible for the attacker to break the cipher.In addition it creates automatic seed values based on sunflower spiral points.The advantages of the generator are: high sensitivity to initial seed values, high level of randomness and good throughput.Although what is presented is the dynamic secret key generator, the proposal has focused on an image protection, but it can be applied extensively in other information security fields with excellent results.Our proposal enables sending an initial condition to another party over the open network.The varying space sized block secret keys are randomly produced with one initial condition.It is further demonstrated that these dynamic matrix secret key are responsible for increasing the security level based on large key space size with better randomness distribution.
Figure 1.Sunflower architecture (a) General view (b) Sunflower points

Figure 2 .
Figure 2. General block diagram of the image encryption technique depicts the block diagram for the dynamic secret key generation.The input is the initial condition μ which ranges between 0 and 1 with 0 < μ ≤ 4 and t is the total number of secret keys generated to obtain the final output {K1, K2… Kn}.Finally, the (R*n) secret keys are generated automatically and will be converted from float values [0...1] to the integer values [0...255].After that, convert the stream secret keys to matrix of size n*n where n=16.

Figure 5 .
Figure 5. Chaotic-modulation of dynamic secret key generation

Figure 7 .
Figure 7. Correlation Coefficients of two adjacent pixels (a) is ciphered employing the secret key {3.99} called key1 and the resultant image is known as a ciphered image A as indicated in Figure 10(b).2.The same original image is ciphered by making a minor modify in the secret key, i.e., ={2.95} called key 2 and the resultant image is known as ciphered image B as illustrated in Figure 10(c).3. Again, the same original image is ciphered by making a slight change in the secret key, i.e., secret key {1.22} called key 2 (modification is made in the last digit) and the resultant image is known as ciphered image C as displayed in Figure 10(d).4.Finally, a comparison is made of the three ciphered images A, B and C.

Figure 10 .
Figure 10.Key sensitivity of the proposed algorithm for a) original image and b) encrypted image with key1 c) key2 and d) key3

Figure 11 .
Figure 11.Distribution of the secret key set

Figure 12 .
Figure 12.Randomness analysis using three different seed keys

Table 1 .
Correlation Coefficient between original and Encrypted Images

Table 2 .
Average Correlation Coefficient between original and Encrypted Images

Table 5 .
Average Variance for 10 different initial conditions

Table 6 .
Comparison of CC values of proposed technique with other algorithms

Table 7 .
Comparison of entropy values of proposed technique with other algorithms