Mathematical Problems in Engineering
Volume 2014 (2014), Article ID 216048, 7 pages
http://dx.doi.org/10.1155/2014/216048

Research Article

An Image Encryption Algorithm Based on Balanced Pixel and Chaotic Map

Jian Zhang and Yutong Zhang

College of Information and Computer Engineering, Northeast Forestry University, Harbin 150040, China

Received 20 August 2014; Accepted 28 September 2014; Published 10 November 2014

Academic Editor: Guoqiang Zhang

Copyright © 2014 Jian Zhang and Yutong Zhang. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

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 [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 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.

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

Table 1: The relationship between the image size and .

Size

20
19
17
16
15
14

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 .

Figure 2: Original image.

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).

(a) The line chart

(b) The encrypted image

Figure 3: The line chart and the encrypted image.

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.

(a) The line chart

(b) The encrypted image

Figure 4: The line chart and the 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.

Table 2: Ideal number of cycling times.

Image size

Ideal number
23
23
23
23
15
15

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.

(a) The original image

(b) The encrypted image

Figure 5: The original image and encrypted image.

Figure 6: The line chart.

(a) The line chart

(b) The encrypted image

Figure 7: The line chart and 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 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.

(a) Original image

(b) Encrypted image

(c) Decrypted image

Figure 8: The effect of encrypted and decrypted images.

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 .

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.

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.

References

S. Som and S. Sen, “A non-adaptive partial encryption of grayscale images based on chaos,” Procedia Technology, vol. 10, pp. 663–671, 2013.

M. François, T. Grosges, D. Barchiesi, and R. Erra, “A new image encryption scheme based on a chaotic function,” Signal Processing: Image Communication, vol. 27, no. 3, pp. 249–259, 2012.

H. Liu, X. Wang, and A. Kadir, “Image encryption using DNA complementary rule and chaotic maps,” Applied Soft Computing Journal, vol. 12, no. 5, pp. 1457–1466, 2012.

Y. Zhou, L. Bao, and C. L. P. Chen, “A new 1D chaotic system for image encryption,” Signal Processing, vol. 97, pp. 172–182, 2014.

A. Bakhshandeh and Z. Eslami, “An authenticated image encryption scheme based on chaotic maps and memory cellular automata,” Optics and Lasers in Engineering, vol. 51, no. 6, pp. 665–673, 2013.

R. Enayatifar, A. H. Abdullah, and M. Lee, “A weighted discrete imperialist competitive algorithm (WDICA) combined with chaotic map for image encryption,” Optics and Lasers in Engineering, vol. 51, no. 9, pp. 1066–1077, 2013.

H. Li and Y. Wang, “Double-image encryption based on discrete fractional random transform and chaotic maps,” Optics and Lasers in Engineering, vol. 49, no. 7, pp. 753–757, 2011.

Q. Zhang, L. Guo, and X. Wei, “Image encryption using DNA addition combining with chaotic maps,” Mathematical and Computer Modelling, vol. 52, no. 11-12, pp. 2028–2035, 2010.

A. Kanso and M. Ghebleh, “A novel image encryption algorithm based on a 3D chaotic map,” Communications in Nonlinear Science and Numerical Simulation, vol. 17, no. 7, pp. 2943–2959, 2012.

J. W. Yoon and H. Kim, “An image encryption scheme with a pseudorandom permutation based on chaotic maps,” Communications in Nonlinear Science and Numerical Simulation, vol. 15, no. 12, pp. 3998–4006, 2010.

Q. Zhang and X. Wei, “A novel couple images encryption algorithm based on DNAsubsequence operation and chaotic system,” Optik, vol. 124, no. 23, pp. 6276–6281, 2013.

M. Shan, J. Chang, Z. Zhong, and B. Hao, “Double image encryption based on discrete multiple-parameter fractional Fourier transform and chaotic maps,” Optics Communications, vol. 285, no. 21-22, pp. 4227–4234, 2012.

D. Kong and X. Shen, “Multiple-image encryption based on optical wavelet transform and multichannel fractional Fourier transform,” Optics & Laser Technology, vol. 57, no. 4, pp. 343–349, 2014.

R. Enayatifar, A. H. Abdullah, and I. F. Isnin, “Chaos-based image encryption using a hybrid genetic algorithm and a DNA sequence,” Optics and Lasers in Engineering, vol. 56, no. 5, pp. 83–93, 2014.

M. François, T. Grosges, D. Barchiesi, and R. Erra, “A new image encryption scheme based on a chaotic function,” Signal Processing: Image Communication, vol. 27, no. 3, pp. 249–259, 2012.

Y. Liu, J. Tang, and T. Xie, “Cryptanalyzing a RGB image encryption algorithm based on DNA encoding and chaos map,” Optics and Laser Technology, vol. 60, pp. 111–115, 2014.

X. Wang, L. Teng, and X. Qin, “A novel colour image encryption algorithm based on chaos,” Signal Processing, vol. 92, no. 4, pp. 1101–1108, 2012.

Q. Zhang, L. Guo, and X. Wei, “Image encryption using DNA addition combining with chaotic maps,” Mathematical and Computer Modelling, vol. 52, no. 11-12, pp. 2028–2035, 2010.

L. Liu, Q. Zhang, and X. Wei, “A RGB image encryption algorithm based on DNA encoding and chaos map,” Computers & Electrical Engineering, vol. 38, no. 5, pp. 1240–1248, 2012.

A. ur Rehman, X. Liao, A. Kulsoom, and S. A. Abbas, “Selective encryption for gray images based on chaos and DNA complementary rules,” Multimedia Tools and Applications, 2014.

I. Hussain, T. Shah, and M. A. Gondal, “Application of S-box and chaotic map for image encryption,” Mathematical and Computer Modelling, vol. 57, no. 9-10, pp. 2576–2579, 2013.

Y. Liu, X. Tong, and S. Hu, “A family of new complex number chaotic maps based image encryption algorithm,” Signal Processing: Image Communication, vol. 28, no. 10, pp. 1548–1559, 2013.