VIEWS: 365 PAGES: 6 CATEGORY: Emerging Technologies POSTED ON: 4/9/2011
(IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 3, March 2011 A digital image encryption algorithm based on chaotic logistic maps using a fuzzy controller Mouad HAMRI #1 , Jilali Mikram #2 , Fouad Zinoun &3 # Mathematics and computer science department, Science University of Rabat-Agdal 4 Avenue Ibn Battouta Rabat Morocco & Economical sciences and management department, University of Meknes Morocco 1 hamri.mouad@gmail.com 2 mikram@fsr.ac.ma 3 fouad.zinoun@gmail.com Abstract—In this paper we will present a digital image encryp- and the quantum machines that can be a reality soon. tion algorithm based on chaotic logistic maps and using fuzzy Chaotic dynamical systems present a very important tool to logic (FL-CM-EA). Many papers was published in the recent build efﬁcient and secure cryptosystems thanks to their high years about encryption algorithm using chaotic dynamical sys- tems thanks to the set of very interesting properties guaranteed sensitivity to initial conditions, their ergodicity propriety, their by these chaotic dynamical systems: high sensitivity to initial simplicity of implementation and also the very interesting conditions, ergodicity, simplicity of implementation..., that can execution time that help to have a real-time applications. be used to conceive efﬁcient cryptosystems. In this paper we propose an encryption algorithms using not The main idea of this paper is the usage of a fuzzy logic set only one logistic map but a map of many logistic maps and of rules to control the next iteration of our proposed iterative mechanism using a set of logistic maps. the iterations are deﬁned using a set of fuzzy logic rules. An introduction to chaotic dynamical systems and logistic map The rest of this paper will be as follow: section 2 introduces is given followed by an introduction to fuzzy logic. A complete chaotic dynamical systems and logistic map, section 3 speciﬁcation of the proposed algorithm is presented with a set introduces fuzzy logic, section 4 presents the proposed of security analysis tests that show the efﬁciency and the high algorithm with some results, section 5 presents the security security level of the algorithm. analysis tests and ﬁnally section 6 concludes this paper. Keywords: cryptography, logistic map, fuzzy logic, image II. C HAOTIC DYNAMICAL SYSTEMS AND LOGISTIC MAP encryption, security analysis, dynamical systems, chaos theory. Roughly speaking, a dynamical system ([1-4],[11-12]) con- I. I NTRODUCTION sists of two ingredients: a rule which is described by a set of Today the community network applications in the internet equations and specify how the system evolves and an initial are been used by billions of people around the world and this condition from which the system starts. It can be deﬁned usage rate is growing continuously. This implies that more also as a system of equations describing the evolution of a and more amounts of information is being transmitted over mathematical model where the model is fully determined by the internet. The data being transmitted includes all kind of a set of variables. information format: text, audio, video, image and a lot of The logistic map (that will be used in our algorithm) is a very other special formats. famous discrete dynamical system used in many researches Images are used widely in our daily life in almost our when dealing with dynamical systems and chaos. It is deﬁned communications, these communications includes military on the set [0, 1] and can be written: communications, banks transactions and many other xn+1 = rxn (1 − xn ) communications where the security is really mandatory. This lead to conclude that image security is a very important Where x0 represent the initial condition, n ∈ N and r is topic in our internet communication world. positive real number. In reality, there is no universal deﬁnition for chaotic Many algorithm have been proposed in the last years dynamical systems. The following deﬁnition tries to deﬁne a to solve these security issues, using the classical encryption chaotic dynamical system using three ingredients that almost algorithms such as RSA or EL-Gamal or using the elliptic everyone would agree on. curves. The problem with the previous algorithm is that their security relies on the fact that it is not feasible with today’s Chaotic dynamical system: Let f : X → Y a function machines to factorize a large number or to solve the discrete (X, Y ⊆ R). logarithm problem but this may not be true in the near future ˙ The dynamical system x = f (x) is said to be chaotic if the especially with the recent advances in machines performances following proprieties are satisﬁed: 39 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 3, March 2011 1- Sensitive dependance on initial conditions:∀β > 0, For TS fuzzy rules and unlike Mandany fuzzy rules, TS fuzzy ∃ε > 0 there exists a point y0 ∈ X and k > 0, such that: rules deﬁne the output variables as a function of the input | x0 − y0 |< β ⇒ | xk − yk |> ε. variables. If we take the same example as before, a TS fuzzy 2- Density of periodic orbits:The ensemble of periodic rule can be described as follow: orbits: {x0 ∈ X, ∃k > 0, xk = x0 } is dense in X. IF x1 in S1 and x2 in S1 THEN y1 = f (x1 , x2 ) and 3- Deterministic: means that the system has no random or y2 = g(x1 , x2 ) noisy inputs or parameters. Where f and g are two real functions of any type. The deﬁnition above is applied to both discrete and In general, the steps followed to construct a fuzzy controller continuous dynamical systems. are: The logistic map is a chaotic dynamical system and presents 1) Identifying and naming the fuzzy inputs and outputs. a very high sensitivity to initial conditions for r between 2) Creating the the fuzzy membership functions. about 3.57 and 4 (approximatively). 3) Constructing the fuzzy rules (Mandany or TS rules). Fig.1 shows the bifurcation diagram of the logistic map. 4) Deﬁning the defuzziﬁcation process (convert fuzzy out- puts to crisp outputs). The ﬁgure Fig.2 shows an example of a possible fuzzy controller. Fig. 1. Bifurcation diagram of the logistic map III. F UZZY LOGIC In the 1960s, Lotﬁ Zadeh invented fuzzy logic [16,17], which combines the concepts of crisp logic and the Lukasiewicz sets by deﬁning graded membership. One of Zadehs main insights was that mathematics can be used to link language and human intelligence. Many concepts are better deﬁned by words than by mathematics, and fuzzy logic and its Fig. 2. Diagram of a fuzzy controller expression in fuzzy sets provide a discipline that can construct better models of reality. In the next section, we will present our encryption algorithm Fuzzy logic is a form of many-valued logic in the opposite of and we will describe all the parameters of the used fuzzy the crisp logic which is a two-valued logic (binary logic). controller. Fuzzy logic involves linguistic variables with a truth value in the interval [0, 1], it involves also fuzzy sets and fuzzy IV. T HE ALGORITHM inference. Every fuzzy model uses fuzzy rules which are linguistic if- The proposed algorithm (FL-CM-EA) takes as inputs a then statements. These rules are linking the inputs variables plain-image P and a 128 bits key K then generates as output to the output variables, they simply deﬁne the control logic. the cipher-image C. Two major types of fuzzy rules exist: Mandany fuzzy rules and The main idea of the algorithm was to use not only a simple Takagi-Sugeno (TS) fuzzy rules. An example of a Mandany logistic map to generate the encryption (decryption key) but to fuzzy rule for a fuzzy system with two inputs and two outputs use what we have called ”fuzzy-logistic-map”, which is also can be described as follow: a function from the interval [0, 1] to itself, using three fuzzy rules and three logistic map (we can use as many logistic maps IF x1 in S1 and x2 in S1 THEN y1 in S3 and y2 in S4 and fuzzy rules as we want but in this paper we will use three). 40 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 3, March 2011 IT ER If we call the three logistic maps LM1 , LM2 and LM3 then – KFi =( l=1 F M L(i + l)2 ) ×256 mod 256. the fuzzy rules are as follow: – Run the FLM generator and stop after IT ER. 1) IF x IS M1 THEN FLM(x)=LM1 (x) = r1 x(1 − x) 2) IF x IS M2 THEN FLM(x)=LM2 (x) = r2 x(1 − x) • Step 3:Using the generated key, we will generate the 3) IF x IS M3 THEN FLM(x)=LM3 (x) = r3 x(1 − x) image C as follow: For the rest of this paper, we will use the following values: – C0 (R) = (P0 (R) + KF0 ) mod 256. r1 = 3.95, r2 = 3.9 and r3 = 3.8. – C0 (G) = (P0 (G) + KF0 ) mod 256. The fuzzy sets M1 , M2 and M3 membership functions f1 , – C0 (B) = (P0 (B) + KF0 ) mod 256. f2 and f3 are deﬁned as follow: and: 1 For i in [2, n]: −2x + 1 if 0≤x≤ 2 f1 (x) = 1 – Ci (R) = (Pi (R) + KFi + Ci−1 (R)) mod 256. 0 if 2 ≤x≤1 – Ci (G) = (Pi,j (G) + KFi,j + Ci−1 (G))) mod 256. 2x if 0≤x≤ 1 2 – Ci (B) = (Pi,j (B) + KFi,j + Ci−1 (B))) mod 256. f2 (x) = 1 −2x + 2 if 2 ≤x≤1 • Step 4: We reverse the data of the image C : For i in [1, n]: 0 if 0≤x≤ 1 2 f3 (x) = 1 – Ci = Cn−i+1 2x − 1 if 2 ≤x≤1 • Step 5: ﬁnally we construct the cipher-image C by For the defuzziﬁcation process, we use a center average repeating the step 3 using the image C : defuzziﬁer and the crisp value of FLM(x) is: – C0 (R) = (C0 (R) + KF0 ) mod 256. 3 i=1 µi LMi (x) – C0 (G) = (C0 (G) + KF0 ) mod 256. F M L(x) = 3 – C0 (B) = (C0 (B) + KF0 ) mod 256. i=1 µi and: Where µi represents the degree of membership of x in Mi . For i in [2, n]: Before presenting the algorithm, the following notations are – Ci (R) = (Ci (R) + KFi + Ci−1 (R)) mod 256. presented: – Ci (G) = (Ci,j (G) + KFi,j + Ci−1 (G))) mod 256. P plain-image – Ci (B) = (Ci,j (B) + KFi,j + Ci−1 (B))) mod 256. K 128 bits key • End C cipher-image Pi ith pixel of P The decryption algorithm is identical to the encryption algo- Pi (R, GorB) Red, Green or Blue value of the pixel i F LMi fuzzy-logistic-map value after i iteration rithm, it receives as inputs the cipher-image C and the 128 Li (x0 , N ) Value of the logistic map i bits key K (the same used for the encryption) and returns as starting from x0 after N iterations output the plain-image P. F A map from the set of 32 bytes The only difference between the two algorithm is the step numbers to the interval [0, 1] 3 and step 5 which are deﬁned as below for the decryption algorithm. The encryption algorithm description can be summarized • Step 3: as following: – C0 (R) = (C0 (R) − KF0 ) mod 256. – C0 (G) = (C0 (G) − KF0 ) mod 256. • Begin: – C0 (B) = (C0 (B) − KF0 ) mod 256. • Step 1: We begin by generating an initial condition and: x0 ∈ [0, 1]: For i in [2, n]: x0 = F (K). – Ci (R) = (Ci (R) − KFi − Ci−1 (R)) mod 256. – Ci (G) = (Ci (G) − KFi − Ci−1 (G)) mod 256. • Step 2: In this step we generate a key vector KF of – Ci (B) = (Ci (B) − KFi − Ci−1 (B)) mod 256. size n where n is the number of pixels of P using the function getKey: • Step 5: KF = getKey(x0 ). – P0 (R) = (C0 (R) − KF0 ) mod 256. The function getKey is deﬁned as bellow: – P0 (G) = (C0 (G) − KF0 ) mod 256. – P0 (B) = (C0 (B) − KF0 ) mod 256. Run the FLM generator and stop after IT ER and: iterations (the initial value is x0 and IT ER is an For i in [2, n]: iteration parameter). – Pi (R) = (Ci (R) − KFi − Ci−1 (R)) mod 256. For i in [1, n]: – Pi (G) = (Ci (G) − KFi − Ci−1 (G)) mod 256. – Pi (B) = (Ci (B) − KFi − Ci−1 (B)) mod 256. 41 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 3, March 2011 In the next section, we will present the security analysis going to be this time :(C1 (i, j),C2 (i, j)). tests performed on our algorithm. Other measures are going to be used to compare two images C1 and C2 as the Number of Pixels Change Rate (NPCR) V. S ECURITY ANALYSIS deﬁned as below: In this section we will discuss the security analysis of i,j D(i, j) our algorithm such as key space analysis, sensitivity analysis N CP R = × 100% n (with respect to both the key and the plain-image) and ﬁnally Where n is the images size (number of pixels) and:D(i, j) = 0 statistical analysis as any robust encryption algorithm should if C1 (i, j) = C2 (i, j) and D(i, j) = 1 otherwise. resist these attacks. The Uniﬁed Average Changing Intensity (UACI) will be used The computation was done using a PC with the following as well and it is deﬁned as: characteristics: 1,8GHz Core(TM) 2 Duo, 1.00 Go RAM and 120 Go hard-disk capacity. 1 C1 (i, j) − C2 (i, j) U ACI = × 100% n i,j 255 A. Key space analysis The used key for our algorithm is a 128 bits key which Here C1 (i, j) and C1 (i, j) are grey-scale values of the images means that we have 2128 possibilities to generate a secret key. pixels. With such large key space, the encryption algorithm can be 1) Key sensitivity analysis: Key sensitivity is a required considered secured. In addition to that, the chaotic system that property to ensure the security of any image encryption we are using to generate the cipher-image is highly sensitive algorithm against some brute-force attacks. to initial condition which will guarantee that having this large To test the key sensitivity of the proposed algorithm, key space both key and plain-image attacks will not affect the we have generated randomly an encryption key: security of the algorithm as we will see in the next sections. ”0CDA03C2D734F06C48A33ECBE3178632” then we B. Sensitivity analysis encrypted an original image P using this key to obtain the An efﬁcient image encryption algorithm should be highly image C1. sensitive to the secret key and to the plaint-image, which We then slightly modiﬁed the key by means that a single bit change in the encryption key will lead changing the most signiﬁcant bit to obtain: to a very different cipher-image from the initial cipher-image ”8CDA03C2D734F06C48A33ECBE3178632”, and using and similarly, only a pixel change in the plaint-image should this key we’ve encrypted the same original P message the lead to a very different cipher-image from the initial cipher- obtain image C2. image. Finally, we did the same as the last operation but We will present in this section the results obtained by changing changing the least signiﬁcant bit to obtain the key: one bit in the encryption key and one pixel in the plain-image ”0CDA03C2D734F06C48A33ECBE3178633” and using and we will see the effects on the cipher-image. this last key we encrypted the original image P to obtain the Before starting our analysis, we will introduce some famous image C3 (see ﬁgure Fig.3). statistical measures that we will use in the next sections. The ﬁrst measure that we will talk about is the statistical corre- lation between two vertically adjacent pixels, two horizontally adjacent pixels and two diagonally adjacent pixels. To compute this measure, we ﬁrst take randomly a set of adjacent pixels (vertically, horizontally or diagonally) from the image (let’s say 1000 pairs) then we calculate their correlation using the formulas: Fig. 3. From the left to the right: original image P, C1, C2 and C3 cov(x, y) rxy = D(x) D(y) We have calculated the correlation, the NCPR and the UACI of each two of the three cipher-images C1, C2 and Where: N C3 (Table I, II and III). 1 E[x] = xi N i=1 For the obtained results we can see clearly that a negligible N correlation exists among the three images even if they was 1 D[x] = (xi − E[x])2 produced using the same original image and with a slightly N i=1 different keys. We can see also that the rate of change NPCR, the intensity of change UACI are really high,then we can cov(x, y) = E[(x − E[x])(y − E[y])] conclude that our algorithm is very sensitive to encryption We will use also to compare two images C1 and C2 , their key change. correlation deﬁned as above but the used pairs of pixels are 42 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 3, March 2011 Image 1 Image 2 Correlation C1 C2 -0.000291 C1 C3 0.000004 C2 C3 -0.001109 TABLE I C ORRELATION BETWEEN THE IMAGES C1, C2AND C3 OBTAINED BY SLIGHTLY CHANGING THE ENCRYPTION KEY ( ONE BIT CHANGE ) Fig. 4. The image P1 (left) and the image C1 (right) Image 1 Image 2 NCPR C1 C2 99.6037% C1 C3 99.6077% C2 C3 99.6039% TABLE II NCRP OF THE IMAGES C1, C2 AND C3OBTAINED BY SLIGHTLY CHANGING THE ENCRYPTION KEY ( ONE BIT CHANGE ) Image 1 Image 2 UACI C1 C2 49.8139% Fig. 5. The image P2 (left) and the image C2 (right) C1 C3 49.7397% C2 C3 49.8706% TABLE III UACI OF THE IMAGES C1, C2 AND C3 OBTAINED BY SLIGHTLY CHANGING THE ENCRYPTION KEY ( ONE BIT CHANGE ) 2) Plain-image sensitivity analysis: After studying the key sensitivity of the proposed image encryption algorithm, we Fig. 6. The image P3 (left) and the image C3 (right) will study now its plaint-image sensitivity. The algorithm should be also sensitive to any small change in Image 1 Image 2 Correlation the plaint-image which means that changing only one pixel in C1 C2 -0.0840 C1 C3 -0.0192 the plaint-image should lead to a very different cipher-image. C2 C3 -0.0377 This property will guarantee the security of the algorithm TABLE IV against plaint-image brute-force attacks. C ORRELATION BETWEEN THE IMAGES C1, C2 AND C3 OBTAINED BY To test the sensitivity to plaint-image, we will take an CHANGING ONLY ONE PIXEL OF THE ORIGINAL IMAGE original image (P1) then we will encrypted it (we call the cipher-image C1), and we will randomly change a pixel in the original message then will encrypt the im- Image 1 Image 2 NCPR C1 C2 99.6825% age again (P2) to obtain a new cipher-image C2. We re- C1 C3 99.8608% peat this a last time again to obtain a new image (P3) C2 C3 99.8608% and a third cipher-image C3 (we have used as encryp- TABLE V tion key:”0CDA03C2D734F06C48A33ECBE3178632”) (see NCRP OF THE IMAGES C1, C2 AND C3 OBTAINED BY BY CHANGING ONLY ONE PIXEL OF THE ORIGINAL IMAGE Fig.4, Fig.5 and Fig.6) As we did for the previous section, we will calculate the correlation, the NPCR and the UACI between each two of Image 1 Image 2 UACI the three cipher-images (Tables IV, V and VI). C1 C2 51.3027% Again, the obtained results show that a negligible correlation C1 C3 53.2280% C2 C3 46.2083% exists between the three cipher-images and we can see also that the rate of change (NPCR) and the intensity of change UACI TABLE VI UACI OF THE IMAGES C1, C2 AND C3 OBTAINED BY CHANGING ONLY are really high. Form the previous results, we can conclude that ONE PIXEL OF THE ORIGINAL IMAGE our algorithm is very sensitive also to plain-image change. C. Statistical analysis After studying the security of the proposed algorithm image P that will be encrypted to obtain a against some brute-force attacks (key sensitivity and plain- cipher-image C (we have used also as encryption image sensitivity), we will study in this section the security key:”0CDA03C2D734F06C48A33ECBE3178632”). We against statistical attacks. then compare their histograms and compute for each image To perform this study, we will consider an original the values of its two vertically adjacent pixels correlation, two 43 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 3, March 2011 horizontally adjacent pixels correlation and two diagonally VI. C ONCLUSION adjacent pixels correlation. In this paper we presented a digital image encryption algorithm based on chaotic logistic maps and using a fuzzy controller (FL-CM-EA). The introduction of the fuzzy controller helped to use a set 1) Histogram comparisons: Fig.7 and Fig.8, presents the of logistic maps instead of one logistic map and therefore histograms of the images P and C. increased the randomness of the generated inputs. We have tested also the robustness and efﬁciency of the proposed algorithm by performing a set of security analysis as the key space analysis, the key sensitivity and the plaint-image sensitivity analysis and some other statistical analysis as the histogram and the pixels adjacent correlation analysis and all the results demonstrated the high level of security of the proposed algorithm. R EFERENCES Fig. 7. The image P and its histogram [1] V.I. Arnold, Ordinary Differential Equations (Springer, Berlin, 1977, 1992). [2] Huaguang Zhang, Derong Liu, Zhiliang Wang, Controlling Chaos: Sup- pression, Synchronization and Chaotiﬁcation (Springer, London, 2009). [3] James D. Meiss, Differential Dynamical Systems (SIAM 2007). [4] V.I. Arnold, Geometrical Methods in the Theory of Differential Equa- tions (Springer, Berlin, 1988). [5] V.I. Arnold and D.V. Anosov, Dynamical Systems I (Springer, Berlin, 1988). [6] Yu. A. Mitropolsky and A.K. Lopatin, Nonlinear Mechanics, Groups and Symmetry (Kluwer, Dordrecht, 1995). [7] Yu. N. Bibikov, Local Theory of Analytic Ordinary Differential Equa- tions, Lecture Notes in Mathematics (Springer, Berlin, 1979). [8] A.D. Bruno, Local Methods in Nonlinear Differential Equations Fig. 8. The image C and its histogram (Springer, Berlin, 1989). [9] V.I Arnold, Mathematical methods of classical mechanics, (2nd edition, Springer, 1989). [10] Bellman R., Stability theory of differential equations , (MGH, 1953). We can see clearly that the histogram of the image C is [11] R.C. Schmitt and K. Thompson, Nonlinear Analysis and Differential Equations, An Introduction (Aug 2000). almost uniform and very different from the histogram of the [12] P. Hartman, Ordinary Differential Equations (John Wiley and Sons image P. This result conﬁrms that statistical attacks based 1964) on the histogram analysis can’t give any clue to break the [13] George D.Birkhoff, Dynamical systems (American Mathematical Soci- ety 1991) algorithm as all the statistical information of the image P are [14] Floriane Anstett, Les systemes dynamiques chaotiques pour le chiffre- lost after the encryption. ment : synthese et cryptanalyse (These) (Universite Henri Poincare - Nancy 1) [15] A. Menezes, P. van Oorschot, and S. Vanstone Handbook of Applied Cryptography (CRC Press, 1996) 2) Adjacent pixels correlation comparisons: The last [16] F. Martin McNeill, Ellen Thro, Fuzzy logic a practical approach (AP PROFESSIONAL, 1994) statistical analysis performed is the adjacent pixels correlation. [17] Zadeh, L, Fuzzy sets, Information and Control (1965) We calculate for each image (P and C) the three adjacent [18] Kamyar Mehran, Takagi-Sugeno Fuzzy Modeling for Process Control pixels correlations: vertically, horizontally and diagonally. (Newcastle University 2008) [19] Hossam El-din H. Ahmed, Hamdy M. Kalash, and Ossam S. Farag The table VII shows the obtained results. Allah, An efﬁcient Chaos-Based Feedback Stream cipher (ECBFSC) for Image Cryptosystems (SITIS 2006) [20] Mouad HAMRI, Jilali Mikram and Fouad Zinoun. Chaotic Hash Func- Image H Adj Corr V Adj Corr D Adj Corr tion Based on MD5 and SHA-1 Hash Algorithms (IJCSIS Vol. 8 No. 9 DEC 2010) P 0.7773 0.8895 0.7507 C -0.0055 0.0093 -0.0007 TABLE VII VERTICALLY, HORIZONTALLY AND DIAGONALLY ADJACENT PIXELS CORRELATION OF THE IMAGES P AND C From the obtained results, we can see clearly that the pixels of the plait-image P are strongly correlated while a negligible correlation exists between those of the cipher-image C. This result shows again that the proposed algorithm can be considered as secure against statistical attacks. 44 http://sites.google.com/site/ijcsis/ ISSN 1947-5500