# A New Chaos-Based Image-Encryption and Compression Algorithm

Authors: Somaya Al-Maadeed; Afnan Al-Ali; Turki Abdalla
Journal: Journal of Electrical and Computer Engineering
 (2012)

---

## Abstract

We propose a new and efficient method to develop secure image-encryption techniques. The new algorithm combines two techniques: encryption and compression. In this technique, a wavelet transform was used to decompose the image and decorrelate its pixels into approximation and detail components. The more important component (the approximation component) is encrypted using a chaos-based encryption algorithm. This algorithm produces a cipher of the test image that has good diffusion and confusion properties. The remaining components (the detail components) are compressed using a wavelet transform. This proposed algorithm was verified to provide a high security level. A complete specification for the new algorithm is provided. Several test images are used to demonstrate the validity of the proposed algorithm. The results of several experiments show that the proposed algorithm for image cryptosystems provides an efficient and secure approach to real-time image encryption and transmission.


---

## Body

## 1. Introduction

An increasing amount of information is being transmitted over the Internet, including not only text but also audio, image, and other multimedia files. Images are widely used in daily life, and, as a result, the security of image data is an important requirement [1]. In addition, when either communication bandwidth or storage is limited, data are often compressed. In particular, when a wireless communication network is used, low-bit-rate compression algorithms are needed as a result of bandwidth limitations. Encryption is also performed when it is necessary to protect user privacy [2]. Image-encryption algorithms are used to provide this security; for our purposes, these algorithms can be divided into two groups with respect to the approach used to construct the encryption scheme: chaos-based methods and nonchaos-based methods. Image encryption can also be divided into full encryption and partial encryption (also called selective encryption) schemes according to the percentage of the data that is encrypted. Encryption schemes can also be classified as either combined-compression methods or noncompression methods.Several reviews have been published on image and video encryption, including selective (or partial encryption) methods, providing a fairly complete overview of the techniques developed to date [3]. Kunkelmann [4] and Qiao and Nahrstedt [5] provide overviews, comparisons, and assessments of classical encryption schemes for visual data, with an emphasis on MPEG. Bhargava et al. [6] review four MPEG-encryption algorithms published by the authors themselves from 1997 to 1999. More recent MPEG encryption surveys are provided by But [7] (in which the suitability of available MPEG-1 ciphers for streaming video is assessed). Other data formats have also been discussed with respect to selective encryption. Coding schemes based on wavelets [8], quad trees [9, 10], iterated function systems (fractal coding) [11], and vector quantization [12] have been used to create selective encryption schemes.In 1997, two kinds of schemes based on higher-dimensional chaotic maps were proposed in which a discretized chaotic map of the pixels in an image is permuted by several rounds of shuffling operations [2]. Between every two adjacent rounds of permutations, a diffusion process is performed, which can significantly change the distribution of the image histogram, thereby making a statistical decryption attack impossible. Empirical testing and cryptanalysis have both demonstrated that the chaotic Baker and Cat maps are good candidates for this kind of image encryption. Similar ideas have also appeared, including a 1998 paper [13], in which a rapid bulk-data encryption scheme was designed by combining chaotic. Kolmogorov flows with an adaptation of a very fast shift-register-based pseudorandom number generator [14]. Recently, a Feed-Back Chaotic Synchronization (FCS) for designing a real-time secure symmetric encryption scheme has been implemented in hardware [15–17].The basic principle of encryption with chaos is based on the ability of some dynamic systems to produce sequence of numbers that are random in nature. This sequence is used to encrypt messages. For decryption, the sequence of random numbers is highly dependent on the initial condition used for generating this sequence. A very minute deviation in the initial condition will result in a totally different sequence. This sensitivity to initial condition makes chaotic systems ideal for encryption.In this paper, we present an approach for encrypting images, our approach is based on chaotic maps, where we suggest to use the wavelet transform for image decomposition as we will discuss later and then we propose to use one, two, or three external encryption keys to encrypt the important part using one-dimensional chaotic map. We will provide a comparison in terms of the correlation between the original image and the encrypted image for all the three cases of encryption by the multiple keys when the number of external encryption keys increases in each time.Next section is an overview of our proposed method of selective encryption of an image. The rest of this paper is organized as follows: Sections3 and 4 give a brief discussion to the wavelet transform and chaos theory, respectively: Test, verification, and efficiency of the proposed new encryption algorithm are given in Section 5. Finally, Section 6 concludes this paper.


## 2. System Overview

In this paper, we propose an efficient, selective chaos-based image-encryption and compression algorithm. The block diagram of this algorithm is shown in Figure1. The encryption and compression operations is shown in Figure 1(a). First, we have set the chaotic map parameters (the initial values) as well as to select the external encryption keys. The chaos-based encryption algorithm is as follows: after wavelet transformation, an amount of 25% (in case of one-level decomposition) or 6.25% (in case of two-level decomposition) of the original image, which corresponds to the important part, is transformed into one-dimensional vector with a dimension equal to the important part size, let us call it W. The chaotic map will be run for W iterations and generate a vector of ones and zeros of dimension equal to W too; it will be called athreshold vector, then the pixels of the image vector will be encrypted with one, two, or three external encryption keys according to that threshold vector.The processes of the new algorithm.
(a)
The process flow of the encryption and compression operations(b)
The steps of decryption and decompression taken to reconstruct the imageFrom Figure1(b), the secret image of size (128×128) pixels is decomposed using discrete wavelet transform (DWT). In practice, this process of decomposition usually repeated n times, and it is repeated just on the LL-sub band as mentioned for octave-band decomposition. Here in this work, the decomposition will be for one-level or two-level decomposition in order to compare different amounts of encrypted data and examine their effect on security. The image is decomposed into four subimages: the approximation component (LL) and three detail components (horizontal, vertical, and diagonal). The most important component, the LL component, is then encrypted using a chaos-based image-encryption algorithm, and the other three components are subsequently compressed using wavelet analysis. The implementation of the algorithm achieves high encryption rates, as discussed in Section 5. The steps of decryption and decompression taken to reconstruct the image are described at Figure 1(b).


## 3. Wavelet Transform

A wavelet is a small wave with its energy concentrated in time, providing a tool for the analysis of time-varying phenomena. A wavelet not only has an oscillating characteristic but also has the ability to allow for simultaneous time and frequency analyses with a flexible mathematical foundation. The first step of a general image-compression technique is the wavelet transform, which is designed to distinguish between the visually important information and unimportant information. The transform is also intended to reduce the statistical dependence between coefficients so that the source coding will be more efficient.The important of wavelet as a multiresolution technique comes from its decomposition of the image into multilevel of the independent information with changing the scale-like geographical map, in which the image has nonredundant information due to the changing of the scale. In this way, every image will be transformed in each level of decomposition to a one low information image and three details image in horizontal, vertical, and diagonal axis image, also the low information image can be decomposed into another four images. These approaches of decomposition process provide us a number of unrealizable features in the original image, which appear in their levels after the application of transformation [18].There are different types of wavelet transforms, including continuous wavelet transform (CWT) and the discrete Wavelet Transform (DWT). The CWT is used for signals that are continuous in time, and the DWT is used when a signal is being sampled, such as during digital signal processing or digital image processing [19]. In this work, discrete wavelet transform is used. In a discrete wavelet transform, an image can be analyzed by passing it through an analysis filter bank, which consists of a low-pass and high-pass filter at each decomposition stage. When a signal passes through these filters, it is split into two bands. The low-pass filter, which corresponds to averaging operation, extracts the coarse information of the signal. The high-pass filter, which corresponds to a differencing operation, extracts the detail information of the signal. The output of the filtering operations is decimated by 2. A two-dimensional transform can be accomplished by performing two separate one-dimensional transforms. First, the image is filtered along the x-dimension using low pass and high pass analysis filters and decimated by 2. Low pass filtered coefficients are stored on the left part of the matrix and high pass filtered on the right. Because of decimation, the total size of the transformed image is same as the original image. Then, it is followed by filtering the subimage along the y-dimension and decimated by 2. Finally, the image has been split into four bands denoted by LL, HL, LH, and HH, after one-level decomposition. The LL band is again subject to the same procedure. The reconstruction of the image can be carried out by reversing the above procedure, and it is repeated until the image is fully reconstructed [18, 19]. This procedure of wavelet splitting is shown in Figure 2.Figure 2
Splitting of subband into next higher Level four subbands.


## 4. Image Encoding Using 1D-Discrete Chaotic Maps

In mathematics and physics, chaos theory describes the behavior of certain nonlinear dynamical systems that, under certain conditions, exhibit dynamics that are highly sensitive to initial conditions. As a result of this sensitivity, the behavior of chaotic systems appears to be random as a result of the exponential growth of errors in the initial conditions. This apparently chaotic behavior occurs even though these systems are deterministic in the sense that their future dynamics are well defined by their initial conditions, and there are no random elements involved. A chaotic dynamical system is a deterministic system that exhibits seemingly random behavior as a result of its sensitive dependence on its initial conditions and can never be specified with infinite precision. The behavior of a chaotic system is unpredictable; therefore, it resembles noise [18]. The close relationship between chaos and cryptography makes a chaos-based cryptographic algorithm a natural candidate for secure communication and cryptography [1]. Chaotic maps and cryptographic algorithms (or, more generally, maps defined on finite sets) have similar properties, such as sensitivity to changes in the initial conditions and parameters, pseudorandom behavior, and unstable periodic orbits with long periods. In a cryptographic algorithm, repeated encryption rounds lead to the desired diffusion and confusion properties of the algorithm. Iterations of a chaotic map spread the initial region over the entire phase space. The parameters of the chaotic map may represent the key to the encryption algorithm.An important difference between chaos and cryptography is that encryption transformations are defined on finite sets, whereas chaos has meaning only for real numbers. Moreover, at present, the notion of cryptographic security and the performance of cryptographic algorithms have no counterpart in chaos theory [20]. In summary, we note that chaos-based encryption techniques are considered promising candidates for practical applications because these techniques provide an effective combination of speed, high security, complexity, reasonable computational overhead and computational power [1]. Chaotic maps have attracted the attention of cryptographers as a result of the following fundamental properties.(i)
Chaotic maps are deterministic, meaning that their behavior is predetermined by mathematical equations.(ii)
Chaotic maps are unpredictable and nonlinear because they are sensitive to initial conditions. Even a very slight change in the starting point can lead to a significantly different outcome.(iii)
Chaotic maps appear to be random and disorderly but, in fact, they are not; beneath the random behavior is an order and pattern.Chaotic phenomena are analogous to stochastic processes in that they appear in nonlinear dynamical systems; such processes are nonperiodic and nonconvergent and are extremely sensitive to initial conditions [20].In cryptography, we focus on dynamicdiscrete-timesystem. A dynamic system is chaotic if all trajectories are bounded and nearby trajectories diverge exponentially at every point of the phase space. A chaotic system is given by an iterated function (chaotic map) f of a state space X. The iterated function transforms the current stage of the system into the next one, that is,
(1)xn+1=f(xn),
where  xn∈X denotes the system state at the discrete time. In chaos-based cryptography, the state space is typically a finite binary space(2)X=P=C={0,1}n,n=1,2,…,
where P = Plaintext and C = Ciphertext.The initial condition is a vectorx0∈X, and it is assigned to an internal state variable before the first iteration. The vector c∈K={0,1}n contains the parameters of the dynamic system. The parameters are kept constant through all cycles (iterations) [21].In this work, we are concerned with image encoding with the generation and use of 1D-chaotic maps. A one-dimensional dynamical system is a couple(I,ϕ), where I is real interval and ϕ is a transformation from I to I.Chaotic maps are nonlinear maps presenting the property of sensitivity to initial conditions.The nonlinear transformation used here is defined as an iterative scalar map [22](3)xn+1=F(xn,α),xn=0=x0,
where α is a set of real parameters. The use of (3) for image encoding means that the image is seen as a dynamical system; the main difference is that images are presented by integer values, while they are mapped into real values under system in (3).One of the most known chaotic maps is the logistic map. It is defined by the following equation:(4)xn+1=αxn(1-xn),xn=0=x0.
The use of chaos for image encoding yields to three types of keys; these keys may be used together or separately, in order to enhance the privacy. They are the external or (control) parameter α, the initial state x0,  and the number of iterations [21]. The number of iterations is fixed during all the cycles and equal to the size of the important part of the image, which should be encrypted. In this paper, one two or three external encryption keys are used, then three types of approaches are performed as following: first using one external encryption key: in this type, the chaotic map will generate a threshold vector of two values: 0 and 1. The pixels of the image vector that are corresponding to the zeros of the threshold vector will be encrypted by one external encryption key and the other pixels will be normalized in such a way to hide the details of the image vector. Second, using two external encryption keys: in order to increase the security, the second type uses two external encryption keys such that the chaotic map will also generate a threshold vector of two values: 0 and 1, and the pixels of the image vector that are corresponding to the zeros of the threshold vector will be encrypted by the first key, and other pixels that are corresponding to the ones will be encrypted by the second key. Third, using three external encryption keys: in order to increase the security further, the third type uses three external encryption keys. In this case the chaotic map will generate a threshold vector of three different values: 0, 0.5, and 1. The pixels of the image vector that are corresponding to the zeros will be encrypted using the first key; the pixels that are corresponding to 0.5 values will be encrypted by the second key, and finally the pixels that are corresponding to the ones will be encrypted by the third key. The encryption process is done for one-level decomposition and two-level decomposition; also it is repeated for two different sizes of external keys. The previous schemes will be applied for chaotic maps given in (4). The decryption process is the reverse operation to each process in the encryption procedure as shown in Figure 1(b).


## 5. Experimental Results

In this work, a 2D grayscale image is divided into subbands and subsampled using a discrete wavelet transform. The test images and their sizes can be shown in Table1. Each coefficient represents a spatial area of approximately 2×2 pixels from the original image. The total number of components remaining after the vertical and horizontal decompositions is four. These components are referred to as subbands. As shown in Figure 3, the most important component of these subbands is the LL component because it is much more similar to the original image; LL is called the approximate image. To provide security for this component, the second step is to encrypt this component using a chaos-based image-encryption algorithm, as described above. The algorithm described previously will be implemented for one 2D-gray scale image and one 2D-color image, each of them has size of (128×128) pixels. The test images and their sizes can be shown in Table 1.Table 1
Test images.
#ImagesNames1SF.GIF2ROAR512.JPG3GREEN ROSE.JPG4GOLDRUSH.JPGTest image 1 (Lena.PGM) whenx(1)=0.12345, α=4, key1 = 1234567890223344, and key2 = 0987654321001122, Thr = 30, PSNR = 28.1240.
(a)
Original image(b)
One-level decomposition(c)
Coded image(d)
Reconstructed imageThe correlation coefficients between the original image and the encrypted image for all the three cases of encryption which are explained previously, are illustrated in Tables2 and 3. The results obtained for one-level and two-level decomposition. Note that the initial state for which the encrypted images is computed is x0=0.65440 and the number of iterations is fixed during all cycles equal to the size of the important part of the image, which should be encrypted. The chaotic map parameters are the initial values which are also used to select the external encryption keys (see Section 4). In this paper, the parameters are set as follows: the parameter α=4, one, two, or three external encryption keys. Here, our aim is to compare the output images for different values of parameters (we have considered six cases). They are: small keys sizes (key1 = 4567, key2 = 3336, and key3 = 5892) and large keys sizes (key1 = 4567332, key2 = 3336877, and key3 = 5892117).Table 2
Results of encryption of different amount for grayscale SF.GIF and ROAR512.JPG images using small and large keys sizes.
ImageKey sizeAmount %One keyTwo keysThree keysCipher-image correlationReconstructed-image correlationCipher-image correlationReconstructed-image correlationCipher-image correlationReconstructed image correlation1SmallL1 = 250.074623370.999992860.030052240.999992870.005131920.99999287L2 = 6.250.141514260.999997840.136723530.999997840.04338320.999997841LargeL1 = 250.011977780.999992860.006455480.999992870.004955620.99999287L2=6.250.074380780.999997840.024576480.999997840.006542080.999997842SmallL1 = 250.130407710.999998350.058087170.999998360.040309190.99999836L2 = 6.250.243793690.999999490.156406780.999999490.070572240.999999492LargeL1 = 250.011425040.999998350.006680930.999998360.001211700.99999836L2 = 6.250.104559030.999994910.079159130.999994920.021478760.99999492Table 3
Results of encryption of different amount for color GREEN ROSE.JPG and GOLDRUSH.JPG images using different keys.
ImageKey sizeAmount %One keyTwo keysThree keysCipher-image correlationReconstructed-image correlationCipher-image correlationReconstructed-image correlationCipher-image correlationReconstructed-image correlation3SmallL1 = 250.066363010.999999960.049916510.999998970.047776460.99999897L2 = 6.250.132007880.999999980.084739950.999999670.070235660.999999673LargeL1 = 250.029389940.999999960.005190530.999998970.004180590.99999897L2 = 6.250.032155050.999999980.029811040.999999670.019967340.999999674SmallL1 = 250.032937070.999999950.026554460.999998330.009987680.99999833L2 = 6.250.060945920.999999980.031808330.999994700.013292040.999999474LargeL1 = 250.005258270.999999950.004943680.999998330.002180120.99999833L2 = 6.250.024472150.999999980.013294120.999994700.009795850.99999470These results are obtained by applying chaotic partial encryption to the image after the wavelet transform operation is performed. Table2 shows the results for the two grayscale images, while Table 3 shows the results for the two color images for small key size and large key size. Figures 4, 5, and 6 show the results for SF.GIF grayscale image in one, two, and three external encryption keys, respectively.Results of application of chaotic algorithm to SF.GIF. (a) and (d) original image. (b) and (e) Image resulting from encryption with L1 or L2, respectively, using only one external encryption key in the larger size. (c) and (f) Reconstructed image in each case.
(a)(b)(c)(d)(e)(f)Results of application of chaotic algorithm to SF.GIF. (a) and (d) original image. (b) Image resulting from encryption with L1 or L2, respectively, using two external encryption keys in the larger size. (c) and (f) Reconstructed image in each case.
(a)(b)(c)(d)(e)(f)Results of application of chaotic algorithm to SF.GIF. (a) and (d) original image. (b) image resulting from encryption with L1 or L2, respectively, using three external encryption keys in the larger size. (c) and (f) reconstructed image in each case.
(a)(b)(c)(d)(e)(f)A good encryption procedure should be robust against all kinds of cryptanalytic, statistical, and brute-force attacks. In this section, we discuss the security analysis of our method.From the results, we can confirm that our cipher is excellent, and this is clear from the below analysis to the results of our experiments.For a secure image cryptosystem, the encryption key plays a very important role against the brute force attack; so for high security, the key space should be large enough to make the brute force attack infeasible but may decrease encryption/decryption speed. In this algorithm, we used a key space of 94 bit combination, then we increased the key space up to 97 bit combination and compared the results (Tables2 and 3). Out of this comparison, we found that the correlation between the cipher image and the original image decreased when we increased the key space size. Moreover using more than one external encryption keys which is a perfect way to conclude that increasing the number of keys means increasing the security because this makes the intruder suffers when trying to attack the cipher image and find the secret keys. In addition to the external encryption keys, we should mention that our algorithm depends also on the parameters of logistic map, which is sensitive to the initial condition that can be connected with confusion and diffusion property in good cipher.We have performed statistical analysis by calculating the histograms and correlations of cipher and reconstructed image with the original one. The correlation between the original image and the cipher image is nearly equal to zero expressing the original image and cipher image being almost independence. The correlation between the original image and the reconstructed image is nearly equal to one that means a perfect reconstruction at the receiver and the encryption algorithm works in a very good manner to protect the image. Out of the results of our experiments, one can see that as the amount of the encrypted part is decreased (from L1 = 25% to L2 = 6.25%), the execution time is decreased too (about 0.218 sec for one external encryption key, 0.453 sec for two external encryption keys, and 0.5 sec for three external encryption keys), which indicates a high speed in performing encryption and decryption process and in getting the results, but also we should mention that decreasing the amount of encrypted part makes the correlation between the cipher image and the original image increase. All the proposed algorithms were programmed in MATLAB version 7.0. Performance was measured on a 2.0 GHz. Pentium IV with 1 GB of RAM running Windows XP Professional.


## 6. Conclusion

In this paper, we have proposed a method for the selective encryption of an image combined with a compression method. The technique used here results in a significant reduction in encryption and decryption time. This method consists of three steps; in each step, we used selected properties that served the goal of this paper, which were to obtain an effective cipher and high-quality image compression to achieve both security against unauthorized access during data transmission through an unsecured channel and high compression to allow for a low transmission rate. For the encryption, we used an efficient algorithm based on a chaotic map to encrypt the low subband of the image; this algorithm has very good diffusion and confusion properties, and we obtained a very good cipher of the subband, as evidenced by the low correlation between the original image and the coded image. For the compression, we used the wavelet transformation, and the results were highly satisfactory; this method allowed us to achieve a perfect reconstruction with a good PSNR. The basic idea of this work is to show the influence of using multiple keys in increasing security by increasing the number of external encryption keys in each time such that the important part of the image is encrypted with one, two, or three external encryption keys; the encryption is done by a new 1D chaotic map. We show from the results that the correlation coefficients between the original image and the encrypted image are decreased when the number of external encryption keys is increased, and this increases the security. Also, we show how the correlation coefficient changed exponentially when using different values of the control parameter in each time. In future work, we can use more than 128 bits for the external keys to increase overall security, and we can use another method for compression.



---

*Source: 179693-2012-03-25.xml*