An Image Encryption Algorithm Using Two-Dimensional Chaotic Map and DNA Coding
An Image Encryption Algorithm Using Two-Dimensional Chaotic Map and DNA Coding
Abstract—By improving the typical Sine map and researchers used chaos theory to image encryption and
Logistic map, a 2D chaotic map with good pseudo- achieved better encryption effect [5].
randomness and a large chaotic range of parameters is
derived. Based on the characteristics of DNA coding, an The structure of a typical 1D chaotic map is simple, and
efficient image encryption algorithm is designed by it is easy to realize fast iteration [6], but it also has the
combining chaotic map with DNA coding. Firstly, the image disadvantages of a small chaotic range and uneven data
is divided into 8-bit planes by bit level operation, and the bit distribution. Zhou et al. [7] improved the traditional 1D
plane is divided into two modules by parity separation chaotic map, making the chaotic range larger and the data
strategy. Then, the different DNA coding rules are used to distribution more uniform, but the structure is simple and
encode the image, and then the DNA XOR is used to conduct the key space is small, and the security performance is poor.
the diffusion operation. After the diagonal diffusion on the In order to improve the security of the algorithm, many HD
image, the inverse diagonal diffusion is carried out. The chaotic maps are used in the algorithm. In [8], Wu et al.
image is divided into four blocks, and the diffusion operation applied 2D chaotic map to image encryption, which
is carried out within the four blocks. Simulation results and increased the complexity of the chaotic map, but the
security analysis show that the proposed image encryption encryption speed was slower, which could not meet the
scheme has certain advantages compared with some existing requirements of real-time. In order to give consideration to
methods.
both real-time and security, in the design of image
Keywords—image encryption; 2D chaotic map; DNA coding;
encryption algorithm, using 2D chaos composed of
DNA diffusion multiple groups of 1D chaos can relatively improve the
security of the algorithm and obtain higher efficiency, so as
to achieve the purpose of giving consideration to both. Hua
I. INTRODUCTION
et al. [9] obtained a two-dimensional chaotic map with
With the popularity of the mobile Internet, the amount complex structure by compound, which improved the
of information transmission is increasing [1], which chaotic map performance and had better speed.
includes a large number of multimedia data such as text,
image, audio, video and so on. Because of the inherent With the development of multidisciplinary cross-fusion,
excellent characteristics of the image, compared with the DNA encoding technology has become a new kind of
voice and text, it is more intuitive and clear and more intelligent encryption technology. According to its inherent
favored by people. Image information has greatly enriched good characteristics [10], many researchers combine DNA
our lives, but there is also a problem of information leakage technology with a chaos system to design a more efficient
that can not be ignored. Frequent personal privacy data image encryption algorithm. Wang et al. [11], chaotic
leakage has aroused people's concern for privacy data mapping is used to optimize the DNA coding method, but
security. Image encryption algorithm has become the most the use of Logical map is not separated from the traditional
critical link to protect image information [2]. Because of mapping structure, and there are still some shortcomings.
the two-dimensional nature of images, the amount of data Zheng et al. [12] use the multi-chaotic system to control the
is much larger than that of traditional text information. In scrambling and diffusion separately, which adopts the
addition, there are high information redundancy and high method of row column simultaneous scrambling to
correlation of adjacent pixels, which makes DES, AES and improve the scrambling degree, to spread symmetrically
other traditional text encryption methods no longer from the center in both directions, which reduces the
applicable [3]. Due to some inherent characteristics of a diffusion time and greatly improves the encryption
chaotic systems, such as randomness, unpredictability and efficiency.
sensitivity to initial conditions [4], which are similar to the Based on the merits and demerits of the above
image encryption principle, in recent years, many algorithms, we encrypt the plaintext image by the improved
II. CHAOTIC MAP AND DNA CODING It is well known that 1D chaotic map has simple
structure, small key space and its security performance is
This section first introduces the 2D chaotic maps poor. In order to increase the complexity of the key, a 2D
involved and analyzes the characteristics of chaotic map chaotic map is proposed as follows by combining with Eq.
through the bifurcation diagram, Lyapunov exponent (LE) (2) and Eq. (3)
diagram and trajectory diagram. Then the DNA coding
xn +1 = (( sin( yn ) − ((4 − ) xn (1 − xn ))) 2 ) mod1
h
method used is introduced. (4)
yn +1 = (( yn (1 − yn ) − (4 − )sin( xn )) 2 ) mod1
h
A. Construction and improvement of 2D chaotic map
The chaotic ranges of two typical 1D Logistic map and where [0, 4] , Eq. (4) is called Improved 2D Sine-
Sine map are very small. To solve the problem of small Logistic Map (I2D-SLM). The bifurcation diagram,
chaotic range, two chaotic maps are combined into a new Lyapunov exponent and trajectory diagram of I2D-SLM
chaotic map are shown in Fig. 1. The chaos range is [0,4], and our
xn +1 = (( f1 ( xn ) − (4 − ) f 2 ( xn )) 2h ) mod1 (1) improved chaotic mapping has strong randomness,
uniform data distribution, good chaotic performance and
good ergodic property
Fig. 1. The bifurcation diagram of I2D-SLM (a) 𝑥–𝜇; (b) 𝑦−𝜇; (c) The Lyapunov exponents diagram of I2D-SLM; (d) Trajectories of I2D-SLM
967
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on February 21,2025 at 08:02:24 UTC from IEEE Xplore. Restrictions apply.
At present, DNA operations include DNA addition, times to generate two chaotic sequences X and Y . In
subtraction and XOR, which are similar to traditional order to avoid harmful effects, their first 1000 items are
binary operations. In this paper, we need to use DNA XOR deleted. Use X and Y to generate Z . And it is treated by
operation, which is represented by symbol,as shown the following calculation formula respectively,
in Table II.
X = { xi 8 i = 1, 2,..., M N }
TABLE II. DNA XOR OPERATION RULE Y = {( yi 105 ) mod 256 i = 1, 2,..., M N } (8)
XOR A G C T Z = {( xi + yi ) / 2 8 i = 1, 2,..., M N }
A A G C T
where the symbol i means rounding up, mod means
G G A T C
modular operation.
C C T A G
T T C G A B. Bit plane separation
The scrambling-diffusion structure is widely used as
III. ENCRYPTION ALGORITHM DESCRIPTION the classical structure of image encryption algorithm.
In the proposed algorithm, by improving the two- Scrambling is to change the position of the pixels to make
dimensional chaotic map and making use of the inherent plaintext image illegible to resist attacks. Diffusion means
excellent characteristics of DNA, we can combine the two changing the pixel value of an image so that changes in one
and give full play to their greater advantages. Two pseudo- pixel affect as many other pixels as possible. Many existing
random sequences X and Y are generated iteratively by scrambling algorithms sort an unordered random sequence
using 2D chaotic maps of Eq. (4). After the pseudo- into an ordered sequence, and then rearrange the pixels
random sequences are processed, they are used in the according to the position mapping of the elements in the
encryption algorithm. Firstly, the image is divided into 8- two sequences. In this paper, we use bit level operation to
bit planes by bit level operation, and the bit plane is transform the image operation from pixel level to bit level.
divided into 2 modules by the strategy of odd even Using bit level operation not only changes the position of
separation. Then, different DNA coding rules are used to the pixel, but also changes the value of the pixel. At the
encode them, and the diffusion operation is carried out. In same time, it achieves the effect of scrambling and
the coding process, we use a very flexible DNA coding diffusion, and improves the encryption efficiency.
method to process the sequences generated by chaotic
mapping and determine the DNA coding rules. The whole We divide the original plaintext image into 8-bit planes.
coding process is completely random. There is a huge gap between the image information
contained in the high four bits of the bit plane and the image
information contained in the low four bits. In short, the high
A. Generation and Processing of Chaotic Sequences 4-bit plane contains more than 94% of the pixel information.
SHA256 algorithm is used to generate 256-bit hash For this reason, we adopt a parity separation strategy to
value according to the original image. A group of 8 bits is divide the bit plane into two modules, so that the pixel
used as the encryption key, and a total of 32 groups are used content of the two planes is roughly equal. In this paper, a
as the encryption key. pixel information is divided into two 4-bit data, two pixels
K n = kn,1kn,2 kn,3 kn,4 kn,5 kn,6 kn,7 kn,8
are separated into two 8-bit data, and then the two 8-bit data
(5) are recombined into a pixel, and so on, the same operation
K = K1 K 2 ...K 32 is done for the whole image. An image is separated into two
Then, the initial values of the chaotic map and the sub images, and the pixels of the reconstructed sub image
intermediate variables of the parameters are calculated are changed. We use the bit level parity separation strategy
according to the following Eq. (6) to change the image pixel position and pixel value at the
same time. The randomness of the algorithm is greatly
8( j −1)
K3i −1 + (3i − 1) 16 K j 2 improved. Fig. 2 is a schematic diagram of bit plane
ti = (li + ) mod1, i = 1, 2,3 (6)
K3i + 3i j =1 2256 separation. The specific operations are as follows:
where li (i = 1, 2,3) represent the 0 , x0 , y0 . Substituting Step 1: We assume that the size of the original image
ti (i = 1, 2,3) into the Eq. (7) to get , x , y . P is M N , and divide P into 8-bit planes
P7 P6 P5 P4 P3 P2 P1 P0 .
= (t1 mod1) 2.25
Step 2: Separate the odd index plane P7 P5 P3 P1 from the
x = (t2 mod1) / 2 + 0.5 (7)
y = (t mod1) / 2 + 0.5 even index plane P6 P4 P2 P0 .
3
Step 3: The 4-bit planes of the odd index are merged
Taking h = 12 , use as parameters, x and y as into O , and the 4-bit planes of the even index are merged
initial values, and use I2D-SLM to iterate 1000 + M N into E
968
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on February 21,2025 at 08:02:24 UTC from IEEE Xplore. Restrictions apply.
Fig. 2. The schematic diagram of bit plane separation
969
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on February 21,2025 at 08:02:24 UTC from IEEE Xplore. Restrictions apply.
difference between the original image and the decrypted
IV. EXPERIMENTAL RESULTS AND SAFETY ANALYSIS image, indicating that no data has been lost by this
Simulations are performed on Matlab2016b, using the algorithm.
algorithm presented in this paper for grayscale images are
encrypted and decrypted. Table III is the initial key given TABLE III. ENCRYPTION KEY
by us, which encrypts the test image, while the decryption
algorithm is the inverse of the encryption algorithm. Fig. Key 0 x0 y0
4(a), Fig. 4(b) and Fig. 4(c) are experimental result. From
the experimental results, it can be seen that there is little key0 2.4516 0.4369 0.7578
Fig. 4. (a) Peppers image; (b) Encrypted Peppers image; (c) Decrypted Peppers image; (d) Histogram of Peppers plaintext image; (e) Histogram of
Peppers ciphertext image
970
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on February 21,2025 at 08:02:24 UTC from IEEE Xplore. Restrictions apply.
space is 1042 , which is much larger than 2100 . It has shown in Table V, compared with the methods in Ref. [10]
enough security and can effectively resist violent attacks. and Ref. [12], this algorithm has higher information
entropy.
C. Differential attack
A secure image encryption algorithm has strong TABLE V. INFORMATION ENTROPY ANALYSIS RESULTS
resistance to differential attacks, which is usually measured Methods Image Size Information entropy
using NPCR and UACI. The specific method is to encrypt
the plain text image, then arbitrarily change one pixel of the Plain image 256 256 7.45539
plain text image to encrypt, and get two encrypted images,
Proposed 256 256 7.99783
and compare the differences between the two images. For
example, the pixel of plaintext image pepper at point (1,1) Ref. [12] 256 256 7.99730
is 238, we modify it to 100, encrypt the modified
Pepper.jpg and the modified Pepper.jpg respectively, and Ref. [10] 256 256 7.99681
calculate the NPCR and UACI by using Eq. (15) and Eq.
(17). E. Correlation analysis
1 H W Because there is a high correlation between a pixel
NPCR =
W H
D(i, j ) 100% (15) information and the surrounding pixels, the leakage of one
i =0 j =0 pixel information will lead to the leakage of other
0, if C1(i, j ) = C 2(i, j ) surrounding pixel information. In order to improve the
D(i, j ) = (16) security of image encryption algorithms, the correlation
1, if C1(i, j ) C 2(i, j ) should be minimized. This paper randomly selects 5000
H W C1(i, j ) − C 2(i, j ) pairs of adjacent pixels from the original and encrypted
1
UACI =
W H
i =0 j =0 255
100% (17) images to test image correlation.
N
1
where C1 , C 2 is respectively the encrypted and the D( x) =
N
(x
i =1
i − E ( xi )) 2 (19)
modified encrypted graph, W and H represent the width N
1
and height of the plaintext image, and C (i, j ) is the pixel E ( x) =
N
x
i =1
i (20)
at the C coordinates of the encrypted graph (i, j ) .When
N
1
the NPCR and UACI are 99.6094% and 33.4635%
respectively, the results are ideal. Table IV shows the test
cov( x, y ) =
N
(x
i =1
i − E ( xi ))( yi − E ( yi )) (21)
results, our algorithm can make the NPCR and UACI of cov( x, y )
ciphertext image close to the ideal value, which means that rxy = (22)
a small change of a pixel value in plaintext image will lead D( x) D( y )
to different ciphertext images.
where x and y represent the gray values of two adjacent
pixels in the image. D( x) , E ( x) and cov( x, y) are
TABLE IV. NPCR AND UACI VALUES
respectively the variance, mean and covariance. Fig. 5
Methods Image Size NPCR UACI shows that the original image is linearly densely
256 256 distributed in three directions. From Fig. 6, it can be seen
Proposed 0.99613 0.33565
that the random and discrete distribution of the encrypted
Ref. [12] 256 256 0.99656 0.33596 image is irregular throughout the plane. Table VI more
directly reflects this phenomenon. The correlation of the
Ref. [10] 256 256 0.99624 0.33524 three original images is close to 1, while the correlation of
the three images after encryption is close to 0 in the three
D. Information entropy directions. This shows that the algorithm reduces the
Shannon's information entropy is used to measure the correlation between pixels to a large extent. It provides a
uncertainty of image information. The information guarantee for the security of the algorithm. Table VI is a
entropy H is defined by comparison with Ref. [10] and Ref. [12], which shows that
our algorithm has better effect.
L
1
H = p(i) log (18)
i =0 p(i) TABLE VI. CORRELATION COEFFICIENT OF PEPPERS WITH
DIFFERENT ALGORITHM
where L is the number of gray levels of the image, p(i )
Direction Horizontal Vertical Diagonal
is the probability of gray value i . The entropy of
information is close to 8, which indicates that the more Plain image 0.9641 0.9515 0.9187
random the image is caused by encryption algorithm. As Proposed -0.0113 0.0084 0.0044
971
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on February 21,2025 at 08:02:24 UTC from IEEE Xplore. Restrictions apply.
Ref. [10] 0.0074 0.0059 -0.0007 [3] Hua Zhongyun, Zhou Yicong, Pun Chi-Man. 2D Sine Logistic
modulation map for image encryption[J]. Information Sciences,
Ref. [12] 0.0181 0.0016 0.0021 2015, 297: 80-94.
[4] Wang Chenqi, Zhang Xiao, Zheng Zhiming. An efficient image
encryption algorithm based on a novel chaotic map[J]. Multimedia
Tools and Applications, 2017, 76 (22): 24251-24280
V. CONCLUSIONS [5] Shen Qian, Liu Wenbo. A novel digital image encryption algorithm
based on orbit variation of phase diagram[J]. International Journal
In this paper, a 2D chaotic map with good pseudo- of Bifurcation and Chaos, 2017, 27(13): 1750204.
randomness and large parameter range is obtained by [6] Chanil Pak, Kwangil An, Paeksan Jang. A novel bit-level color
improving Sine map and Logistic map. Through the image encryption using improved 1D chaotic map[J]. Multimedia
combination of chaotic mapping and DNA coding, a Tools and Applications, 2019, 78(9): 12027-12042.
secure and reliable image encryption algorithm is designed. [7] Zhou Yicong, Bao Long, C.L. Chilip Chen. A new 1D chaotic
system for image encryption[J]. Signal Processing. 2014, 97: 172-
Firstly, the image is divided into 8-bit planes by bit level 182.
operation, and the bit plane is divided into 2 modules by [8] Wu Yue, Yang Gelan, Jin Huixia. Image encryption using two-
the strategy of odd even separation. Then, different DNA dimensional logistic chaotic map[J]. Journal of Electronic Imaging.
coding rules are used to encode them, and the diffusion 2012, 21 (1): 013014.
operation is carried out. We also do some verification [9] Hua Zhongyun, Jin Fan, Xu Binxuan. 2D Logistic-Sine-coupling
experiments to prove our algorithm, and compare with map for image encryption [J]. Signal Processing, 2018, 149: 148-
other algorithms. The experiments show that our algorithm 161.
have some merits. [10] Joshua C.Dagadu, Jian-Ping Li, Prince C.Addo. An image
cryptosystem based on pseudorandomly enhanced chaotic DNA
and random permutation[J]. Multimedia Tools and Applications.
REFERENCES 2019, 78(17):24979-25000.
[1] Hua Zhongyun, Zhou Yicong, Hua Hejiao. Cosine-transform-based [11] Wang Xingyuan, Liu Chuanming. A novel and effective image
chaotic system for image encryption[J]. Information Sciences, 2019, encryption algorithm based on chaos and DNA encoding[J].
480: 403-419. Multimedia Tools and Applications, 2017, 76 (5):6229-6245.
[2] Zhang Guoji, Liu Qing. A novel image encryption method based on [12] Zheng Jiming, Luo Zheng, Zeng Qingxia. An efficient image
total shuffling scheme[j]. Optics Communications, 2011, 284(12): encryption algorithm based on multi chaotic system and random
2775-2780. DAN coding[J]. Multimedia Tools and Applications, 2020, 79(39-
40): 29901-29921.
972
Authorized licensed use limited to: ANNA UNIVERSITY. Downloaded on February 21,2025 at 08:02:24 UTC from IEEE Xplore. Restrictions apply.