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.

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 [1014], 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 seed (the following part will express seed ), 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 where and . Research shows that when the function stays in a chaotic condition and shows a state of random uncertainty [16, 17]. The is closer to 4, is closer to even distribution in . Therefore, the closer the value of is to 4, the better is the effect [18]. According to the experimental analysis, when , for two quite close different initial values and , 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 , and each initial value 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 ( rows and columns).

The iterative equation is where is the size of the image and    decreases with each iteration. The seed is less than . Each loop of the whole algorithm needs a new value. The is a initial value from to 1. The position of pixel can be calculated by memory effect (e.g., the index read out the size of the input image and the new position of after each displacement and ). 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 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 Figure 1.

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 with , a two-dimensional matrix of rows and columns; transform into a one-dimensional sequence as shown in (2)Given an initial value of , , according to the chaotic equation (1) get a random sequence about . 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 . Since the sequence is a set of decimals between 0 and 1, while algorithm needs integer, so we expend each of the decimals we get times and then get the last two digits as the value of . Moreover, we also have to think about the value which is from the 35th of the sequence; thus, is shown as where represents the number of cycling times of the whole algorithm.(3)According to (2) and (4), a sequence about is given.(4)Determine , which is a sequence from an one-dimensional , shown as (5): (5)Determine , which is an algebraic equation got from about , shown as (6)Determine , which is a sequence got from the operation between and , as

, , and are a loop. Each loop will get and this will be the new of the next loop; then, according to (4) a new 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 times is needed; then, the optimal value of the images with different size is given.

3.2.1. Determination of

is related to and , is determined by key space, can be given by experimental analysis, and what follows in the passage will be the determination of in detail.

According to today’s computing speed, statistical analysis shows that key space of the encryption system that is larger than can resist brute force attacks. In this algorithm, each time of cycling will give an initial (e.g., ) and generate different codes. Therefore, as the growth of the cycling number , the total number of keys can be shown as . To satisfy the relationship and avoid brute force, the minimum of is defined as

As can be seen from the equation above, 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 is decreasing with the increasing size of the image. Table 1 shows the corresponding for different image size.

is a limitation on key space, and to finalize , a more important indicator is needed, that is, balancing the image pixel value.

3.2.2. Determination of

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 an image needs to be encrypted, then the image has a total of pixels. First calculating that the pixel value of 0 has and pixel value of 1 has , so the pixel value of 255 has . Here stands for the number of pixel values of , , and 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 pixels of each gray level in the image; the ideal value is recorded as as shown in Do the difference operation between and and get the absolute value which is the deviation between actual value and ideal value of each gray level pixel. It is recalled as shown in Do quotient operation between and and get which is the rate of deviation between the actual and ideal situations of each pixel as shown in Thus the total rate of deviation is the sum of these 256 recorded as and is as shown in Then get the average rate of deviation which is shown in

What we need to do is getting a 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 . Through comparing to , should be selected larger than , and smaller than . This 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 size 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 .

Start to encrypt; you can fill in the number of cycles needed. As can be seen from Table 1, the smallest possible value of is 15 for the 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).

Figure 3 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 , 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.

Several experiments statistical analysis can draw a conclusion that images of different sizes require different ideal numbers of cycle times shown in Table 2.

When given the size of an image, you can input the number of the cycle times directly according to Table 2. Also the cycle times can be calculated. First get the restriction of and then input a number which is larger than as the cycle time (usually the number is larger than 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 size 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.

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 same picture of Lena is given as the original image. The initial value . The original image and encrypted image are as shown in Figures 8(a) and 8(b). When is changed to , 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.

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: where , , and .

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.

Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

Acknowledgments

This work is supported by the Fundamental Research Funds for the Central Universities (DL13CB04), Nature Science Foundation of Heilongjiang Province (LC2012C33), Science Technology Research Projects of Heilongjiang Province Education Department (12533006), and the National Natural Science Foundation of China under Grant 61300098.