You are on page 1of 35

A HYBRID GENETIC ALGORITHM AND

CHAOTIC FUNCTION MODEL FOR IMAGE

ENCRYPTION

SADIQUE NAYEEM, M.Tech. Pondicherry University

Introduction
2

A new method based on a hybrid model is proposed for image encryption which is composed of a genetic algorithm and a chaotic function. In the first stage, a number of encrypted images are constructed using the original image and the chaotic function. In the next stage, these encrypted images are used as the initial population for the genetic algorithm. In each stage of the genetic algorithm, the answer obtained from the previous iteration is optimized to produce the best-encrypted image ( with the highest entropy and the lowest correlation coefficient among adjacent pixels).

Terminology
3

Genetic algorithm Entropy of an image Histogram of an image Chaotic function Correlation coefficient among adjacent pixels

Genetic algorithms
4

Genetic algorithms which mimic principle of evolution in nature, search for final solutions among a population of potential solutions. The best solutions are chosen in each generation. These solutions, after mating, produce a new set of offspring. At the beginning, the initial population is randomly formed, and the fitness function evaluates every population. Optimum result is not met, new generations are produced through the process of recombination and mutation. The more suitable generations are selected to produce new generations until the optimum result is obtained.

Entropy of an image
5

Entropy is a statistical measure of randomness that can be used to characterize the texture of the input image. It is one of the prominent features in randomization and can be calculated as:

where N is the number of gray levels used in the image (for gray level images, N is 8), and P(Si) shows the probability of having a ith gray level in the image.

Matlab Code: E = entropy(I)

In images that are produced completely randomly, N will be 8, and this N is considered as an ideal value.

Histogram of an image.
6

The histogram of an image refers to the frequency of any gray level in it. This feature is one of the most important statistical features of an image.

Chaotic function
7

Chaotic functions are similar to noise signals, but they are completely certain; that is, if we have the primary quantities and the drawn function, the exact signal can be reproduced. Logistic Map Signal Advantages:

Sensitivity to primary conditions Apparently accidental feature Deterministic work

r =3.999 (Completely Chaotic)

Correlation coefficient among adjacent pixels


8

The correlation coefficient matrix represents the normalized measure of the strength of linear relationship between variables. The variable can be the two adjacent pixel. Correlation coefficient is given by:

The correlation coefficients range from -1 to 1, where Values close to 1 suggest that there is a positive linear relationship between the data columns. Values close to -1 suggest that one column of data has a negative linear relationship to another column of data. Values close to or equal to 0 suggest there is no linear relationship between the data columns.

THE PROPOSED METHOD


FORMATION OF THE INITIAL POPULATION
GENETIC OPTIMIZATION

Formation of the initial population


10

To form the initial population from the plain-image, first the plainimage is divided into four equal parts. The chaotic function logistic map is employed to separately encrypt all of the pixels present in each of these four parts as follows: 1. Five pixels are selected as the encryption key for forming the initial value of the logical map function and for encrypting that part of the image.

Formation of the initial population


cont..
11

2. The initial value of the chaotic function logistic map is determined by taking five pixels as under: P = [P1, P2, P3, P4, P5] (gray scale). Convert P into an ASCII code: B = [P1,1, P1,2, P1,3, . . ., P5,7, P5,8]

The initial value of the logistic map function(U0k), which lies in the interval 01, is obtained.

3. For each part of the plain-image, step 2 is repeated. Therefore, in the end, there will be 4 different initial values for each image (one value for each part of the image).

Formation of the initial population


cont
12

4. For encrypting the pixels in each part of the image, the initial value of that part and Eq. is used as follows:
The symbol represents XOR. OldValue stands for the current value of the pixel.

NewValue shows the new value of the pixel after it is encrypted.


The value of Uik refers to the ith value of the chaotic function in the kth part of the original image, determined for each step using Eq.

All of the pixels in each part, except the five pixels used as the key, are sequentially (row-by-row) encrypted in this manner. To build the rest of the population, steps one through four are repeated.

First generation of the genetic population


13

Genetic optimization
14

Crossover:

After forming the initial population, the genetic algorithm is used to optimize the encrypted images. (a)&(b) are the input images. (c)&(d) are images after crossover.

Fitness function
15

The fitness function used is the correlation coefficient between pairs of adjacent pixels of the image. At each stage, the new generations are produced and the previous ones are evaluated using the fitness function. The generation is required to have the lowest correlation coefficient for the encrypted image to be as the final cipher-image.

Selection
16

50% of the population with the minimum correlation coefficient + 10% of the remaining population are selected for the next generations. Non-Elites are not selected. Therefore, 10% of the remaining population are chosen arbitrarily to help the selected elites from 90% to produce new generations. This process is repeated until the correlation coefficient of the best generation produced does not significantly change in two successive stages. After this stage, the generation that has the lowest correlation coefficient is encrypted as the final cipher-image.

Example
17

Plain-image parts.

Plain-image divided into four equal

Example
18

cont..

A matrix with dimensions 12 12 is used in which the numbers are in the interval [0, 7]. The first five pixels of the first row of each part are used in determining the initial value of the chaotic function logistic map. The first five pixels of the first part of the image are (3, 1, 7, 6, 2) P=[ 2, 6, 7, 1, 3 ]

Example
19

cont..

First generation

Second generation

Example
20

cont..

Third generation after crossover crossover.

Forth generation after

21

EXPERIMENTAL RESULTS
1. ANALYSIS OF THE ENTROPY OF THE IMAGE 2. HISTOGRAM ANALYSIS 3. ANALYSIS OF THE CORRELATION COEFFICIENT 4. ANALYSIS OF THE FITNESS FUNCTION 5. KEY ANALYSIS

Test conducted
22

Gray level images with dimensions of 256 256. The initial number of the population for GA = 128. The crossover operation rate = 90% Mutation operation rate = Zero.

1. ANALYSIS OF THE ENTROPY OF THE IMAGE


23

Entropy is a statistical measure of randomness of the pixels

2. HISTOGRAM ANALYSIS
24

Fig. 8. (a) Plain-image, (b) cipher-image, (c) histogram of plain-image, and (d) histogram of cipher-image.

2. HISTOGRAM ANALYSIS
CONT
25

Fig. 9. (a) Plain-image, (b) histogram of plain-image, histogram of image after, (c) 2nd iteration, (d) 25th iteration, and (e) 70th iteration.

3. ANALYSIS OF THE CORRELATION COEFFICIENT


26

In a good encryption algorithm, the correlation coefficient between pairs of encrypted adjacent pixels in the horizontal, vertical, and diagonal positions are as small as possible. To test the correlation coefficient between two adjacent vertical pixels, two adjacent horizontal pixels, and two adjacent diagonal pixels in a cipher-image, the following procedure was used: first, 2500 pairs of pixels were randomly selected. Then, the correlation coefficients were obtained using Eq.

3. ANALYSIS OF THE CORRELATION COEFFICIENT


27

Fig:(a) Correlation analysis of plain-image and (b) correlation analysis of cipherimage.

3. ANALYSIS OF THE CORRELATION COEFFICIENT


28

In another test, the results of the correlation coefficients of two adjacent pixels in the vertical, horizontal, and diagonal positions were investigated in each of the different iterations. The results obtained for the correlation coefficients in this method are far better than those of the methods of [22,24,25]

4. ANALYSIS OF THE FITNESS FUNCTION


29

Selection of the fitness function in genetic algorithms is one of the most important and most influential elements for achieving the desired result. Tests conducted showed that the correlation coefficient is a better optimizer than the function of the entropy of the image. As observed in this table, when the correlation coefficient is used as the fitness function, the degree of entropy and the correlation coefficient of the image are better than when entropy is used as the fitness function.

5. KEY ANALYSIS
30

For a good encryption algorithm, key must be long enough to resist brute-force attacks. A 40-bit key is suggested which produces a key space equivalent to 2^40.

Fig: (a) Plain-image, (b and c) encrypted images using user keys with 1-bit difference in each part, (d) the similarity between (b) and (c), (99.76% different.)

KEY ANALYSIS
31

CONT.

Fig: Percentage of difference between encrypted images versus iterations.

Decryption
32

The decryption of encrypted images is possible if the chaotic function logistic map and the numbers of the population (or the numbers of the two populations) from which the final image is composed are known.

Conclusions
33

A new method has been suggested for encrypting images with a chaotic function logistic map and a genetic algorithm. In this method, the chaotic function is employed for initial encryption, and the genetic algorithm is used to improve the encryption process of the image. The main innovation in this paper is that this is the first time genetic algorithms are used in this manner to encrypt images. The results obtained for the correlation coefficients and the entropies of the images proved the high efficiency of this method. This algorithm can be used in the future with a new crossover operator or with another fitness function to encrypt images.

My Idea for further enhancement


34

Use of RGB image Separate the Red, green and blue component. Use the chaotic function logistic map to encrypt the each component. Do the crossover among each component. Use Intensity Profile as the fitness function.

35

You might also like