Abstract
In this article, we introduced a digital image encryption algorithm based on the chaotic mapping designed by Xiong et al. In their paper, the authors theoretically analyzed the algorithm and pointed out that the algorithm did not need to have the prior knowledge of the orbital distribution and one can select any chaotic model. In this way, the algorithm greatly expanded the cryptographic space and greatly reduced the number of iterations of the mapping. Since the algorithm has many characteristics, for instance, it is sensitive to the secret key, its key space is big, the pixel is well distributed after being encrypted, etc., the security of the encrypted images can be assured effectively. However, since the algorithm applied the image scrambling for encryption, and did not take the chosen-plaintext attacks into consideration, the algorithm is relatively weak in resisting the chosen-plaintext attacks. Therefore, we put forward a kind of image replacement method based on chaos, which can resist the chosen-plaintext attacks. And the experimental simulation proves that this algorithm not only has many characteristics, for instance, it is sensitive to the secret key, its key space is big, the pixel is well distributed after being encrypted, etc., but also can resist the chosen-plaintext attacks effectively. In the meanwhile, the algorithm is very sensitive to the small changes of the plaintexts, and its encrypted images will completely lose the features of the original ones.
Introduction
In recent years, digital data traffic was growing rapidly in unsafe transmission channels. The protection of digital data, especially the protection of digital image protection, is becoming more and more important for many reasons, such as confidentiality and integrity. Therefore, the most common way to solve the security problems is encryption. According to Shannon, the basic techniques 1 for an encryption system can be classified into two main categories: diffusion and confusion. And the combination between the two classes is also possible. In the past few years, due to the close relationship between cryptography and chaos,2–4 some studies based on chaotic systems have been realized. The scheme based on chaotic system has the characteristics of pseudo-randomness, ergodicity and sensitivity to initial conditions, which ensures the security and efficiency of the system.
On the other hand, some cryptosystems are incomplete. The authors of literature 5 asserted that they analyzed the security of a recent image encryption algorithm based on an improper fractional-order chaotic system suggested in literature. 6 Analogously, in literature, 7 the authors scrutinized and indicated the security properties of the algorithm and evaluated the validity of the used quantifiable security metrics. In addition, they claimed that some common insecurity problems in the field of chaotic image encryption are found in a chaotic image encryptionalgorithm based on information entropy (IEAIE), 8 e.g. the short orbits of the digital chaotic system and the invalid sensitivity mechanism built on information entropy of the plain image. Even worse, each security metric is questionable, which undermines the security credibility of IEAIE. Therefore, it is not easy to design a good digital image encryption algorithm. How to design a method that balances efficiency and security has always been a hot topic in chaotic encryption discussion.
In this work, we first introduce a new digital image encryption algorithm based on chaotic mapping. 9 Then, we improve the algorithm. On the basis of maintaining the original security and not increasing the number of keys, plaintext information is added to the encryption process to make it resist the selective plaintext attack. We also analyze the improved algorithm in the aspects of the influence of floating-point operation, key space, key sensitivity, information entropy, histogram, correlation and plaintext sensitivity through experiments. The analysis results show that our encryption/decryption algorithm can effectively realize the encryption/decryption of digital image data.
The rest of the paper is organized as follows. In the next section, a digital image encryption algorithm is introduced and improved. The analyses of the improved algorithm are described in the ‘Algorithm performance analysis’ section. The comparisons with several similar algorithms are presented in section 4. Finally, conclusions are given.
Improvement for XZQ image encryption algorithm
Digital image encryption algorithm based on chaotic mapping – XZQ
A new algorithm of digital image encryption based on chaotic map is proposed by Xiong et al. 9 We take the initials of the author’s surname, for short, marked as XZQ.
The encryption steps of XZQ algorithm are as follows.
Step 1. Choose a chaotic mapping to generate a chaotic sequence with initial parameters Step 2. Generate a double-precision chaotic sequence Step 3. Set Step 4. Make similar changes in the rows of image to complete image encryption.
Decryption algorithm and encryption algorithm are similar basically, but their difference is in Step 2. In decryption algorithm, the image decryption can be realized by permuting the pixels in first row according to permutation address set
XZQ algorithm puts forwards a new kind of encryption algorithm based on chaotic mapping, namely sorting chaotic sequences of real numbers in descending order to permute image location. This method does not require prior knowledge of orbit distribution where any chaotic model can be used to greatly expand cipher space of algorithm; iterations of chaotic mapping in the algorithm are greatly reduced and the characteristics (such as key sensitivity, large key space and uniform distribution of encrypted pixel) of chaos can be better utilized to effectively guarantee the safety of encrypted image.
From the basic theories applied in the processes of encryption algorithm, we can know that XZQ image encryption algorithm is mainly scrambling images, which does not change the pixel size of image, and the scrambling is based on one row or one column. To some extent, this algorithm cannot resist chosen-plaintext attack.
Considering the discussion above, we propose the following improved algorithm which is called Add-image-feature image encryption algorithm based on chaos (abbreviated as Chaos-AIF image encryption algorithm). The new algorithm uses chaotic system to enhance the complexity and confidentiality of scrambling rules (elementary matrix). In scrambling process, we add the characteristic information of plaintext 10 to make the system sensitive to plaintext information (namely resistant to chosen-plaintext attack).
Principles of Chaos-AIF image encryption algorithm
Before scrambling, we first extract the characteristic information representing to-be-encrypted image which is set as H. We use the randomness of the chaotic phenomena to generate chaotic sequence; sort this sequence in ascending (or descending) order (this can be regarded as scrambling targeting original chaotic sequence). We apply the scrambling rules to image to scramble images.
In addition, in order to resist chosen-plaintext attack, we carry out certain operation on image’s characteristic information H and given initial value for chaos (namely secret key), which will generate the final initial value for chaos. Then, we use the final initial value for chaos to generate chaotic sequence.
Suppose the to-be-encrypted image as
This is an XOR operation on all pixel values of images, and then we can generate the initial value of final chaotic sequence, where
At this time, chaotic sequence is related to given initial chaotic value (secret key) and to-be-encrypted image.
The value of the image’s characteristic information is related to the image’s pixel value and the encryption operation is the scrambling image instead of modifying the pixel value; so, the characteristic value of the encrypted image is consistent with the characteristic information of the original image. That is, no additional key parameters are needed to store image’s characteristic value, as shown in Figure 1.

Schematic diagram of chaotic scrambling algorithm.
Suppose image is
Encryption algorithm is as follows:
Extract characteristic value of to-be-encrypted image and work out Use initial chaotic value Sort this chaotic sequence Use matrix
Decryption algorithm:
Extract characteristic value of to-be-decrypted image. Use initial chaotic value Sort this chaotic sequence Use matrix
Chaos-AIF image encryption and decryption algorithm
Suppose the image size is
Below, we illustrate chaotic encryption and decryption steps by scrambling one row in image.
Step 1. Use Step 2. Select the initial value Step 3. Generate a chaotic sequence Step 4. Sort this sequence Step 5. Carry out scrambling on pixels in Row One of image, and we have
At this moment, the scrambling process in row of image is completed.
Similarly, repeat Steps 3, 4, 5 successively to process every row in image to complete the whole image scrambling process. The initial chaotic value and system parameter selected in encryption process are encryption key. It can be seen that this image encryption is image scrambling process.
Decryption process is the inverse process of encryption process.
Figure 2 is original Lena image plus original image, scrambling image and restored image of tested image. It can be seen from the figure that the image has lost original appearance.

Lena image plus encrypted and decrypted images of tested image. (a) Original Lena image. (b) Encrypted image of original image. (c) Restored image from (b). (d) To-be-decrypted image. (e) Encrypted image of to-be-decrypted image. (f) Restored image from (e).
Performance analysis of the algorithm
Influence caused by floating-point arithmetic
According to the floating point standard, a sequence of
As to the single-precision floating-point format (binary32), e.g. “float” in C-language and “single” in Matlab, (l;m) = (8; 23), whereas (l;m) = (11; 52) in double-precision floating-point format (binary64). In IEEE 754-2008, half precision floating-point format (binary16) is designed for storaging with a higher precision, not for performing arithmetic computations, where (l;m) = (5; 10). Meanwhile, due to the intermediate scale of the data generated by binary16, its simulation is widely adopted for experiments. 12
According to the research in literature, 11 the state mapping network of digital map can be used as an effective tool to classify its structure and roughly verify its randomness in small precision digital domain. That analysis can be further extended to high-dimensional chaotic systems. In this work, floating-point operations have little influence on the selection of chaotic sequences, which can be neglected.
Key space analysis
XZQ algorithm and Chaos-AIF algorithm have the same key space because both of them have the same key characteristics.
Sensitivity to secret key
Both XZQ algorithm and Chaos-AIF algorithm utilize the sensitivity of initial chaotic value to achieve sensitivity of key, so they have same effect on sensitivity of key. Here, we do experiment only on Chaos-AIF.
Set

Sketch of decryption and encryption results of Lena image. (a) Original Lena image. (b) Encrypted image 1 of (a). (c) Encrypted image 2 of (a). (d) Encrypted image 3 of (a). (e) Decrypted image of (b). (f) Decrypted image of (b).
In Figure 3, (a) is original Lena image; (b) to (d) are encrypted image obtained by using secret keys correspondingly (0.563251458, 3.7512634), (0.563251468, 3.7512634) and (0.563252458, 3.7512634) with small differences; (e) is original image obtained through decrypting (b) with (0.563251458, 3.7512634); (f) is original image obtained through decrypting (b) using secret key (0.5632514581, 3.7512634), which has a small difference with (0.563251458, 3.7512634).
We analyze the results and find that small change in keys will produce different encrypted images; only use of original encrypted key as decrypted key can restore the original image exactly, showing that encryption algorithm is sensitive to secret key.
Information entropy analysis
In this part, we test the randomness of our algorithm, where the true random variable should generate 28 symbols with equal probability and the entropy value equal to 8. To check, the entropy value of the cipher images by
Histogram analysis
The cryptanalyst can get very useful information from the image histogram by analyzing it, where the good encryption algorithm should generate uniform distribution of the histogram. In our tests, we selected three gray-scale images and encrypted them using Chaos-AIF algorithm separately. Figure 4 shows the histogram analysis of the original image and the cipher image using Chaos-AIF algorithm, respectively. As can be seen from the results, it is very difficult to get any information from the histogram.

(a) Original images, (b) histogram of the original images and (c) histogram of the cipher images using Chaos-AIF algorithm.
Correlation analysis
It is known that some algorithm was broken by using correlation analysis between the adjacent pixels. So, we try to study the relations between the adjacent pixels by calculating the correlation coefficient for all possible cases. The correlation coefficient is calculated by
Table 1 shows the correlation coefficients between two adjacent pixels in all possible cases (vertically, horizontally and diagonally) of the original image and the cipher image. The results revealed that the correlation between adjacent pixels in the cipher text image of the improved algorithm is very small, which shows that the improved algorithm can achieve the requirement of reducing the correlation of adjacent pixels.
Correlation coefficients of adjacent pixels.
Time complexity analysis
Three popular image databases are used for testing: USC-SIPI image database (totally 306 images, available on the website “http://sipi.usc.edu/database”), UCID image database 13 (totally 1338 images) and JAFFE facial expression database 14 (totally 213 images). Here, we choose five gray images from the USC-SIPI “Miscellaneous” dataset, shown in Figure 5; they are processed into 64 × 64, 128 × 128, 256 × 256, 512 × 512 and 1024 × 1024 pixel gray images, respectively. Then, the experimental comparison is made under the MATLAB implementation with four similar algorithms in recent years. They are Dagadu’s, 15 Slimane et al.’s, 16 Khan et al.’s, 17 and Essaid et al.’s. 18

Images selected in the experiment.
Chaos-AIF algorithm has a high encryption speed. The encryption/decryption time for an image with a size of 256 × 256 is 0.0637 ± 0.01432 s. Table 2 compares the encryption speeds of several image encryption algorithms for different sizes of images. Chaos-AIF has the fastest encryption/decryption speed. Thus, it has the lowest time complexity.
Encryption speeds (second) of several image encryption algorithms for different sizes of images.
Plaintext sensitivity
Plaintext sensitivity is very important for high-intensity image encryption schemes. Its slightly modified versions (embedding watermarks or some hidden messages) are often encrypted at the same time. If the encryption scheme used does not meet the sensitivity requirement, the leakage of one cryptographic image corresponding to two similar ordinary images may leak the other’s visual information. In order to test sensitivity dependence of encryption algorithm on plaintext, we randomly choose and modify one point in Lena image, then encrypt Lena image and modified Lena_1 image with the same key, obtaining two encrypted images. It is shown in Figure 6.

Encrypted results of Lena image and modified Lena image using XZQ algorithm. (a) Original Lena image. (b) Encrypted Lena image. (c) Modified Lena image. (d) Encrypted image of (c).
We compare the two files using Hex Comparison software, and the result is shown in Table 3.
Binary contrasts between two encrypted images.
The results show that the encrypted images are totally different when small differences exist in original images using same keys in Chaos-AIF algorithm, which shows that algorithm is sensitive to plaintext.
Chosen-plaintext attack
The chosen-plaintext attack is a well-known and effective method to break an encrypted result. An encryption algorithm with a good diffusion property can resist the differential attack. The number of pixel change rate (NPCR) and unified averaged changed intensity (UACI) can be used to evaluate the diffusion property of an image encryption algorithm. Mathematically, the NPCR and UACI between two images
We selected 12 test images from the USC-SIPI “Miscellaneous” image dataset; there are four images with the size of 256 × 256, four images with the size of 512 × 512, and four images with the size of 1024 × 1024. For each test image, we change one bit of a randomly selected pixel to generate a new plaintext image, and then encrypt both plaintext images using five encryption algorithms with the same security key. Tables 4 and 5 show the NPCR and UACI results of five algorithms under the significance level.
The NPCR results of different image encryption algorithms (
The UACI results of different image encryption algorithms (
We can see that most images encrypted using Chaos-AIF can pass the NPCR and UACI tests. These prove that the encrypted images using Chaos-AIF have a good diffusion property and can withstand the differential attack.
Robustness to noise and data loss
Image encryption algorithm should be robust against noise and data loss. The encryption and decryption process of Chaos-AIF is asymmetric. Therefore, it can decrypt cipher text images with noise or data loss. Figure 7 shows the case when 20% Gauss noise is added and upper left corner data is lost. It can be seen that when the cipher text image has noise or data loss, Chaos-AIF can still restore the original image. Although the restored image has some noise, we can still recognize most of the image information.

Robustness analysis results of noise and the data loss. (a) Encrypted image with 20% Gauss noise. (b) Decrypted image with 20% Gauss noise. (c) Encrypted image lost in the upper left corner. (d) Decrypted image lost in the upper left corner.
Conclusions
In this paper, a digital image encryption algorithm based on chaotic map is introduced, and the algorithm is analyzed theoretically. The algorithm has the characteristics of sensitive key, large key space and uniform distribution of pixels after encryption, which can effectively protect the security of encrypted images. But because the algorithm uses image scrambling to achieve encryption, and does not consider the choice of plaintext attack, the algorithm is weak in resisting the selection of plaintext attack. Based on the above considerations, we propose a chaotic-based image replacement method which can resist chosen plaintext attacks. The experimental simulation results are also given. The results show that the algorithm can effectively resist the selection of plaintext attacks, and is very sensitive to the small changes in the plaintext, and the encrypted image completely loses the image of the original image.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
