# An Image Encryption Algorithm Based on Balanced Pixel and Chaotic Map

Authors: Jian Zhang; Yutong Zhang
Journal: Mathematical Problems in Engineering
 (2014)

---

## Abstract

Image encryption technology has been applied in many fields and is becoming the main way of protecting the image information security. There are also many ways of image encryption. However, the existing encryption algorithms, in order to obtain a better effect of encryption, always need encrypting several times. There is not an effective method to decide the number of encryption times, generally determined by the human eyes. The paper proposes an image encryption algorithm based on chaos and simultaneously proposes a balanced pixel algorithm to determine the times of image encryption. Many simulation experiments have been done including encryption effect and security analysis. Experimental results show that the proposed method is feasible and effective.


---

## Body

## 1. Introduction

With the development of technology, encryption and dissemination of digital images developed rapidly. They have been used in many fields such as military, medical, industrial, and multimedia fields [1]. In the past years, many encryption modes have been proposed including scan mode method [2], double random phase encoding [3], encoding and iterative random rotation converts vector encoding [4, 5], the quad tree coding [6], and coding and chaotic function Kolmogorov flow [7]. Due to the inner randomness and initial sensitivity, chaotic encryption has been used widely and developed fast [8]. Chaos encryption method is mainly to change the position and value of pixels in the image [9]. Among the existing methods, many methods need to be encrypted several times because of the unsatisfied effect [10–14], but there is no effective way to make sure of the exact number of encryption times. Considering this, the paper proposes an encryption algorithm based on chaos and iteration equation and gives the method to determine the number of encryption times. In the algorithm, we present an encryption method based on one-dimensional logistic map and change the position and value of pixels sufficiently. By balancing the pixels, the number of encryption times can be decided and the effectiveness of the algorithm through lots of experiments can be verified.


## 2. The Chaos Theory and Iterative Equation

### 2.1. The Chaos Theory

Chaotic system has the characteristic of inner randomness and sensitivity to initial value. The inner randomness is that random uncertainty from the chaotic system happens naturally, not because of the external environmental effect [15]. What is more, the sensitivity to initial value means two initial values which are close enough experience a long time along the trajectory and will get two totally different results.Because this algorithm involves the choice of the initial value of seedg (the following part will express seed g), we need it to have two characteristics which are randomness and high sensitivity. So it is necessary to introduce the one-dimensional chaos equation logistic function which has these two characteristics.The one-dimensional chaos equation logistic function is given by(1)Xn+1=μXn1-Xn,
where μ∈0,4 and X∈0,1. Research shows that when X∈0,1 the function stays in a chaotic condition and shows a state of random uncertainty [16, 17]. The μ is closer to 4, X is closer to even distribution in 0,1. Therefore, the closer the value of μ is to 4, the better is the effect [18]. According to the experimental analysis, when μ=3.9999, for two quite close different initial values X0=0.675279000 and X0=0.675279001, the corresponding logistic sequences are almost the same in 30 times of iteration but are totally different after 30 times. So in this algorithm, select μ=3.9999, and each initial value X0 will be iterated 35 times and then be used and be computed.


### 2.2. Iterative Equation

In general, adjacent pixels in the image have a strong correlation [19]. Therefore, in order to improve the quality of the encrypted image encryption, iterative equation should make the position of each pixel change as far as possible [20], and, in this paper, the encryption process will directly work on each pixel in the original image. The original image can be seen as a two-dimensional matrix of N*M (N rows and M columns).The iterative equation is(2)Yn+1=Yn2mod⁡S*Yn+Ygmod⁡S,Y0=g,Yg=g2,
where S=L-1L is the size of the image I0 and L=N*M  S decreases with each iteration. The seed g is less than L. Each loop of the whole algorithm needs a new value. The S is a initial value from L-1 to 1. The position of pixel can be calculated by memory effect (e.g., the index i read out the size L of the input image and the new position of Yn after each displacement and i). Therefore, the value of the position of each pixel can be determined after several changes. The significance of this iterative equation is that disrupting the initial position of all of the pixel from 1 to L in the original image.


## 2.1. The Chaos Theory

Chaotic system has the characteristic of inner randomness and sensitivity to initial value. The inner randomness is that random uncertainty from the chaotic system happens naturally, not because of the external environmental effect [15]. What is more, the sensitivity to initial value means two initial values which are close enough experience a long time along the trajectory and will get two totally different results.Because this algorithm involves the choice of the initial value of seedg (the following part will express seed g), we need it to have two characteristics which are randomness and high sensitivity. So it is necessary to introduce the one-dimensional chaos equation logistic function which has these two characteristics.The one-dimensional chaos equation logistic function is given by(1)Xn+1=μXn1-Xn,
where μ∈0,4 and X∈0,1. Research shows that when X∈0,1 the function stays in a chaotic condition and shows a state of random uncertainty [16, 17]. The μ is closer to 4, X is closer to even distribution in 0,1. Therefore, the closer the value of μ is to 4, the better is the effect [18]. According to the experimental analysis, when μ=3.9999, for two quite close different initial values X0=0.675279000 and X0=0.675279001, the corresponding logistic sequences are almost the same in 30 times of iteration but are totally different after 30 times. So in this algorithm, select μ=3.9999, and each initial value X0 will be iterated 35 times and then be used and be computed.


## 2.2. Iterative Equation

In general, adjacent pixels in the image have a strong correlation [19]. Therefore, in order to improve the quality of the encrypted image encryption, iterative equation should make the position of each pixel change as far as possible [20], and, in this paper, the encryption process will directly work on each pixel in the original image. The original image can be seen as a two-dimensional matrix of N*M (N rows and M columns).The iterative equation is(2)Yn+1=Yn2mod⁡S*Yn+Ygmod⁡S,Y0=g,Yg=g2,
where S=L-1L is the size of the image I0 and L=N*M  S decreases with each iteration. The seed g is less than L. Each loop of the whole algorithm needs a new value. The S is a initial value from L-1 to 1. The position of pixel can be calculated by memory effect (e.g., the index i read out the size L of the input image and the new position of Yn after each displacement and i). Therefore, the value of the position of each pixel can be determined after several changes. The significance of this iterative equation is that disrupting the initial position of all of the pixel from 1 to L in the original image.


## 3. A Balanced Pixel Algorithm for Image Encryption

This proposed image encryption algorithm combines the chaos theory and iterative equation, converting the position and the value of each pixel of the original image to finish one loop encryption. In order to obtain a better effect of encryption, the algorithm proposes a method in which the number of encryption times can be defined. The flowchart of the algorithm is shown in Figure1.Figure 1
The flowchart of the algorithm.


### 3.1. The Theory and Steps of the Encryption

The process of the encryption is completed by the following six steps.(1)
The original image is withI0, a two-dimensional matrix of N rows and M columns; transform I0 into a one-dimensional sequence I0b[i] as shown in
(3)I0⟶I0bi.(2)
Given an initial value ofX0, μ=3.9999, according to the chaotic equation (1) get a random sequence about Xn. As mentioned, logistic function will show better avalanche state after 30 times of iteration, so in this algorithm we use the data after 35 iterations, that is, to use the data from the beginning of X35. Since the sequence Xn is a set of decimals between 0 and 1, while algorithm needs integer, so we expend each of the decimals we get 107 times and then get the last two digits as the value of g. Moreover, we also have to think about the value which is from the 35th of the sequence; thus, g is shown as
(4)gn=(107Xn+35)mod⁡100,
where n represents the number of cycling times of the whole algorithm.(3)
According to (2) and (4), a sequence about Yn is given.(4)
DetermineZ1, which is a sequence from an one-dimensional I0b, shown as (5):
(5)Z1=I0bi.(5)
DetermineZ2, which is an algebraic equation got from Yn about i, shown as
(6)Z2=I0bj=I0bYi+1+i-1.(6)
DetermineZ3, which is a sequence got from the XOR operation between Z1 and Z2, as
(7)Z3=Z1⊕Z2Z
1, Z2, and Z3 are a loop. Each loop will get Z3 and this Z3 will be the new Z1 of the next loop; then, according to (4) a new g to continue the next time of cycling is given.


### 3.2. Determination of the Number of Encrypting Times

In order to get a good effect, we need to repeat the six steps above several times (the six steps are the time of cycle of the encryption and also the main process of the algorithm). Each time of the cycling will get different effect of the encrypted image. To achieve the most effective encrypted image, an analysis of the number of cycling timesR is needed; then, the optimal value of the images with different size is given.


#### 3.2.1. Determination ofR1

R is related to R1 and R2, R1 is determined by key space, R2 can be given by experimental analysis, and what follows in the passage will be the determination of R in detail.According to today’s computing speed, statistical analysis shows that key space of the encryption system that is larger than2256 can resist brute force attacks. In this algorithm, each time of cycling will give an initial g (e.g., R=1) and generate L different codes. Therefore, as the growth of the cycling number R, the total number of keys can be shown as LR. To satisfy the relationship LR≥2256 and avoid brute force, the minimum of R is defined as
(8)256log2LHR1=Rmin⁡=Floor256log2L+1.As can be seen from the equation above,Rmin⁡ is a decreasing sequence, with the size of the image increasing, and the number of cycle times we need is decreasing. By (8) it can be calculated that R1 is decreasing with the increasing size of the image. Table 1 shows the corresponding R1 for different image size.Table 1
The relationship between the image size andR1.
Size
100
*
100
100
*
150
256
*
256
240
*
360
512
*
512
500
*
750
R
1
20
19
17
16
15
14R
1 is a limitation on key space, and to finalize R, a more important indicator is needed, that is, R2 balancing the image pixel value.


#### 3.2.2. Determination ofR2

Balance pixels, as the name suggests, are the average of pixels in an image. Grayscale images have 256 gray levels from 0 to 255. Each one is made up of several pixels of any level from 0 to 255. These 256 gray levels which are not necessary all appear in one image, and there is not a fixed value of them, so they are dispensable and can be more or less. A good encryption algorithm is to make the number of each encrypted image pixel be distributed evenly. Assuming anN*M image I0 needs to be encrypted, then the image has a total of L=N*M pixels. First calculating that the pixel value of 0 has h0 and pixel value of 1 has h1, so the pixel value of 255 has h255. Here hn stands for the number of pixel values of n, n∈0,255, and n is an integer. Evaluate a good encryption algorithm; a standard is to balance pixel as far as possible. Therefore, the experimental will give statistics about the balance of pixel after each time of cycle. Here the balance means that 256 gray levels are uniformly distributed in the whole image. Ideally there are L/256 pixels of each gray level in the image; the ideal value is recorded as H0 as shown in
(9)H0=L256.
Do the difference operation between hn and H0 and get the absolute value hn-L/256 which is the deviation between actual value and ideal value of each gray level pixel. It is recalled H~ as shown in
(10)H~=hn-H0.
Do quotient operation between H~ and H0 and get Kn which is the rate of deviation between the actual and ideal situations of each pixel as shown in
(11)Kn=H~H0.
Thus the total rate of deviation is the sum of these 256 Kn recorded as K and is as shown in
(12)K=∑n=0255Kn.
Then get the average rate of deviation K- which is shown in
(13)K-=K256.What we need to do is getting aK- after each time of cycle and make it as low as possible, and when it achieves the lowest point or a value that we can accept, stop cycling and get R2. Through comparing to R1, R2 should be selected larger than R1, and smaller than K-. This R2 is also the number of cycle times of the whole encryption algorithm.


## 3.1. The Theory and Steps of the Encryption

The process of the encryption is completed by the following six steps.(1)
The original image is withI0, a two-dimensional matrix of N rows and M columns; transform I0 into a one-dimensional sequence I0b[i] as shown in
(3)I0⟶I0bi.(2)
Given an initial value ofX0, μ=3.9999, according to the chaotic equation (1) get a random sequence about Xn. As mentioned, logistic function will show better avalanche state after 30 times of iteration, so in this algorithm we use the data after 35 iterations, that is, to use the data from the beginning of X35. Since the sequence Xn is a set of decimals between 0 and 1, while algorithm needs integer, so we expend each of the decimals we get 107 times and then get the last two digits as the value of g. Moreover, we also have to think about the value which is from the 35th of the sequence; thus, g is shown as
(4)gn=(107Xn+35)mod⁡100,
where n represents the number of cycling times of the whole algorithm.(3)
According to (2) and (4), a sequence about Yn is given.(4)
DetermineZ1, which is a sequence from an one-dimensional I0b, shown as (5):
(5)Z1=I0bi.(5)
DetermineZ2, which is an algebraic equation got from Yn about i, shown as
(6)Z2=I0bj=I0bYi+1+i-1.(6)
DetermineZ3, which is a sequence got from the XOR operation between Z1 and Z2, as
(7)Z3=Z1⊕Z2Z
1, Z2, and Z3 are a loop. Each loop will get Z3 and this Z3 will be the new Z1 of the next loop; then, according to (4) a new g to continue the next time of cycling is given.


## 3.2. Determination of the Number of Encrypting Times

In order to get a good effect, we need to repeat the six steps above several times (the six steps are the time of cycle of the encryption and also the main process of the algorithm). Each time of the cycling will get different effect of the encrypted image. To achieve the most effective encrypted image, an analysis of the number of cycling timesR is needed; then, the optimal value of the images with different size is given.


### 3.2.1. Determination ofR1

R is related to R1 and R2, R1 is determined by key space, R2 can be given by experimental analysis, and what follows in the passage will be the determination of R in detail.According to today’s computing speed, statistical analysis shows that key space of the encryption system that is larger than2256 can resist brute force attacks. In this algorithm, each time of cycling will give an initial g (e.g., R=1) and generate L different codes. Therefore, as the growth of the cycling number R, the total number of keys can be shown as LR. To satisfy the relationship LR≥2256 and avoid brute force, the minimum of R is defined as
(8)256log2LHR1=Rmin⁡=Floor256log2L+1.As can be seen from the equation above,Rmin⁡ is a decreasing sequence, with the size of the image increasing, and the number of cycle times we need is decreasing. By (8) it can be calculated that R1 is decreasing with the increasing size of the image. Table 1 shows the corresponding R1 for different image size.Table 1
The relationship between the image size andR1.
Size
100
*
100
100
*
150
256
*
256
240
*
360
512
*
512
500
*
750
R
1
20
19
17
16
15
14R
1 is a limitation on key space, and to finalize R, a more important indicator is needed, that is, R2 balancing the image pixel value.


### 3.2.2. Determination ofR2

Balance pixels, as the name suggests, are the average of pixels in an image. Grayscale images have 256 gray levels from 0 to 255. Each one is made up of several pixels of any level from 0 to 255. These 256 gray levels which are not necessary all appear in one image, and there is not a fixed value of them, so they are dispensable and can be more or less. A good encryption algorithm is to make the number of each encrypted image pixel be distributed evenly. Assuming anN*M image I0 needs to be encrypted, then the image has a total of L=N*M pixels. First calculating that the pixel value of 0 has h0 and pixel value of 1 has h1, so the pixel value of 255 has h255. Here hn stands for the number of pixel values of n, n∈0,255, and n is an integer. Evaluate a good encryption algorithm; a standard is to balance pixel as far as possible. Therefore, the experimental will give statistics about the balance of pixel after each time of cycle. Here the balance means that 256 gray levels are uniformly distributed in the whole image. Ideally there are L/256 pixels of each gray level in the image; the ideal value is recorded as H0 as shown in
(9)H0=L256.
Do the difference operation between hn and H0 and get the absolute value hn-L/256 which is the deviation between actual value and ideal value of each gray level pixel. It is recalled H~ as shown in
(10)H~=hn-H0.
Do quotient operation between H~ and H0 and get Kn which is the rate of deviation between the actual and ideal situations of each pixel as shown in
(11)Kn=H~H0.
Thus the total rate of deviation is the sum of these 256 Kn recorded as K and is as shown in
(12)K=∑n=0255Kn.
Then get the average rate of deviation K- which is shown in
(13)K-=K256.What we need to do is getting aK- after each time of cycle and make it as low as possible, and when it achieves the lowest point or a value that we can accept, stop cycling and get R2. Through comparing to R1, R2 should be selected larger than R1, and smaller than K-. This R2 is also the number of cycle times of the whole encryption algorithm.


## 3.2.1. Determination ofR1

R is related to R1 and R2, R1 is determined by key space, R2 can be given by experimental analysis, and what follows in the passage will be the determination of R in detail.According to today’s computing speed, statistical analysis shows that key space of the encryption system that is larger than2256 can resist brute force attacks. In this algorithm, each time of cycling will give an initial g (e.g., R=1) and generate L different codes. Therefore, as the growth of the cycling number R, the total number of keys can be shown as LR. To satisfy the relationship LR≥2256 and avoid brute force, the minimum of R is defined as
(8)256log2LHR1=Rmin⁡=Floor256log2L+1.As can be seen from the equation above,Rmin⁡ is a decreasing sequence, with the size of the image increasing, and the number of cycle times we need is decreasing. By (8) it can be calculated that R1 is decreasing with the increasing size of the image. Table 1 shows the corresponding R1 for different image size.Table 1
The relationship between the image size andR1.
Size
100
*
100
100
*
150
256
*
256
240
*
360
512
*
512
500
*
750
R
1
20
19
17
16
15
14R
1 is a limitation on key space, and to finalize R, a more important indicator is needed, that is, R2 balancing the image pixel value.


## 3.2.2. Determination ofR2

Balance pixels, as the name suggests, are the average of pixels in an image. Grayscale images have 256 gray levels from 0 to 255. Each one is made up of several pixels of any level from 0 to 255. These 256 gray levels which are not necessary all appear in one image, and there is not a fixed value of them, so they are dispensable and can be more or less. A good encryption algorithm is to make the number of each encrypted image pixel be distributed evenly. Assuming anN*M image I0 needs to be encrypted, then the image has a total of L=N*M pixels. First calculating that the pixel value of 0 has h0 and pixel value of 1 has h1, so the pixel value of 255 has h255. Here hn stands for the number of pixel values of n, n∈0,255, and n is an integer. Evaluate a good encryption algorithm; a standard is to balance pixel as far as possible. Therefore, the experimental will give statistics about the balance of pixel after each time of cycle. Here the balance means that 256 gray levels are uniformly distributed in the whole image. Ideally there are L/256 pixels of each gray level in the image; the ideal value is recorded as H0 as shown in
(9)H0=L256.
Do the difference operation between hn and H0 and get the absolute value hn-L/256 which is the deviation between actual value and ideal value of each gray level pixel. It is recalled H~ as shown in
(10)H~=hn-H0.
Do quotient operation between H~ and H0 and get Kn which is the rate of deviation between the actual and ideal situations of each pixel as shown in
(11)Kn=H~H0.
Thus the total rate of deviation is the sum of these 256 Kn recorded as K and is as shown in
(12)K=∑n=0255Kn.
Then get the average rate of deviation K- which is shown in
(13)K-=K256.What we need to do is getting aK- after each time of cycle and make it as low as possible, and when it achieves the lowest point or a value that we can accept, stop cycling and get R2. Through comparing to R1, R2 should be selected larger than R1, and smaller than K-. This R2 is also the number of cycle times of the whole encryption algorithm.


## 4. Experimental Analysis

### 4.1. Analysis on Encryption Effectiveness

This section will make specific experiment on algorithm and give the effectiveness analysis. Take an image of the size512*512 as an example and give the experimental process. The original image is shown as in Figure 2. When the file is a color image, the system will convert the image to grayscale automatically. The length and the width shown in the picture are just the size of the image, as this figure is 512*512.Figure 2
Original image.Start to encrypt; you can fill in the number of cycles needed. As can be seen from Table1, the smallest possible value of R1 is 15 for the 512*512 size image. To facilitate the observation of the image trend, input 25 times directly. Then press the button encrypt; program begins to run and several seconds later, the line chart is as shown in Figure 3(a) and the encrypted image is as shown in Figure 3(b).The line chart and the encrypted image.
(a)
The line chart
(b)
The encrypted imageFigure3 is the encrypted image of 25 times of cycle, which obviously have not achieved the desired effect, while it can be seen from the line chart that the lowest points of the plotline are the 7th, 15th, and 23rd times of cycle. To satisfy the condition not less than R1, reset the number of cycle times to 15, given the line chart and the encrypted image as shown in Figure 4. This time experiment gets a good effective encrypted image.The line chart and the encrypted image.
(a)
The line chart
(b)
The encrypted imageSeveral experiments statistical analysis can draw a conclusion that images of different sizes require different ideal numbers of cycle times shown in Table2.Table 2
Ideal number of cycling times.
Image size
100
*
100
100
*
150
256
*
256
240
*
360
512
*
512
500
*
750
Ideal number
23
23
23
23
15
15When given the size of an image, you can input the number of the cycle times directly according to Table2. Also the cycle times can be calculated. First get the restriction of R1 and then input a number which is larger than R1 as the cycle time (usually the number is larger than R1 10); observe the line chart that appeared and finally take the lowest point as the number of cycle times.Go on taking an image of size100*100 as the original figure. Based on the conclusion above, you can determine directly that it needs 23 times of cycling. The original and encrypted images are shown as in Figure 5 and the chart line is shown as in Figure 6. It displays that the lowest points are 7th, 15th, and 23rd points and the highest point is 16th point. Here the encrypted image and line chart of 16 times of cycling are shown as in Figure 7. It can be seen that the result is not that ideal but uneven.The original image and encrypted image.
(a)
The original image
(b)
The encrypted imageFigure 6
The line chart.The line chart and the encrypted image.
(a)
The line chart
(b)
The encrypted image


### 4.2. Analysis on Key Sensitivity

The experiments above can prove the effectiveness and practicality of the algorithm; a good algorithm should also have strong security to resist brute attack. This section will give the analysis on key sensitivity. The same512*512 picture of Lena is given as the original image. The initial value X0=0.642235000. The original image and encrypted image are as shown in Figures 8(a) and 8(b). When X0 is changed to X0′=0.642235001, the encrypted image cannot be decrypted successfully, which is shown in Figure 8(c). It shows that the algorithm has strong sensitivity to initial value.The effect of encrypted and decrypted images.
(a)
Original image
(b)
Encrypted image
(c)
Decrypted image


### 4.3. Analysis on Correlation

The correlation coefficient is the evaluation criterion for the degree of linear correlation between two random variables. We randomly selected 2,500 pairs of adjacent pixels (in vertical, horizontal, and diagonal directions) from both the original and encrypted images of Lena and calculated the correlation coefficient for each pair of adjacent pixels according to (14). Table 3 shows the results of correlation coefficients of two adjacent pixels, which are compared with the results in [21, 22]. The results indicate that the correlation of two adjacent pixels of the plain image is significant. Therefore, the encryption effect of this algorithm is pretty good. Therefore, the encryption effect of this algorithm is pretty good:
(14)rxy=cov⁡x,yDxDy,
where cov⁡x,y=1/N∑i=1Nxi-Exyi-Ey, Ex=1/N∑i=1Nxi, and Dx=1/N∑i=1Nxi-Ex2.Table 3
The comparison of the correlation coefficients of Lena’s images.
Correlation
Horizontal direction
Vertical direction
Diagonal direction
Original image
0.9768
0.9145
0.9353
Encrypted image
0.0027
0.0016
−0.0028
Reference [21]
0.0046
0.0043
0.0049
Reference [22]
0.0059
−0.0052
0.0190


## 4.1. Analysis on Encryption Effectiveness

This section will make specific experiment on algorithm and give the effectiveness analysis. Take an image of the size512*512 as an example and give the experimental process. The original image is shown as in Figure 2. When the file is a color image, the system will convert the image to grayscale automatically. The length and the width shown in the picture are just the size of the image, as this figure is 512*512.Figure 2
Original image.Start to encrypt; you can fill in the number of cycles needed. As can be seen from Table1, the smallest possible value of R1 is 15 for the 512*512 size image. To facilitate the observation of the image trend, input 25 times directly. Then press the button encrypt; program begins to run and several seconds later, the line chart is as shown in Figure 3(a) and the encrypted image is as shown in Figure 3(b).The line chart and the encrypted image.
(a)
The line chart
(b)
The encrypted imageFigure3 is the encrypted image of 25 times of cycle, which obviously have not achieved the desired effect, while it can be seen from the line chart that the lowest points of the plotline are the 7th, 15th, and 23rd times of cycle. To satisfy the condition not less than R1, reset the number of cycle times to 15, given the line chart and the encrypted image as shown in Figure 4. This time experiment gets a good effective encrypted image.The line chart and the encrypted image.
(a)
The line chart
(b)
The encrypted imageSeveral experiments statistical analysis can draw a conclusion that images of different sizes require different ideal numbers of cycle times shown in Table2.Table 2
Ideal number of cycling times.
Image size
100
*
100
100
*
150
256
*
256
240
*
360
512
*
512
500
*
750
Ideal number
23
23
23
23
15
15When given the size of an image, you can input the number of the cycle times directly according to Table2. Also the cycle times can be calculated. First get the restriction of R1 and then input a number which is larger than R1 as the cycle time (usually the number is larger than R1 10); observe the line chart that appeared and finally take the lowest point as the number of cycle times.Go on taking an image of size100*100 as the original figure. Based on the conclusion above, you can determine directly that it needs 23 times of cycling. The original and encrypted images are shown as in Figure 5 and the chart line is shown as in Figure 6. It displays that the lowest points are 7th, 15th, and 23rd points and the highest point is 16th point. Here the encrypted image and line chart of 16 times of cycling are shown as in Figure 7. It can be seen that the result is not that ideal but uneven.The original image and encrypted image.
(a)
The original image
(b)
The encrypted imageFigure 6
The line chart.The line chart and the encrypted image.
(a)
The line chart
(b)
The encrypted image


## 4.2. Analysis on Key Sensitivity

The experiments above can prove the effectiveness and practicality of the algorithm; a good algorithm should also have strong security to resist brute attack. This section will give the analysis on key sensitivity. The same512*512 picture of Lena is given as the original image. The initial value X0=0.642235000. The original image and encrypted image are as shown in Figures 8(a) and 8(b). When X0 is changed to X0′=0.642235001, the encrypted image cannot be decrypted successfully, which is shown in Figure 8(c). It shows that the algorithm has strong sensitivity to initial value.The effect of encrypted and decrypted images.
(a)
Original image
(b)
Encrypted image
(c)
Decrypted image


## 4.3. Analysis on Correlation

The correlation coefficient is the evaluation criterion for the degree of linear correlation between two random variables. We randomly selected 2,500 pairs of adjacent pixels (in vertical, horizontal, and diagonal directions) from both the original and encrypted images of Lena and calculated the correlation coefficient for each pair of adjacent pixels according to (14). Table 3 shows the results of correlation coefficients of two adjacent pixels, which are compared with the results in [21, 22]. The results indicate that the correlation of two adjacent pixels of the plain image is significant. Therefore, the encryption effect of this algorithm is pretty good. Therefore, the encryption effect of this algorithm is pretty good:
(14)rxy=cov⁡x,yDxDy,
where cov⁡x,y=1/N∑i=1Nxi-Exyi-Ey, Ex=1/N∑i=1Nxi, and Dx=1/N∑i=1Nxi-Ex2.Table 3
The comparison of the correlation coefficients of Lena’s images.
Correlation
Horizontal direction
Vertical direction
Diagonal direction
Original image
0.9768
0.9145
0.9353
Encrypted image
0.0027
0.0016
−0.0028
Reference [21]
0.0046
0.0043
0.0049
Reference [22]
0.0059
−0.0052
0.0190


## 5. Conclusion

This algorithm uses a chaos function acting on an iterative equation and then combines with XOR operation to encrypt images. The chaos function improves sensitivity to initial value, the iterative equation plays a role of changing the position, and the XOR operation transforms the value of pixels. Such a combination can enhance the effectiveness and security of the encryption algorithm. In addition, this algorithm has a characteristic of cycling the main encryption process many times to achieve an optimal encryption effect. Through several experiments, it can also be proved that the encryption speed is also relatively fast. An ordinary size of the image can be encrypted completely in a few seconds. To summarize the algorithm has the features of being fast, efficient, safe, and convenient. Certainly, to encrypt faster and more sophisticatedly, improvements on chaos and iterative equation can be made.



---

*Source: 216048-2014-11-10.xml*