A Symmetric Image Encryption Approach based on Line Maps Yong Feng, Linjing Li, Feng Huang Abstract-This paper proposes a new line map, which is an invertible chaotic two-dimensional map. The algorithm of the line map is formulated. An image encryption scheme based on the line map is developed that maps a image to a row of pixels and further fit to a same size image using the line map. The line map is generalized by using some parameters, the numbers of the left and the right line map, which are used as the key. For encryption, several iterative applications are made to a digital image. While for the deciphering process, the inverse of the line map is applied with the same number of iterations. The image encryption and deciphering scheme based on the line map has no information loss. The experimental tests are carried out and the results show the effectiveness of the new scheme.
I. INTRODUCTION ITH the fast developments in information techniques network communications, more and more digital images are transmitted over the Internet and through wireless networks [1]. Security of digital images has increasingly become an important issue [2, 3]. The image encryption is an important tool to protect digital images. It includes conventional encryption and other methods such as chaotic encryption [4]. Many image encryption schemes have been developed over the last few years [5-8]. It is well known that chaos can be applied in cryptography [9, 10]. Chaos has many characteristics, such as sensitive dependence on initial conditions and parameters, mixing randomness in the time domain, broadband power spectrum, ergodicity, low-dimensional, etc [10]. The complex behaviors of chaotic systems may be predicted for short period of time and but not necessarily for long period of time. Chaotic maps are the simplest form of chaos. Image encryption schemes based on chaotic maps may offer new and excellent quality and has many desired cryptographic qualities. Compared with traditional cryptosystems, they are easier to be implemented in high encryption rates, which make it more suitable for large-scale data encryption such as images, videos or audio data [ 1]. Chaotic maps have been utilized in several different ways in cryptography. The image encryption scheme is generally composed of two steps: chaotic confusion and pixel diffusion.
WVand
This work was supported by the National Natural Science Foundation of China (No.60474016) and the Scientific Research Foundation for Returned Overseas Chinese Scholars, State Education Department of China. Yong Feng is with the Department of Electrical Engineering, Harbin
Institute of Technology, Harbin 150001, China (phone: 86-451-86413650;
fax: 86-451-86413420; e-mail:
[email protected]).
Linjing Li is with the Department of Electrical Engineering, Harbin Institute of Technology, Harbin 150001, China (e-mail: linginelee
@hit.edu.cn).
Feng Huang is with the Department of Electrical Engineering, Harbin
Institute of Technology, Harbin 150001, China (e-mail: huangfeng
@hit.edu.cn).
1362
The first paper about chaotic cryptography was published in 1989 [12], in which a one-dimensional chaotic map
exhibiting chaotic behavior for parameter values and initial values within a specified range was derived. Since then, various chaos-based image encryption schemes have been proposed [2, 5-8, 12-19]. Chaos-based image encryption '
'
ppe rtin appchs havem sho u some lexctinsedcoptn omplext, coneniong apoets power and computational overhead, etc [8]. s
There are some typical chaotic maps used for image encryption, such as Cat map, Baker map, Standard map, Tent
map, etc. Among these maps, Cat map and Baker map attracted much attention. Cat map is a two-dimensional chaotic map introduced by Arnold and Avez [5-7]. Baker map is another two-dimensional chaotic map, based on which Pichler and Scharinger first introduced their encryption
schemes [6, 16]. Baker map has some important properties such as sensitivity to initial conditions and parameters, mixing, and bijectiveness [5-7]. Based on Cat map and Baker map, extensive research has been done. In [8], a symmetric image encryption scheme based on 3D chaotic cat maps was proposed. The two-dimensional chaotic cat map was generalized to 3D for designing a real-time secure symmetric encryption scheme, which employed the 3D cat map to shuffle the positions of image pixels and used another chaotic map to confuse the relationship between the cipher-image and the plain-image. In [14], Baker map was further extended to 3D and then used to speed up image encryption while retaining its high degree of security. In [2], the properties of confusion and diffusion were improved in terms of discrete exponential chaotic maps, and a key scheme was designed for resistance to statistic attack, differential attack and grey code attack. In [15], an alternative chaotic image encryption based on Baker's map was discussed. This enhanced symmetric-key algorithm can support a variable-size image and includes other functions such as password binding and pixel shifting to further strengthen the security of the cipher image. From the above brief survey of the image encryption schemes based on chaotic maps, the following important points can be concluded. Through analysis, the security of Baker cipher is significantly higher than the security of the cipher based on Cat map [7]. For Baker cipher, there are two different versions: A and B. In the former, the formulas of the map can be provided, but the key is produced only among the divisors of the pixel number of the row or column of the
square images. It means there iS limit for the choice ofthe key,
which will decrease the security of image encryption. In the latter, though the range space of the key is extended to any
itgru otepxlnme
itgru
otepxlnme
fterwo ouno h
fterwo houno
square images, there are no formulas ofthe map similar to [7],
which would be inconvenient for applications.
This paper proposes a new line map, which is an invertible chaotic two-dimensional map. The algorithm for the line map is formulated in the paper. An image encryption scheme based on the line map is designed, which shuffles the positions of image pixels. The line map is divided into two different forms: the left line map and the right line map. For image encryption, several iterations of the left line map and the right line map are made to a digital image respectively. The iteration numbers of the left line map and the right line map are used as the key. While for the deciphering process, the inverse of the line map is applied the same number of times. The image encryption and deciphering scheme based on the line map proposed in the paper has no information loss. The experimental tests are carried out to illustrate the effectiveness of the new scheme.
in Fig.2.(a), pixel (1,1) is inserted between pixels (2,1) and (1,2), pixel (3,1) is inserted between pixels (4,1) and (3,2), and so on. It is noted that to arrange the original image into a row of pixels is indeed a process of stretch, and rearrange the row of pixels to a same size square image is the process of fold. The proposed line map in this sense is a chaotic map, similar to Baker map or Cat map [5-7]. It can confuse the pixels in an image with high efficiency and is especially suitable for large size digital image.
4,1 4,2 4,3 4,4
II. THE PRINCIPLE OF THE LINE M\4AP
This paper proposes a new map, named the line map. For the purpose of simplicity, the encryption of a image consisting of NxMpixels with L levels of gray is considered. Based on the above assumptions, a image is mapped to a row of pixels firstly, and then it is fit to a same size image using
1,1 1,21,3 1,4
V/
L
Upper
\
-~.......
Lower
3,1 3,2 2,2 2,3 1,3 1,4 4,2 4,3 (a)
V/
3,3 3,4 2,4 4,4 2,4 1,4 1,3 4,4
2,1 2,2 2,3 2,4 3,1 3,2 3,3 3,4
3,4 3,3 2,3 2,2 1,2 1,1 4,3 4,2
4,1
3,2
L
the line map.
The principle of the line map is shown in Fig. 1. As aforementioned, the line map is divided into two forms: the left line map and the right line map, as shown in Figs. 1(a) and (b) respectively. The left line map means that a NxM image is first mapped to a row of NxM pixels from the left upper corner to the right lower corner along the diagonal, then the row of NxM pixels are further mapped to another NXM image. As shown in Fig. 1(b), the right line map is the symmetric to the left line map. The line map utilizes an important characteristic of images. As shown in Fig. 1, each pixel of the above line perpendicular to the diagonal can be inserted between the adjacent two pixels of the next line perpendicular to the diagonal.
2,1 1,1 1,2 4,1
1,2 1,3 1,4 X 2,1 2,2 2,3 2,4 3,1 3,2 3,3 3,4 11
4,2
4,3
4,4
3,1
2,1
4,1
(b)
Fig. 2. Line map. (a) the left line map; (b) the right line map.
III. THE PRINCIPLE OF THE LINE MAP Based on the rinciple of line ma introduced in the p p p this section. A. The Left Line Map Two different cases of the left line map will be considered respectively: one is for the square images and the other is for the rectangular images. Case 1: square images First, the algorithm of the left line map for square image is given below. Suppose the dimension of a square image is NxN, where N is an integer. As shown in Fig. 1(a), the line map for both the upper and lower parts of the image are described respectively with the following formulas:
(a)
/((4kt-1)+ j+1)-= JA(fx( 4i)jl ),X 2 k=O j =1, .... 4i-1
Upper
Lower
(b)
Fig. 1. The principle of line map. (a) left line map; (b) right line map.
i = 11 2,, fix(N/2) E (4k-1)+ E
fix(N/ 2)
=A(x( ~A(.fix(
J,2
k=1
In order to explain the line map more clearly, two simple examples are given here. The first is the image with 4x4 pixels, that is N=4. The processes of the left line map and the right line map are shown in Fig.2(a) and (b) respectively. It can be seen that each pixel of the above line can be inserted between the adjacent two pixels ofthe next line. For instance,
1363
2 k=fix(N12)
(
+
4
(4N+1-4k)-4fx(
+2 j)2-+x .i(
N+1
2
))
,
(la)
-1+ j)
)n(lb)
2 2 j=1, 2, ., 4N +1-4i i =fix(N/ 2) +1, fix(N/ 2)+2, ., N where A(i, j) is a square image matrix; I(i), i=l ,. .., N N is a one dimensional vector mapped firom A(i, j); fix(X) is a
function which rounds the elements of X to the nearest integers towards zero. Remark 1: for the line map (1), the index of the 1(i), i is increase one each step from 1 to NWN. Therefore, the index of the~~~~~~~~~~~~~~~~ dosntne.ob acuae.IIt needls ed only nytto to.ibe calculated. the l(i) does not need increase one for 1(i) each step. Case 2: rectangular images Now the left line map for the rectangular images is proposed. Suppose the dimension of a rectangular image is NxM, where N and M are two integers, and M > N. The algorithm of the left line map for rectangular image is given below: 4i-1+1 1+1 i-l + j + 1) = A(fix( ), fix( (4k -1) )) k=O (2a) (2a) j = 1, 2, ,.' 4i -1 i = 1, 2,, fix(N/2)
/(I
fix(N12)
1
(4k-1) + 2N(i -1) + j) = I2 +2-
k=1
+2
,(2b
A(fix(
)
)) ), 2i -1- mod(N, 2) + fix( 2 2 j 1, 2, , 2N i 1, 2, **, fix((M - 2fix(N / 2))! 2)
fix(N12) 1
(4k -1)+2N fx((M-2fx(N/2))/2)
+
(2(M MI) +5-4k)- 2(M M) -5+ j)
A'(i, j) = A(i, M + I - j) ' j 1, 2,*.,M 2, N i =1 ...,
where w A' is the matrix of the mirror image of a square image A. After obtaining A', the right line map can be done with the left line map, Eq.(1) for square map or Eq.(2) for rectangular images. Of course, in order to increase the efficiency of calculation of the right line map, the best way is to derive the algorithm of the right line map directly. They can be easily obtained from Eqs.(1) or (2). For the case of square images, the first index of A in Eq.(1), i, is kept unchanged, and the second index,j, is replaced by N+I -j according to Eq.(4). For the case of rectangular images, the first index ofA in Eq.(2), i, is also kept unchanged, and the second index,j, is replaced by M+1-j according to Eq.(5). C. The Map from a Line to a Image
In preceding subsections, an NxN square image or an NxM rectangular image, A, is mapped to a row ofNN or N.Mpixels / with either left line map or right line map, as shown in Fig. 1. Now, the row of N N or N M pixels I is further mapped to a same size NxN square image or NxM rectangular image, B. The map from line I to image B for NxN square image or NxMrectangular image are obtained from Eqs.(1) or (2) and given respectively with the following formulas: j
-
-
=A(N fix(
),M + 2(i 1) + fix(-)) 2, *, 2(M-M,)+5-4i
B(i, j)
whereM= 2+2fix(N/2)-N+2fix((M-2fix(N/2))/2); mod(x, y) is modulus-after-division operator; A(i,j), 1(i) and fix(X) are defined as Eqs.(1a) and (lb). Remark 2: for the rectangular images with NxM, M < N
themtranspo fof matherixtanimad firagest A'(i,t) = A(j,i) j=1,2,...,N
'
(6)
i =1, 2,
N
ro,2, a
IV. IMAGE ENCRYPTION AND DECRYPTION BASED ON LINE
MA.P
=
the image is made. The algorithms of the mirror images for square images and rectangular images are given respectively as follows: A'(i,j)=A(i, N +I (4) ,2 jI i=1, 2, ., N or
s*,
Therefore, through the left line map (or the right line map) and the map from a line to square image (6) or rectangular image (7), one iteration of the line map has been completed.
~~~(3)
B. The Right Line map For the right line map in Fig. 1 (b), first, a mirror process of
M +j)
1((i -1)
2 iN fs where l(i), 1,2,Nfsuem, N M, for rectangular image.
1, 2, .., M and then the left line map of image A with NxM, M < N, can be done using the algorithm (2) with A'. i
1, 2,.,N
or
-
-
(5)
In the preceding sections, a new map, Line map for square image or rectangular image, has been proposed. In this section, the line map is used to encrypt an image. A. Image Encryption Image encryption can be achieved by pixels permutation. Since the line map is divided into the left line map and the right map, the numbers of the left line map and the right line map can be used as secret key in image encryption. For example, a secret key "321" means that an image is mapped to another encrypted image through 3 iterations ofthe left line map, 2 iterations of the right line map, and 1 iteration of the left line map as shown in Fig. 1.
1364
2N +2] 2 1 1+2 ) + fix( 2i mod(N, 2)j) 2 fix(N12) (4k-1) + 2N(i -1) + j) 1
If the key is in decimal, from the most significant digit to the least significant digit, each digit (0-9) corresponds to the iteration number of the left line map and the right line map alternately. In another case where the key is represented in binary digit, from the most significant bit to the least significant bit, every four bits (0-15) correspond to the iteration numbers of the left line map and the right line map alternately.
k=l
, N i 1, 2, , fix((M - 2fix(N / 2)) 2) j-1 j -
A (N fix( fix(N/2)
j1,2, j(8)i
j
l= 1, 2,.., N
l((i -1)
M + j) = B(i, j) 1, 2, ,M 1, 2, 2 , N
Case 1: square images The inverse line map for square images can be described respectively with the following formulas:
j
+1
)
))
-
/(j (4k - 1) + j + 1)
1,2,2.., 4i-k1=O
N12
2N +2 2
), 2i
-
(10)
N + fix(-))
i-l,(1)
E (4N+1-4k)-2N-1+]j) 1(1(4k-1)+ k=1 k=N12
j =1, 2, , 4N + 1 -4i i=N /2+1, N /2+22, ., N where A(i,j), I(i) andfix(X) are defined as Eqs.(1) and (2). Case 2: rectangular images In addition to the square images, the inverse line map for rectangular images can be obtained in the similar ways to the square images. The algorithms of the inverse line map for rectangular images are given respectively as follows: A(fix( 4i fix( ' +1)) (4k -i) + 2 2 k=O , (12a) j=1, 2, ., 4i -1 i =1, 2, *, fix(N /2)
-}j+1)A
-l(~
(12c)
EXPERIMENTS
A. Image Encryption and Decryption In order to verify the line map proposed in the paper, an image encryption is carried out based on the ling map. The original image is shown in Fig.3. It has 460x500 pixels with 256 grey levels. Its histogram is depicted in Fig.4. The results of experiment for image encryption and decryption are shown in Figs.(4)-(1 1). The original image in Fig.3 is encrypted using the line map by a key "1234567890123456". The proposed line map is a process of image pixels permutation. In order to enhance the security, the gray level values substitution is used together with the line map using exclusive OR operation of i andj. In this way, the histogram of the encrypted image can be flattened, and the
(10)
J = 1, 2,..',4i-1 = 1, 2,..., N /2
A(fix(
v.
(9)
where l(i), i 1, 2, , NN(NM), for square(rectangular) image. Then, A can be mapped from 1. Similar to the image encryption, two different cases in image decryption are also considered.
4i- J+ 1
),ml + 2(i 1) + fix()= 2
I1+ fx((M -MI)/2) i=1, 2, where M1, mod(x, y), A(i,j), I(i) and fix(X) are defined as before.
,N
A(fix(
2
( E (4k-1) + 2N. fix((M - 2fix(N 2)) 2) k=l i-l 2 (2(M - MI) + 5 - 4k) - 2(M - MI) - 5 + j) j 1, 2, 2(M - MI) + 5 - 4i
Decryption of image is the inverse of the encryption of image, that is, from image B to image A. First, the line vector I must be obtained from the encrypted image B with the following two fornulas for the square image or rectangular image:
j i
(12b)
j 1, 2,
B. Image Decryption
or
J),
2 A(fix(
j+1l)
1365
encrypted image will be more resistive to physical attack. The
ciphered image and its histogram are shown in Fig.5 and Fig.6. It can be seen that the original image is encrypted. Since the histogram of the ciphered image in Fig.6 is flat, different with that of the original image in Fig.4, it enhances the security of the image encryption. The image decryption can be done using the inverse line map in Eqs.(7)-(1 1). The decrypted image is shown in Fig.7. Since there is no difference no difference between the decrypted image and the original image, the image is recovered completely. That means the image encryption using the line map has no any message loss. It validates the proposed line map is invertible. B. Security Analysis First, the key space of the line map is analyzed. Since the length of the key of the line map has no limit, its key space can be calculated according to the length of the key. The relationship between the key Space size and the key length is shown in TABLE I. It can be seen that the key space size of the line map can be very large. In applications, the key length can be determined according to the requirements of the security. There is no any other limit for the key.
TABLE I
KEY SPACE SIZE vs. KEY LENGTH
Key length
(bits) Keyospace size
64
128
256
512
1.84x1019
3.4x1038
1.16x1077
1.34xo54
Second, the key sensitivity of the line map is tested. Assume that an image is encrypted using the line map proposed in the paper with a key "1234567890123456", just as seen in Fig.3 and Fig.5. Now, the least significant bit of the key is changed and the test is done in image decryption. The original key "1234567890123456" is changed to Fig.5. Encrypted image: key=1234567890123456. "1234567890123455" and "1234567890123457", both of which are used to decrypt the ciphered image by the original 10 key "1234567890123456" respectively. The two decrypted 10 images by two different keys are shown in Fig.8 and Fig.9. It can be seen that the original image cannot be decrypted withim the ciphered image using both two keys, which are different70 only in the least bit one. Therefore, the security of the image 0 0 encryption using the line map is much effective. Final test for image encryption is made with a special keyk405300 "1,that is, using only one round left line map. The ciphered20 image is shown in Fig. 10. It can be seen that the pixels of the 0 0 original image are well permuted using only one round left 0 60 100 160 26'0 20 line map. Fig.6. Histogram of encrypted image.
Fig. 3. Original image 25002000-
1000
500
Fig.7. Decrypted image.
REFERENCES [1] A. G. Lukyanov, "Optimal linear systems with degenerate criteria", Automation and Remote Control, vol.43, no.7, pp.872-879, 1982. [2] P. P. Dang and P. M. Chau, "Image encryption for secure internet multimedia applications," IEEE Trans. Consumer Electronics, vol. 46, no. 3, pp.395-403, 2000. [3] L. Zhang, X. Liao and X. Wang,"An image encryption approach based
chaotic maps," Chaos, Solitons and Fractals, vol. 24, no. 3, pp.759-765, 2005. [4] I. J. Cox, J. Kilian, F. T. Leighton and T. Shamoon, "Secure Spread Spectrum Watermarking for Multimedia," IEEE Trans. Image Processing, vol. 6, no. 12, pp.d1673-1687, Dec. 1997. [5] K.-L. Chung, L.-C. Chang, "Large encrypting binary images with higher security," Pattern Recognition Letters, vol.19, no.5-6, pp.46 1-468, 1998 [6] J. Fridrich, "Image encryption based on chaotic maps," in IEEE Conf Systems, Mlan, and Cybernetics, pp. 1105-1110, 1997. [7] J. Fridrich, "Symmetric ciphers based on two-dimensional chaotic maps, " Int. J Bifurcat. Chaos, vol.8, no.6, pp. 1259-1284, 1998. [8] J. Fridrich. Secure Image Ciphering Based on Chaos. [Online]. Available: http: lw-ww.-ws. binghamton. edulfridrichlpublications,.html [9] G. Chen, Y. Mao and C. K. Chui, "A symmetric image encryption scheme based on 3D chaotic cat maps," Chaos, Solitons and Fractals, Vol. 21, pp.749-761, 2004. [10] F. Dachselt and W. Schwarz, "Chaos and cryptography," IEEE Trans. Circuits Syst. I, Fundam. Theory Appl., vol. 48, no. 12, pp. 1498-1509, Dec. 2001. [11] L. Kocarev, "Chaos-based cryptography: A brief overview," IEEE Circuits and System MlIagazine, vol.1, no.3, pp.6-21, 2001. [12] S. Lian, J. Sun and Z. Wang, "Security analysis of a chaos-based image encryption algorithm," PhysicaA, vol. 351, pp.645-661, 2005. [13] L. Kocarev, G. Jakimoski, T. Stojanovski and U. Parlitz, 'From chaotic maps to encryption schemes', in IEEE Conf Circuits and Syst. ISCAS'98, vol.4, pp.514-517, 1998. [14] R. Matthews, "On the derivation of a 'chaotic' encryption algorithm," Cryptologia, XIII(1), pp. 29-42, 1989. on
Fig.9. Decrypted image: key=1234567890123457.
Fig 10.
Encrypted
image: key=1.
VI. CONCLUSIONS In this paper, a new map, the line map, has been proposed.
[15] G. Jakimoski and L. Kocarev, "Chaos and Cryptography: Block
The algorithms of the line map have been deduced and the Encryption Ciphers Based on Chaotic Maps," IEEE Trans. Circuits Syst. I, Fundam. Theory Appl., vol. 48, no. 2, pp. 163-169, Feb. 2001. image encryption scheme based on the line map has been and S. Lian, "A novel fast image encryption scheme the [16] Y. Mao,onG.theChen designed. This new scheme utilizes the line map to shuffle .based 3D chaotic baker map," Int. J. Bifurcat. Chaos, vol. 14, postisof image pixels and the numbers of no.10, pp. 3613-3624, 2004. t of an d he exmappings righ c pos(itons (either left or right) can be used as a key. The experimental [17] M. Salleh, S. Ibrahim and I. F. Isnin, "Enhanced chaotic image tests have been carried out and the results show the encryption algorithm based on Baker's map," in IEEE Conf Circuits and Syst., vol.2, pp.II508-II511, 2003. effectiveness of the scheme. The advantages of this new map can be described as follows: 1) The line map can be [18] F. Pichler, J. Scharinger, "Finite dimensional generalized Baker dynamical systems for cryptographic applications," Lecture Notes in Computer Science, vol. 1030, 1996, Springer, Berlin, pp. 465-476. formulated using equations; 2) The line map Sian invertible chaotic map; 3) The image encryption and decryption base on [19] T. Habutsu, Y. Nishio, I. Sasase, S. Mori, "A secret key cryptosystem the line map have no message loss; 4) suitable for hardware by iterating chaotic map," Lecture Notes Computer Science Advances in Cryptology-EuroCrypt'91, vol. 547, 1991, pp. 127-140. realization; 5) the key can be determined among integers and K. Aihara, "Cryptosystems with discretized chaotic maps," has no any other limit, that means the key length can be any [20] N. Masuda, Trans. Circuits Syst.-I: Fundam. Theory Appl., vol.49, no. 1, pp. long number to satisfy differentsecurityrequirements;6ThIEEE long number to satisfy different security requirements; 6) The 28-40, 2002. size of the enciphered image using the line map is equal to the size of the original image.
1367