# Image Encryption Based On Chaotic Systems Computer Science Essay

**Published:** **Last Edited:**

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

In recent years, many scholars prefer shuffling the positions in the spatial domain and perform the mixing operation using independent keystreams in iterative stages. Indeed, spatial domain encryption has drawback that it keeps the statistical characteristics of image intact after encryption. Moreover, the independent keystream used in mixing operation lead to the weakness againest differntial attacks. To fix this loophole, an extended sequence using chaotic map and Bernstein form Bézier curve to improve the chaotic key sequenes is presented in this paper. Based on this sequences, we perform the confusion in DCT domain scrambling with variable control parameters. To further enforce the security, the diffusion operation is done to diffuse the gray values of image pixles using keystream extracted from the extended key sequence of the chaotic map and the plainimage. As a result, the algorithm resists the chosen-plaintext/chosen-ciphertext/known-plaintext attacks, as diffusion depends on plainimage. Moreover, the experimental results and analysis confirm high security level of the proposed scheme.

## 1. Introduction

Image encryption, is the process of realign the original image into a new image that is non-recognizable in appearance, disorderly, and unsystematic [1], is urgently needed but it is a challenging task- it is quit different from text encryption due to some intrinsic properties of images such as high redundancy and bulky data capacity, which are generally diffuclt to handle by using traditional techniques. In recent years, chaos theory has received ever increasing research interests from cryptographers. This is because of the fact that chaotic systems have many important cryptographically desirable features, such as high sensitivity to initial conditions/parameters, long periodicity, high randomness and mixing [2-5]. Moreover, chaotic maps are easy to be implemented by microprocessors and personal computers. Therefore, chaotic cryptosystems generally are expected to have high speed with low cost, which makes them better candidates than many traditional ciphers for multimedia data encryption.

Till now, a number of chaos-based cryptographic schemes have been proposed. The major core of these encryption systems consists of one or several chaotic maps serving the purpose of either just scrambling the image [9,10] or shuffling the image in the saptial domain and subsequently masking the resulting shuffled image [11-18]. It is noted , however, that many of these schemes encrypt the image in spatial domain. Indeed, spatial domain encryption has drawback that it keeps the statistical characteristics (like gray level distribution, correlation, entropies etc.) of image intact after encryption. So, it is not secure to perform the encryption in spatial domain as the attacker can utilize the characteristics of encrypted image to recover the plainimage. Additionaly, in diffusion operation, the pixels gray values are masked to enhance the statistical characteristics of image. If the keystream used in mixing operation is determined only by the key and independent of plainimage as in [11, 12, 14], then such algorithms cannot resist the chosen-plaintext (CP) and known-plaintext (KP) attacks [19].

Catering to these problems, we introduce an efficient image encryption algorithm based on chaotic systems in DCT domain scrambling. First, an extended sequence using chaotic map and Bernstein form Bézier curve to improve the chaotic key sequenes is presented. a pixel-chaotic-scramble is performed in DCT domain to withstand the security threats of spatial domain scrambling. Two chaotic maps are used to perform the scrambling effect: chaotic cat map is utilized to scramle the DCT coefficients, while the control parametrs are randomly generated using chaotic logistic map. To further enforce the security, the diffusion operation is done to diffuse the gray values of image pixels using keystream extracted from the chaotic map and the plainimage.

Rest of the paper is organised as follows: Section 2 present the basic theory of the encryption scheme. The proposed image encryption scheme is introduced in Section 3. Section 4 is devoted to the analysis and discussion. Finaly, the conclusion is drawen in Section 5.

## 2. Preliminary of the proposed algorithm

In this section, we will introduce some preliminary behind the proposed algorithm.

## 2.1 Bézier curve

A Bézier curve is a 2D or 3D parametric curve of degree n defined on n+1 points P0, …, Pn whose points x(t) are defined by [13]

(1)

where , , and i=0 ,… , n

The pi are called control points; the are Bernstein polynomials, which are given by:

(2)

The main properties of Bézier curve are illustrated as follows [13]:

Affine invariance: Bézier curve is invariant under affine maps.

Convex hull property For, Bézier curve lies in the convex hull of the control polygon.

Endpoint interpolation Bézier curve passes through P0 and Pn.

Symmetry Bézier curve defined by control polygon is the same as the curve defined by control polygon, they only differ in the direction in which they are traversed.

## 2.2 Chaotic maps

A chaotic map is a dynamic system that can be easily denoted by mathematical equations [14]. Generally, for a chaotic map, the initial value acts as its input, the control parameters determine its action, and the output is the sequence produced by the iterated maps, as shown in Fig. 1. It has some typical properties suitable for data encryption. Given the initial value, the chaotic map generates the sequence with random properties. The sequence is sensitive to the initial value, that is, two initial values with a slight difference will cause great differences after multiple iterations. Additionally, the sequence is very sensitive to the control parameters, that is, different parameters produce different sequences as shown in Fig. 1, and a chaotic map is similar to a cipher. The initial value of the chaotic map is regarded as the plainimage, the control parameters as the key and the output sequence as the cipherimage.

Fig. 1: General architecture of a chaotic map

## 2.2.1 Chaotic cat map

The cat map is a 2D map that maps the unit square onto itself in a one-to-one manner. It is defined by the following matrix equation [7]:

(3)

where u and v are positive integers. and are the i -th and the i+1-th states, respectively.

## 2.2.2 Chaotic Logistic (quadratic) map

The Logistic (quadratic) is one of the simplest nonlinear chaotic discrete systems that exhibit chaotic behavior and is defined by the following equation [8]:

(4)

where x0 is initial condition, λ is the system parameter and n is the number of iterations. The research shows that the map is chaotic for 3.57 < λ < 4 and for all n.

## 2.3 Extended Chaotic Sequence by Bézier curve

Assume that , are known chaotic sequences, and suppose the sequences have the same dimension D and is a chaotic sequence with one or D dimension. Then, we can get an extended chaotic sequence as follows:

(5)

when is one dimension or

(6)

when is D dimensions.

For example, we can show an extended chaotic sequence of the chaotic logistic map (Eq. 4) using formula (5) for D=1.

## 2.3 The 2-D Discrete Cosine Transform and its inverse

Let, for and, denote an image. The 2-D, Discrete Cosine Transform (DCT) of f, denoted by, is formulated as [15]

(7)

For and , where

The 2-D Inverse Discrete Cosine Transform (IDCT) is computed in a similar fashion. The 2D IDCT of is formulated as

(8)

## 3. The proposed image encryption method

Here, we propose an efficient image encryption scheme for secure digital images. The scheme is shuffle the pixels of plainimage in frequency domain using the chaotic cat map with variable control parameters to withstand the security threats of spatial domain shuffling. To further enforce the security, the diffusion operation is done using keystream extracted from the chaotic map and the plainimage. The encryption process is performed according to two main procedures descried as follows:

## 1: Pixel-chaotic-shuffle in DCT domain with variable control parameters

Step 1: Evaluate the DCT of the plainimage.

Step 2: Generate the control parameters u and v of the chaotic cat map for permutation according to the following Eq.

(9)

where x(K) is the state of the extended chaotic logistic map after K iterations

Step 2: Relocate the resulting image using chaotic cat map with variable control parameters defined by Eq. (3).

Step 3: Take inverse DCT to get final scrambled image.

## 2: Diffusion method of the shuffled image with keystream dependent

Step 1: Let be the final scrambled/shuffled image obtained.

Step 2: Arrange the pixels of scrambled image from left to right and then top to bottom, we get sequence.

Step 3: Perform the diffusion operation as illustrated below:

Repeat ii to iv for k=1 to .

Iterate Eq. (4) for N0 times to get rid of the transient effect, where N0 is a constant.

Evaluate modified keyusing the values of the currently operated pixel and the modified current state of chaotic map based Bernstein function as:

(10)

(11)

(12)

where and G is the number of possible gray levels in image pixels. For example, L is 8 if the plainimage is a 256 gray-scale image. is the control parameter

Calculate pixel gray value of cipherimage as

## [

(13)

Step 4: Arrange the sequence of encrypted pixels into a 2D cipherimage.

The decryption process is similar to encryption, except that the scrambling and the diffusion stages are performed in reversed order. This means that the cipherimage is first operated by the inverse diffusion process to remove the diffusion effect. Then the pixels are relocated in a manner just opposite to that performed in encryption. This reverse pixel relocation process is guaranteed as the chaotic cat map is invertible as shown:

(14)

If multiple permutation and overall rounds are done in encryption, the same number of rounds should be performed in decryption. With the correct key, the final reconstructed image is exactly the same as the original plainimage, without any distortion.

## 4. Experimental Results and Analysis

The proposed encryption algorithm is applied to various plainmages like Lena, Baboon, Peppers, Cameraman, Barbara, Boat and Airplane of 256-256 size. Among them, the plainimages of Lena, Cameraman, Elaine, Boat and their respective histograms are shown in Fig. 2. As can be seen in this Figure, the gray value distributions of plainimages are not uniform. The initial conditions and system parameters taken for experimentation are:. The results of shuffling scheme are shown in Fig. 3.

The cipherimages of Lena, Cameraman, Elaine, and Boat using proposed encryption algorithm and their histograms are shown in Fig. 4 respectively. It is clear from the Fig. 4 that the ciphered images are very much indistinguishable and appears like a noise. Moreover, as seen in Fig. 4 that the distribution of gray values of the cipherimages is fairly uniform and much different from the histograms of the plain-images shown in Fig. 2.

Fig. 2. Plainimages of Lena, Cameraman, Elaine, Boat and their histograms

Fig. 3. Scrambled/shuffled images of Lena, Cameraman, Elaine, and Boat

Fig. 4. Ciphered images of Lena, Cameraman, Elaine, and Boat using proposed scheme and their histograms

## 4.1. Key space analysis

The key space is the total number of different keys that can be used in the encryption. For a secure image encryption, the key space should be large enough to make brute force attacks infeasible [2-4]. In the proposed algorithm, secret key consists of,,,,. And all the variables are declared as Matlab type long which is scaled fixed point format with 15 digits precision for double. After considering the permitted range of all initial conditions and parameters involved, the key space comes out to be 256254 (4-3.9) (1014)8 K+2 N0 ≈ 1.3 10120. Thus, the key space of the proposed algorithm is extensively large enough to resist the exhaustive brute-force attack.

## 4.2. Key sensitivity

An efficient encryption algorithm should be sensitive to secret key i.e. a small change in secret key during decryption process results into a completely different decrypted image [4]. In proposed algorithm, an incremental change in key; even of the order of (=) 10-10, results into completely unrecognizable decrypted image. The cipherimages shown in Fig. 5 is decrypted using , , , separately, the resultant decrypted images shown in Fig. 5 are unrecognizable and noise like. Hence, it can be said that the proposed algorithm has high sensitivity to secret key.

Figure 5: Key sensitivity: decrypted images with correct key,,, , and

## 4.3. Correlation Coefficient Analysis

In most of the plainimages, there exists high correlation among adjacent pixels. It is mainstream task of an efficient image encryption algorithm to eliminate the correlation of pixels [2-5]. Two highly uncorrelated sequences have approximately zero correlation coefficient. The correlation coefficient between two adjacent pixels in an image is determined as:

(15)

where E(x) =mean (xi) and x, y are gray values of two adjacent pixels in the image. In the proposed algorithm, the correlation coefficient of 1000 randomly selected pairs of vertically, horizontally and diagonally adjacent pixels is determined.

The average of several correlation coefficients in plainimages and cipherimages in three directions are listed in Table 1 and Table 2, respectively. The values of correlation coefficients show that the two adjacent pixels in the plainimages are highly correlated to each other, whereas the values obtained for cipherimages are close to 0, or may be negligible correlation between the two adjacent pixels in it. This shows that the proposed algorithm highly de-correlate the adjacent pixels in cipherimages.

Table 1: Correlation coefficient of two adjacent pixels in plainimages

## Test images

Vertical

Horizontal

Diagonal

Lena

0.9492

0.9691

0.9288

Pepper

0.9788

0.9830

0.9592

Cameraman

0.9342

0.9629

0.9222

Elaine

0.9652

0.9724

0.9384

Boat

0.9076

0.9405

0.8658

Airplane

0.9763

0.9715

0.9505

Table 2: Correlation coefficient of two adjacent pixels in cipherimages

## Test images

Vertical

Horizontal

Diagonal

Lena

0.00051

0.00129

0.00102

Pepper

0.00010

0.00048

0.00014

Cameraman

0.00109

0.00042

0.00140

Elaine

0.00057

0.00194

0.00118

Boat

0.00026

0.00027

0.00103

Airplane

0.00318

0.00090

0.00262

## 4.4. Information Entropy Analysis

Information theory is the mathematical theory of data communication and storage founded in 1949 by C.E. Shannon [16]. Modern information theory is concerned with error- correction, data compression, cryptography, communications systems, and related topics. To calculate the entropy H (m) of a source m, we have:

(16)

Where p (mi) represents the probability of symbol mi and the entropy is expressed in bits. Let us suppose that the source emits 28 symbols with equal probability, i.e., after evaluating Eq. (16), we obtain its entropy H (m) = 8, corresponding to a truly random source. Actually, given that a practical information source seldom generates random messages, in general its entropy value is smaller than the ideal one. However, when the messages are encrypted, their entropy should ideally be 8. If the output of such a cipher emits symbols with entropy less than 8, there exists certain degree of predictability, which threatens its security.

The values of entropies obtained for plainimages and cipherimages are given in Table 3. The entropy values for cipherimages are very close to the ideal value 8. This implies that the information leakage in the proposed encryption process is negligible and the encryption algorithm is secure against the entropy based attack.

Table 3: The entropy analysis of plainimages and cipherimages

## Test images

Plainimage

Cipherimage

Lena

7.4433

7.9975

Cameraman

7.0097

7.9977

Elaine

7.4841

7.9974

Boat

7.1640

7.9976

Airplane

6.7794

7.9973

Pepper

7.5842

7.9973

## 4.5. Resistance to KPA/CPA/CCA attacks

In the proposed algorithm, the control parameters of permutation are randomly generated from key of map (4). A tiny different key results in distinct control parameters and non-identical permuted images. Moreover, the keystream used in diffusion operation is extracted from key of map (4) and (5) and it also depends on plainimage. Different keystreams are generated in diffusion operation when different plainimages are encrypted using proposed algorithm. Therefore, the known-plaintext (KP), chosen-plaintext (CP) and chosen-ciphertext (CC) attacks are not applicable in case of proposed encryption algorithm. Hence, the proposed algorithm can resist the KPA/CPA/CCA attacks.

## 5. Conclusion

Efficient algorithm for encryption and decryption of images is presented in this paper. The algorithm is based on the concept of shuffling the pixel's positions and changing the gray values of the image pixels. To perform the shuffling of the plainimage's pixels, a scrambled scheme with variable control parameters through 2D Cat transform is suggested in DCT transform domain. The control parameters of scrambling are randomly generated using a 1D Logistic map to enforce the secrecy of the images. The diffusion operation of the scrambled image is done using extended chaotic sequence generated through 1D Logistic and Bernstein function. All the simulation and experimental analysis show that the proposed image encryption system has very large key space, high sensitivity to secret keys, better diffusion of information in the ciphered images and low correlation coefficients. Hence, the proposed image encryption algorithm has high level of security with less computation and is more robust towards cryptanalysis.

## ACKNOWLEDGMENT

This work is supported by the National Natural Science Foundation of China (Project Number: 60703011, 60832010, 60671064), the Chinese national 863 Program (Project Number: 2007AA01Z458), The Research Fund for the Doctoral Program of Higher Education (RFDP: 20070213047) and the Fundamental Research Funds for the Central Universities (Grant No.HIT.NSRIF.2009050).