Image Encryption Using Modified Particle Swarm Optimization

44 downloads 0 Views 559KB Size Report
cryptosystems to encrypt images directly, it is not a good idea for two reasons. One is that the image size is almost always much greater than that of text.
International Journal of Research in Computer and Communication Technology, Vol 3, Issue 2, February- 2014

ISSN (Online) 2278- 5841 ISSN (Print) 2320- 5156

Image Encryption Using Modified Particle Swarm Optimization 1

R.Sabarinath1, S.Jegadeesan2, Dr.K.Venkatalakshmi3

Dept. of ECE, Anand Institute of Higher technology, Chennai, Tamil Nadu, India, [email protected] 2

Dept. of ECE, VIT University, Chennai, Tamil Nadu, India, [email protected] 3 Dept. of ECE, UCET, Tindivanam, Tamil Nadu, India, [email protected]

Abstract-In this age of universal electronic connectivity, there is indeed no time at which security does not matter. Two trends have enough to make this work as vital need. First, the explosive growth in computer systems and their interconnections via networks has increased the dependence of either a country or an organization or an individual on the information stored and communicated using these systems. Second, the disciplines of cryptography and network security has matured, leading to the development of more and more methods of encryption to enforce network security. Encryption is used to securely transmit data in open networks. Each type of data has its own features; therefore different techniques should be used to protect confidential image data from unauthorized access. Most of the available encryption algorithms are mainly used for textual data and may not be suitable for data and may not be suitable for multimedia data such as images. Image encryption has seen many forms of upgrade by the introduction of new techniques. Many complicated algorithms have designed in the view to bring down the correlation, between the image pixels, which is the measure of encryption quality in case of image. Our work focuses in creating the new encryption system, which is a combination of simple encryption techniques, gray scale transformation technique followed by shuffling of pixel positions based on a key generated from modified PSO algorithm. The results showed that the correlation between image elements was significantly decreased by using the proposed technique, resulted in a lower correlation. Keywords: Encryption, Correlation, Optimization.

1.INTRODUCTION

The field of encryption is becoming very important in the present era in which information security is of utmost concern. Security is an important issue incommunication and storage of images, and encryption is one of the ways to ensure security. Image encryption has applications in internet communication,

www.ijrcct.org

multimedia systems, medical imaging, telemedicine, military communication, etc.[1],[2]. It is now common to transfer multimedia data via the Internet. With the coming era of electronic commerce, there an urgent need to solve the problem of ensuring information safety in today’s increasingly open network environment. The encrypting technologies of traditional cryptography are usually used to protect information security Images are different from text[5]. Although we may use the traditional cryptosystems to encrypt images directly, it is not a good idea for two reasons. One is that the image size is almost always much greater than that of text.Therefore, the traditional cryptosystemsneed much time to directly encrypt the image data. The other problem is that the decrypted text must be equal to the original text. However, this requirement is not necessary for image data. Due to the characteristic of human perception, a decrypted image containing small distortion is usually acceptable[3],[4]. In order to transmit secret images to other people, a variety of encryption schemes have been proposed. In our project we try to propose a two level encryption method to provide better security and better results.

2.MODIFIED OPTIMIZATION

PARTICLE

SWARM

Particle swarm optimization (PSO) is a population based stochastic optimization technique developed by Dr.EberhartandDr. Kennedy in 1995, inspired by social behavior of bird flocking or fish schooling. PSO shares many similarities with evolutionary computation techniques such as Genetic Algorithms (GA). The system is initialized with a population of random solutions and searches for optima by updating generations. However, unlike GA, PSO has no evolution operators such as crossover and mutation. In PSO, the potential solutions, called particles, fly through the problem space by following the current optimum particles. The detailed information will be given in following sections.

Page 241

International Journal of Research in Computer and Communication Technology, Vol 3, Issue 2, February- 2014

ISSN (Online) 2278- 5841 ISSN (Print) 2320- 5156

Compared to GA, the advantages of PSO are that PSO is easy to implement and there are few parameters to adjust. PSO has been successfully applied in many areas: function optimization, artificial neural network training, fuzzy system control, and other areas where GA can be applied.

the past five years there are several chaotic image encryption algorithms that have been proposed. These algorithms manipulate the pixels by scattering them according to some chaotic function[7],[8],[9]. In our we have used Arnold Transform in pre-encryption.

As stated before, PSO simulates the behaviors of bird flocking. Suppose the following scenario: a group of birds are randomly searching food in an area. There is only one piece of food in the area being searched. All the birds do not know where the food is. But they know how far the food is in each iteration. So what's the best strategy to find the food? The effective one is to follow the bird which is nearest to the food.

3.1 ARNOLD TRANSFORM In mathematics, Arnold's cat map is a chaotic map from the torus into itself, named after Vladimir Arnold, who demonstrated its effects in the 1960s using an image of a cat, hence the name. Thinking of the torus T2as the quotient space R2/Z2 Arnold's cat map is the transformation Γ : T2 ⟶ T2 given by the formula

PSO learned from the scenario and used it to solve the optimization problems. In PSO, each single solution is a "bird" in the search space. We call it "particle". All of particles have fitness values which are evaluated by the fitness function to be optimized, and have velocities which direct the flying of the particles. The particles fly through the problem space by following the current optimum particles[6]. PSO is initialized with a group of random particles (solutions) and then searches for optima by updating generations. In every iteration, each particle is updated by following two "best" values. The first one is the best solution (fitness) it has achieved so far. (The fitness value is also stored.) This value is called pbest. Another "best" value that is tracked by the particle swarm optimizer is the best value, obtained so far by any particle in the population. This best value is a global best and called gbest. When a particle takes part of the population as its topological neighbors, the best value is a local best and is called lbest.After finding the two best values, the particle updates its velocity and positions .In our work we have changed the velocity update. Velocity update is based on shuffling.

Γ : (x, y) ⟶ (2x + y, x + y) mod 1

Equivalently, in matrix notation, this is

Γ

I. II. III.

v[] is the particle velocity, present[] is the current particle (solution). pbest[] and gbest[] are defined as stated before. Particles' velocities on each dimension are clamped to a maximum velocity Vmax. If the sum of accelerations would cause the velocity on that dimension to exceed Vmax, which is a parameter specified by the user. Then the velocity on that dimension is limited to Vmax.

www.ijrcct.org

= 2 1 mod1= 1 0 1 1 1 1

x mod 1 y

(2)

3.1.1 PROPERTIES

Present[]=velocity_update(present).

Chaos encryption has been researched since the last decade. Several papers regarding this have been published, most of which discussed about application of chaos encryption in secure communication as well as in optical data. However, for

x y

That is, with a unit size equal to the width of the square image, the image is sheared one unit up, then one unit to the right, and all that lies outside that unit square is shifted back by the unit until it's within the square.

v[]=Velocity(each particle)

3 CHOATIC TRANSFORM

(1)

IV.

Γ is invertible because the matrix has determinant 1 and therefore its inverse has integer entries, Γ is area preserving, Γ has a unique hyperbolic fixed point (the vertices of the square). The linear transformation which defines the map is hyperbolic: its eigenvalues are irrational numbers, one greater and the other smaller than 1 (in absolute value), so they are associated respectively to an expanding and a contracting Eigen space which are also the stable and unstable manifolds. The Eigen space is orthogonal because the matrix is symmetric. Since the eigenvectors have rationally independent components both the Eigen spaces densely cover the torus. Arnold's cat map is a particularly well-known example of a hyperbolic toralautomorphism, which is an automorphism of a torus given by a square unimodular matrix having no eigenvalues of absolute value 1. The set of the points with a periodic orbit is dense on the torus. Actually a point is preperiodic if and only if its coordinates are rational.

Page 242

International Journal of Research in Computer and Communication Technology, Vol 3, Issue 2, February- 2014

V. VI.

VII.

Γ is topologically transitive (i.e. there is a point whose orbit is dense, this happens for example for any points on the expanding Eigen space) The number of points with period n is exactly |λ1n + λ2n−2| (where λ1 and λ2 are the eigenvalues of the matrix). For example, the first few terms of this series are 1, 5, 16, 45, 121, 320, 841, 2205 .... (The same equation holds for any unimodular hyperbolic total automorphism if the eigenvalues are replaced.) Γ is ergodic and mixing.

4 BLOCK DIAGRAM Figure-1:

5.THE PROPOSED TECHNIQUE Before doing encryption original image is pre-encrypted. Preencryption involves two steps. The first step is to apply the chaotic transform to the original image. In the second step each pixel in the transformed image is converted into an equivalent 8 bit binary value. This binary value is shuffled based on the predefined keyvalue[11].

Figure-2: Pixel Level Encryption

ISSN (Online) 2278- 5841 ISSN (Print) 2320- 5156

This shuffled binary value is converted back to an equivalent decimal value and it is placed in the corresponding pixel positions. For image encryption, the effectiveness of cipher largely depends on the quality of ‘key’. If the quality of the key is not up to the level then it is not possible to provide the high level security. In transposition cipher quality of encryption depends on the pattern of rearrangement. If we want to rearrange the pixel values in a block containing ‘n’ pixels then we have to use the key value of length ‘n’. If the size of the block is 3×3, there are 9 pixels and 9! times the arrangement of pixels in a block is possible. First we divide the image into 3×3 blocks and each possible arrangement is called as a particle. Among the 9! Particles we have to look for the best particle. This selection is done by particle swarm optimization algorithm. For our encryption, we look for the best particle that will heavily affect the correlation between the neighboring pixels. The size of the particle is 9. Each element in a particle is an integer indicating the new pixel position in the block of size 9.key is generated from modified PSO algorithm. A trial solution (particle) is represented as a string of 9 integers in a random arrangement from 9! possible options. Each integer in the particle exists between 1 and 16. The k-th integer from the left of the particle is the new position assigned to the pixel k, within that particle string. The fitness function of the particle is calculated on the basis of the sum of total variation (length of displacement) of each element in a particle. The objective is to maximize the fitness value so that when the particle is applied to shuffle the image pixels, the correlations among the pixels become the least. The algorithm that we have applied is described below. 1. Choose initial population of 10 particles among 9! options randomly. 2. Fitness value of each particle is calculated based on the fitness function. 3. Now each and every particle is given a new position by updating velocity of each particle. 4. For each iteration the particle which is having the maximum fitness value is called as Pbest(particle best). 5. The particle which is having the maximum fitness value after all the iterations is called Gbest(global best). 6. In each iteration velocity of each particle is updated. 7.After all the iterations Gbest particle is selected which is used as the key for our encryption. The generated key is used to shuffle the pixel positions in each block of the pre-encrypted image.

6.PERFORMANCE ANALYSIS www.ijrcct.org

Page 243

ISSN (Online) 2278- 5841 ISSN (Print) 2320- 5156

International Journal of Research in Computer and Communication Technology, Vol 3, Issue 2, February- 2014

We have taken the gray scale image of size 256×256 pixels. Statistical test includes the comparative performance analysis on the basis of correlation coefficient .

6.1 CORRELATION COEFFICIENT A coefficient of correlation is a mathematical measure of how much one number can be expected to be influenced by changes in another. Correlation coefficient of 1 means that the two numbers are perfectly correlated, whereas -1 means that the numbers are inversely correlated and 0 means that the numbers are not related. Here correlation is calculated using the formula is given below.

(3)

r = ∑( ) − ∑ ∑ √[ n∑(x2) – (∑ )2 ][n∑(y)2 – ( ∑ )2]

where r : correlation value n : The number of pairs of data ∑ : Sum of the products of paired data ∑ : sum of x data ∑ : sum of y data ∑ 2: sum of squared x data ∑ 2:sum of squared y data

Correlation between vertical and horizontally adjacent pixel is calculated between original and encrypted image is shown below.

Table-1: Correlation Coefficient Image Original image Encrypted image

Correlation coefficient Horizontal Vertical Average 0.941 0.965 0.9350 0.0007

0.0083

0.0045

6.2 DIFFERENCE BETWEEN ORIGINAL IMAGE AND ENCRYPTED IMAGE

Common measures like NPCR (Number of Pixels Change Rate) and UACI (Unified Average Changing Intensity) are used to test the difference between the original image P and the encrypted one C. NPCR stands for the number of pixel change rate. Then, if D is a matrix with the same size as images P and C, D (i, j) is determined as follows:

www.ijrcct.org

(, )=

1, 0,

if P(i, j) ≠ C(i, j) else

(4)

NPCR is defined by the following formula:

=





(, )

×

× 100

(5)

whereM and N are the width and height of P1 and C1.

The UACI measures the normalized mean difference rate between the plain image and the permuted one. UACI is defined by the following formula:

=

×





|

(. )

( , )|

× 100 (6)

Table-2: NCPR, UACI VALUE NPCR% UACI%

99.6414 30.5848

6.3 HISTOGRAM ANALYSIS

In statistics, a histogram is a graphical representation of the distribution of data. It is an estimate of the probability distribution of a continuous variable and was first introduced by Karl Pearson A histogram consists of tabular frequencies, shown as adjacent rectangles, erected over discrete intervals (bins), with an area equal to the frequency of the observations in the interval. The height of a rectangle is also equal to the relative frequencies. It then shows the proportion of cases that fall into each of several categories, with the total area equaling 1. The categories are usually specified as consecutive, nonoverlapping intervals of a variable. The categories (intervals) must be adjacent, and often are chosen to be of the same size. The rectangles of a histogram are drawn so that they touch each other to indicate that the original variable is continuous frequency density of the interval, i.e., the frequency divided by the width of the interval. The total area of the histogram is equal to the number of data. Histograms are used to plot density of data, and often for density estimation: estimating the probability density function of the underlying variable. The total area of a histogram used for probability density is alwaysnormalized to 1. If the length of the intervals on the x-axis are all, then ahistogram is identical to a relative frequency plot. An alternative to the histogram is kernel density estimation, which uses a kernel to smooth samples. This will construct a smooth probability density function, which will in general more accurately reflect

Page 244

International Journal of Research in Computer and Communication Technology, Vol 3, Issue 2, February- 2014

ISSN (Online) 2278- 5841 ISSN (Print) 2320- 5156

the underlying variable. Our resultant histogram for the Lena image is shown below.

(a) (b)

Original image

After applying chaotic transform

N o of pi xe ls Intensity

(c)

No . of pix els

Gray level transformation

After block based shuffling

The above figure shows the image after applying chaotic transform, gray level transformation and block based shuffling.

Table-3: Results for 256×256 images

Intensity Figure-4: (a)Original image (b) Histogram of original image (c)Histogram of encrypted image The histogram of encrypted image is evenly distributed. So the statistical analysis of an encrypted image is highly impossible.

Table-4: Results for 512×512 images

Figure-5: Encryption Process

www.ijrcct.org

Page 245

International Journal of Research in Computer and Communication Technology, Vol 3, Issue 2, February- 2014

7.CONCLUSION In this work we tried to apply modified particle swarm optimization to generate the key for block based shuffling. Results show that combined pre-encryption and encryption techniques heavily disturbs the correlation between vertically and horizontally adjacent pixels. Also we have achieved better NPCR and UACI results.

ISSN (Online) 2278- 5841 ISSN (Print) 2320- 5156

[10] S. Behnia, A. Akshani, S. Ahadpour, H. Mahmodi, A. Akhavan, “A fast chaotic encryption scheme based on piecewise nonlinear chaotic maps,” Physics Letters A, pp. 391-396, 2007. [11] C. Li, S. Li, G. Alvarez, G. Chen and K. T. Lo. “Cryptanalysis of two chaotic encryption schemes based on circular bit shift and XOR operations”. Physics Letters A, 2007.

8.REFERENCES: [1] Stallings W, “Cryptography and Network Security: Principles and Practice”. Prentice-Hall, Upper Saddle River, NJ, 1999.

.

[2] B. Schneier, “Description of a new variable-length key, 64-bit block cipher (Blowfish)”; Fast Software Encryption,Cambridge Security Workshop Proceedings, Springer-Verlag, 1994, pp. 191-204. [3] Shannon CE [1949] “Communication theory of secrecy system,”Bell System Technical Journal, Volume 28, pp. 656 – 715. [4] Menezes AJ, van Oorschot PC and Vanstone SA, Handbook of Applied Cryptography; CRC Press, Boca Raton, FL, 1996. [5] M. Ali BaniYounes and A. Jantan, "Image encryption using blockbased transformation algorithm" in IAENG International Journal of Computer Science, Volume 35, Issue 1, 2008. [6]. T. Xiang, X.F. Liao, K.W. Wong,2007, “An Improved Particle SwarmOptimization Algorithm Combined with Piecewise Linear ChaoticMap,” Applied Mathematics and Computation, vol. 190, no. 2, pp.1637-1645

[7] F. Pichler and J. Scharinger, “Efficient image encryption based on Chaotic Maps” in Proc. 20th Workshop of the AAPR, Pattern Recognition, OldenbourgVerlag, pp. 159-170, 1996. [8] Jiri fridrich “Symmetric Ciphers based on TwoDimensional Chaotic Maps“ in International Journal Of Bifurcation And Chaos, vol. 8, no.6, pp. 1259-1284, 1998. [9] M Salleh, S Ibrahim, IF Isnin, “Image encryption algorithm based on Chaotic Mapping” Jurnal Teknologi, Universiti Teknologi of Malaysia, 39(D), pp. 1–12, 2003.

www.ijrcct.org

Page 246