Introduction

Currently, image processing has rapidly expanded. Commonly, 2D images are used to apply image processing techniques. These methods are used across a variety of fields, including image search results [1], object identification [2,3,4], image enhancement [5], and image encryption. Both colourful and grayscale images are subject to image encryption.

Recently, Deoxyribonucleic Acid (DNA) has been employed in cryptography because of its high information density, energy efficiency, and parallelization capability [6]. Therefore, the use of DNA-encoding in cryptography systems has grown. It has been massively useful for preserving the images so they can be perfectly retrieved, in addition to generating new cipher data that cannot be attacked easily.

DNA-encoding using one coding rule is the first and oldest type applied in cryptography. It has been applied in many encryption modes, such as the models in [7,8,9,10,11,12,13,14,15,16,17], which give the system a great amount of information and a huge number of parallelisms while consuming less power. Nonetheless, using one coding rule allows the rule to be predicted easily, and the original image can be recovered.

This shortening is overcome by introducing dynamic DNA coding, in which the image is DNA-encoded using a different number of coding rules. The coding rules can be applied in different ways, including one for each block in the image [18, 19], one for each row in the block [20], one for each pixel [10, 21,22,23], and one for every two bits of the image [24].

The main challenge is raising the sensitivity of the key and enhancing the encryption layers in the cryptography domain by applying dynamic DNA coding. In this paper, we overcome this challenge by applying dynamic DNA coding to the model proposed in [7]. In the proposed model, dynamic DNA coding is applied, where the model generates a sequence of coding rules using the Lorenz–Liu chaotic system. The sequence contains one coding rule for every two bits of the image. After that, the sequence is used to create a DNA-encoded image. The same sequence is then used for DNA decoding of the image.

To evaluate the efficiency of the model, twelve evaluation metrics are employed on ten popular gray-scale images. The comprehensive evaluation covers five aspects: key analysis, differential attacks analysis, robustness analysis, statistical attacks analysis, and computational complexity analysis. The evaluation metrics are the key space, key sensitivity, number of pixels change rate (NPCR), unified average changing intensity (UACI), mean square error (MSE), peak signal-to-noise ratio (PSNR), histogram analysis, information entropy, chi-square test (χ2 test), irregular deviation (ID), correlation coefficient adjacent (CCA), and computational complexity.

The experimental results of the proposed model demonstrate encouraging performance improvements. The key became a wider space and being more sensitive to little changes. The results of NPCR and UACI express the high sensitivity of the model to minor changes in the input images, leading to the generation of completely different cipher images. Regarding MSE and PSNR results, the proposed model contains various encryption layers that perform wider distances between the original image and the cipher image. The color intensity distribution of the encrypted image is much more uniform, as proven by histogram analysis in addition to the results of X2 and ID. The proposed model implies great randomness in the images demonstrated in information entropy and CCA. The contributions to this work are:

  • Introducing a model based on integrating dynamic DNA-coding techniques with the image encryption model.

  • The proposed model expands the key space and improves key sensitivity while also enhancing the security of the encryption layers.

  • A comprehensive assessment of the proposed model on ten popular images using twelve evaluation metrics.

The paper is structured as follows: the related dynamic DNA-coding models and differences between them are represented in the next section. The following section describes DNA sequences and dynamic DNA coding in addition to the Liu chaotic system and how it is intercepted in the Lorenz–Liu chaotic system. Next section introduces the proposed model. In the following section, the performance measures of the proposed model and its results are presented. Finally, the conclusion of the work and the future directions are expressed in the last section.

Related work

Dynamic DNA coding has been applied in many representations: a coding rule for the image, a coding rule for each block in the image, a coding rule for each row in blocks of the image, a coding rule for each pixel, and a coding rule for every two bits in the image. In this section, these representations are addressed along with how they were used in recent models, with a focus on their strengths and weaknesses.

A coding rule for the image

Signing et al. [16] proposed a model in 2021. The model is joint-based on pseudo-random and sophisticated hyperchaotic behaviour along with DNA-encoding. First, the secret key is obtained using the hyperchaotic system, and the image is exposed to bit-by-bit shuffling. Next, the image is binarized and DNA-encoded using the encoding rule. Finally, the encoded sequence is provided to DNA operations, complemented, and DNA-decoded. The encrypted image is generated from the resulting binary sequence. The model has a large key space and is sensitive to small changes. However, it implies low resistance to differential attacks.

A coding rule for each block in the image

In 2021, Mohamed et al. [19] introduced a new model based on Choquet fuzzy integral (CFI) and dynamic DNA coding. First, the original image is split into four parts. CFI is then applied, and the four S-boxes are generated. Each box is binarized and DNA-encoded with its coding rule generated by the M sequence. Finally, down-sampling is applied to the DNA boxes, which are diffused using Chen’s hyperchaotic map sequences, and the sequences are decoded to get a cipher image. The model implies high randomness for the images and is sensitive to the image and key, but with a small key space.

Another model was introduced in 2022 by Wang et al. [18] which applies Zigzag scrambling besides dynamic DNA coding relying on random blocks and the logistic–dynamics-coupled map lattice (LDCML). Using SHA-512, the key is generated. Then, the image is scrambled and split into blocks, then inter-scrambled. Afterward, according to a sequence generated by LDCML, each block is DNA-encoded by a coding rule. Finally, DNA operations are performed, the sequence is decoded, obtaining the cipher image. The model has a wide key space and is overly sensitive to image changes. On the other hand, the model is less robust to differential and robustness attacks.

A coding rule for each row in the image

Bao et al. [20] introduced an encryption model in 2022 that combines compressive sensing and DNA coding. The model begins with creating a key measurement matrix and applying SHA-256 to the image to get the hash sequence. Next, the image is split into four blocks, to which inter-scrambling is applied. Afterward, each block is binarized, and each row in it is DNA-encoded with its coding rule. In the end, the DNA addition operation is applied to the DNA blocks, which are DNA-decoded, recombined, and sorted to obtain a cipher image. The model is sensitive to tiny changes in the original image and the key. Meanwhile, it has a small key space, implies less randomness in the images, and is less robust to differential attacks.

A coding rule for each pixel in the image

Li et al. [23] introduced a new model depending on the memcapacitor chaotic system and DNA coding. First, the key is generated by SHA-3 for the image, where every eight pixels are used as the chaotic system’s initial values. Following that, the image is binarized, forming a matrix, and each pixel in the matrix is DNA-encoded with its coding rule. Finally, the chaotic sequence is used for scrambling the DNA-encoded matrix, which is then decoded and converted to decimals, obtaining a cipher image. The model has a large key space in addition to its sensitivity to key and image changes. However, it is less robust to statistical attacks.

Zhu et al. [22] proposed another model depending on the 5D continuous hyperchaotic system and DNA coding. First, the chaotic system generates a chaotic sequence in addition to the coding rules, and the original image is permuted using the chaotic sequence. Then, the image is binarized, forming a matrix, where each pixel is DNA-encoded with its coding rule, DNA complemented, and DNA-decoded. In the end, the decoded matrix is diffused, obtaining the cipher image. The model implies great randomness in the images. Yet, it is less robust to differential attacks, has a small key space, and is less sensitive to tiny changes in the key and images.

Tian et al. [10] proposed a model relying on dynamic DNA coding and piecewise linear chaotic map-based coupled map lattices (SPWLCM map-based CML). The chaotic sequences are obtained using CML, which is then used to generate DNA-encoding rules in addition to DNA-decoding rules. The original image is scrambled and diffused with the chaotic sequences, and it is binarized. Then, relying on the encoding rule for each pixel, the image is DNA-encoded and permuted. At the end, the DNA-encoded image is decoded, converted to decimals, and diffused to obtain a cipher image. The model is sensitive to small changes and implies high randomness in the images. However, it is less robust to differential attacks and has a small key space.

Zhang et al. [21] introduced a model relying on the sine-piecewise linear chaotic map (SPWLCM) and DNA coding. To begin, SPWLCM generates key and coding rules. Then, the image is shuffled and binarized, forming a matrix. Next, each pixel in the matrix is DNA-encoded using its own coding rule. Finally, the DNA encryption algorithm is applied to the encoded matrix. The matrix is decoded and converted to decimals, obtaining the cipher image. The model is sensitive to minor changes and implies high randomness in the images. On the other hand, it has a small key space and less protection for differential attacks.

A coding rule for each two bits in the image

Wang et al. [24] introduced a new model that depends on random embedding and DNA coding. The 4D memristive hyperchaotic system creates the control parameters, whereas the image is preprocessed based on random number embedding. Following that, the coding rules are obtained using the 4D memristive hyperchaotic system. Afterward, the image is binarized, and each two bits in the image is encoded using its coding rule. At the end, the image is scrambled and diffused, and then DNA operations are applied to it before it is decoded and converted to decimals to obtain the cipher image. The model has a wide key space, which is sensitive to minor changes and implies high randomness to the images. Nonetheless, it is less robust to differential attacks.

Table 1 lists the models that employ the previous dynamic DNA-coding techniques, along with their benefits and drawbacks. The conducted comparison highlights significant findings. First, the randomness of generating the encrypted images is outstanding in the case of applying DNA-encoding using a coding rule for each pixel technique and a coding rule for each two bits technique. It is noted that the key space and its sensitivity depend on the algorithm used in the key generation. On the other hand, the robustness of the model to statistical and differential attacks relies on the encryption model. The differential attacks are found to be the biggest challenge for the researchers.

Table 1 Dynamic DNA-coding techniques

Fundamental knowledge (preliminaries)

This section presents a detailed description of the DNA sequences, the application of dynamic DNA coding, the Lorenz–Liu chaotic system, and the Liu chaotic system.

DNA sequence

DNA, or Deoxyribonucleic acid, is a biological macromolecule that carries hereditary genetic information about living organisms [25]. It consists of nucleic acid bases bonded to form two strands using phosphodiester bonds. These strands are linked with hydrogen bonds, forming a helix structure. There are four kinds of bases: adenine (A), thymine (T), cytosine (C), and guanine (G). A and T are bonded together using two hydrogen bonds; therefore, they are purines. Meanwhile, C and G are bonded together using three hydrogen bonds, since they are pyrimidines [7]. DNA has recently been used in cryptography for its high information density, its energy efficiency, and its parallelization capability [6].

Dynamic DNA coding

Data can be encoded into a DNA sequence using its binary representation, since each base is represented by two bits. There are eight effective DNA rules that can be achieved based on Watson and Crick’s complementary model: purines and pyrimidines. These rules are listed in Table 2 [7].

Table 2 Rules for DNA encoding

The dynamic DNA-coding technique encodes each pixel into a DNA sequence of four bases. Each two bits in one pixel is DNA-encoded using chosen coding rules [26]. For example, if pixel x contains a value equal to 125, its binary representation is “01111101”. Assuming the chosen coding rules for the pixel are {3, 4, 5, 8}, then the DNA-encoded sequence is “GAGA”. The decoding operation will be based on the chosen coding rules.

Lorenz–Liu chaotic system (LLCS)

The Lorenz–Liu chaotic system (LLCS) is constructed by considering the Liu chaotic system state variables as the Lorenz chaotic system parameters. The generated system is described in Eqs. (13) [26]:

$$ l_{1} \left( {1, i + 1} \right) = \left( {r_{1} + \lambda m_{1} \left( {1,i} \right)} \right)\left( {l_{2} \left( {1, i} \right) - l_{1} \left( {1, i} \right)} \right) $$
(1)
$$ l_{2} \left( {1, i + 1} \right) = (s_{1 + } \lambda m_{2} \left( {1, i} \right))l_{1} \left( {1,i} \right) - l_{1} \left( {1,i} \right)l_{3} \left( {1,i} \right) - l_{2} \left( {1,i} \right)\hfill \\ $$
(2)
$$ l_{3} \left( {1, i + 1} \right) = l_{1} \left( {1,i} \right)l_{2} \left( {1,i} \right) - (t_{1} + \lambda m_{3} \left( {1, i} \right)) $$
(3)

where \(l_{1}\), \(l_{2}\), and \(l_{3}\) are stateful variables; \(r_{1}\), \(s_{1}\), and \(t_{1}\) are the parameters of the system with values r1 = 10, s1 = 28, and t1 = 8/3 [26]; \(m_{1}\), \(m_{2}\), and \(m_{3}\) are the disturbances of the system parameter provided by the Liu chaotic system; and \(\lambda\) is the LLCS disturbance intensity. The LLCS is provided to mod 1000.

Liu chaotic system (LCS)

The Liu chaotic system (LCS) is a system that reveals properties of Lyapunov exponents, Poincare mapping, fractal dimension, continuous spectrum, and chaotic behaviours. It can be described in Eqs. (46) [26, 27]:

$$ m_{1} \left( {1, i + 1} \right) = r_{2} \left( {m_{2} \left( {1, i} \right) - m_{1} \left( {1, i} \right)} \right) $$
(4)
$$ m_{2} \left( {1, i + 1} \right) = s_{2} m_{1} \left( {1, i} \right) - um_{1} \left( {1,i} \right)m_{3} \left( {1,i} \right) $$
(5)
$$ m_{3} \left( {1, i + 1} \right) = - t_{2} m_{3} \left( {1, i} \right) - vm_{1} \left( {1,i} \right)^{2} $$
(6)

where \(m_{1}\), \(m_{2}\), and \(m_{3}\) are the stateful variables; and \(r_{2}\), \(s_{2}\)\(t_{2}\), \(u\), and \(v\) are the system parameters with values r2 = 10, s2 = 40, t2 = 2.5, u = 1, and v = 4 [26]. The LCS is provided to mod 1000.

Proposed model

This section describes in detail the proposed model, its components, the encryption, and decryption schemes. The model in [7] generates a key through the incorporation of the MD5 and SHA-256 hash algorithms. With the aid of a memristor hyperchaotic system, it produces four matrices. Once the key was generated, Arnold's transform is applied to the original image. Five chaotic maps are then used to scramble the image. The image is then DNA encoded, followed by being diffused using three of the four matrices generated using the hyperchaotic system, and finally DNA decoded. This model is adapted as follows:

Proposed encryption model

The proposed encryption model applied to the M × N grayscale image is described in Fig. 1. It consists of the following steps:

Fig. 1
figure 1

Proposed encryption model

Step 1: 256-bit Hash value generation. MD5 hash function is applied to the original image and its metadata, where the generated 128-bit hash values are concatenated and provided to SHA-256, generating a 256-bit hash value H:

$$ H \, = \, \left[ {h_{1} , \, h_{2} , \, \ldots , \, h_{64} } \right] $$

Step 2: Generation of parameters. The image is split into four parts. The average of each part and H are applied to equations in model [7] resulting in the Arnold Transform parameters a, b, and c; and Hyper-Chaos system initial values w0, x0, y0, and z0. The values of Liu chaotic system parameters are r2 = 10, s2 = 40, t2 = 2.5, u = 1, and v = 4. Meanwhile, the values of Lorenz–Liu chaotic system parameters are r1 = 10, s1 = 28, and t1 = 8/3.

Step 3: Calculate initial values of LLCS. The initial values of LCS are calculated, as shown in Eqs. (79):

$$ m_{1} = \left( {h_{1} \oplus h_{2} \oplus \ldots \oplus h_{10} } \right)/256 $$
(7)
$$ m_{2} = \left( {h_{11} \oplus h_{12} \oplus \ldots \oplus h_{20} } \right)/256 $$
(8)
$$ m_{3} = \left( {h_{21} \oplus h_{22} \oplus \ldots \oplus h_{32} } \right)/256 $$
(9)

Meanwhile, the initial values of LLCS are obtained by Eqs. (1012):

$$ l_{1} = \left( {h_{1} + h_{2} + \ldots + h_{10} } \right)/\left( {10*max\left( {h_{1} ,h_{2} , \ldots ,h_{10} } \right)} \right) $$
(10)
$$ l_{2} = \left( {h_{11} + h_{12} + \ldots + h_{20} } \right)/\left( {10*max\left( {h_{11} ,h_{12} , \ldots ,h_{20} } \right)} \right) $$
(11)
$$ l_{3} = \left( {h_{21} + h_{22} + \ldots + h_{32} } \right)/\left( {12*max\left( {h_{21} ,h_{22} , \ldots ,h_{32} } \right)} \right) $$
(12)

\(\lambda\) is calculated by Eq. (13):

$$ \lambda = mod\left( {\left( {l_{1} + l_{2} + l_{3} + m_{1} + m_{2} + m_{3} } \right)/6,0.02} \right) $$
(13)

The secret key is {a, b, c, w0, x0, y0, z0, r2, s2, t2, u, v, r1, s1, t1, \(\lambda\), m1, m2, m3, l1, l2, l3}, which are obtained in steps 2 and 3.

Step 4: Image transformation using Arnold transform. The image is provided to Arnold Transform using a, b, and c to obtain scrambled image I1.

Step 5: Get coding rules using the Lorenz–Liu chaotic system. LLCS is iterated using the parameters and initial values, creating three sequences: L1, L2, and L3. Equation (14) is applied to generate the coding rules for the chaotic sequence CR:

$$ {\text{CR}} = {\text{mod}}\left( {{\text{floor}}\left( {{\text{abs}}\left( {L_{1} } \right) \times 10^{3} } \right),8} \right) + 1. $$
(14)

Step 6: Hyper-chaos sequence generation. Memristor HCS is applied to initial values w0, x0, y0, and z0 to obtain four chaotic sequences, W, X, Y, and Z, which are applied to equations in model [7] resulting in three M × N sequences, Y2, Z2, and W2.

Step 7: Encryption using chaotic maps. I1 is provided to sequences of five XOR operations within five chaotic maps, where the sequence of maps is Tent, Logistic, Piecewise, Gauss, and Henon maps: yielding I2.

Step 8: Dynamic DNA coding of the image. I2, W2, Y2, and Z2 are binarized and DNA-encoded using the CR sequence to determine the coding rule for each two bits, creating 4 × M × N DNA sequences: I2, W2, Y2, and Z2.

Step 9: Applying DNA operations. I2 and Y2 are provided to the XOR operation, resulting in I3. Then, Z2 is added to I3 to generate I4 which is then sorted based on W2 to achieve I5.

Step 10: Dynamic DNA decoding. I5 is DNA-decoded using CR and converted from binary to decimal, achieving cipher image C.

Proposed decryption model

The decryption model depends on the opposite operations applied in the encryption model. The HCS is applied on w0, x0, y0, and z0 creating chaotic sequences W, Y, and Z. Next, the CR sequence is achieved by applying LLCS on l1, l2, l3, m1, m2, m3, r1, r2, s1, s2, t1, t2, u, v, and \(\lambda\). Afterward, the encrypted image C, in addition to W, Y, and Z, are DNA-encoded using CR. The created DNA sequences, I5, W2, Y2, and Z2, are supplied to inverse DNA operations: I5 is inverse-sorted based on W2 yielding I4, Z2 is subtracted from I4 generating I3 which is provided with Y2 to the XOR operation to obtain I2. Then, I2 is DNA-decoded. Finally, XOR operations are applied to I2 and the inverse sequence of chaotic maps, and the resulting matrix I2 is provided to the Arnold Transform, obtaining the original image I.

Experimental evaluation

The model is implemented on a 64-bit machine with an Intel® Core™ i7-4500U CPU @ 1.80 GHz processor and 8 GB RAM in MATLAB R2021b platform on the Windows 10 operating system. The data set, the evaluation metrics, the evaluation results, and their interpretation are described in the following subsections:

Data set

The data set used for assessing the model holds the most popular ten 256 × 256 Gy-scale images: Cameraman, Lena, Baboon, House, Peppers, Barbara, QR code, Couple, White, and Black [12, 14, 16, 18,19,20,21, 24].

Experimental results

The experimental evaluation metrics are divided into five main categories: key analysis, differential attacks analysis, robustness analysis, statistical attacks analysis, and computational complexity analysis. Table 3 lists some of the comprehensive evaluation results of the proposed model. The following subsections describe the evaluation metrics in detail.

Table 3 Experimental results of the proposed model

Key analysis

The strength of the key is one of the main purposes of encryption models. Therefore, the encryption model should have a strong key that is robust to attacks. The strength of the key is measured by the key space and its sensitivity to minor changes.


Key space analysis: The key space is calculated based on the number of variables and their probabilities, and its value should exceed 2100 [17, 28]. In the proposed model, the key contains 2256 × 2128 × 2 × 1014 × 4 of the parameters of the main module of [7]; the selected DNA-encoding rule for each two bits of the image (8 kinds); and the initial values in addition to the parameters of LCS and LLCS l1, l2, l3, m1, m2, m3, r1, r2, s1, s2, t1, t2, u, v, and \(\lambda\). Therefore, the key space is:

K = 2256 × 2128 × 2 × 1014 × 4 × 28 × 1015 × 15 = 21453, which is extremely higher than 2100. This value signifies that the secret key is particularly safe, because it makes it very difficult for attackers to guess the proper values.


Key sensitivity analysis: The key sensitivity affects the robustness to brute force attacks. It is detected by changing a tiny part of the key and testing the retrieved image [29]. Some variables: x0, y0, z0, w0, l1, l2, l3, m1, m2, m3, r1, r2, s1, s2, t1, t2, u, v and \(\lambda\) are altered by only the 10th digit before their decimal point by adding 10−10 to test key sensitivity on an image, for example, Lena image. The results on Lena image are shown in Figs. 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 and 20 for variables x0, y0, z0, w0, l1, l2, l3, m1, m2, m3, r1, r2, s1, s2, t1, t2, u, v and \(\lambda\). The results imply that the model is susceptible to these minor changes, leading to difficulty in predicting the image under different attacks.

Fig. 2
figure 2

Lena image histogram. a Original image, b cipher image, c restored image after x0 change, d histogram of original image, e histogram of cipher image, f histogram of restored image after x0 change

Fig. 3
figure 3

Lena image histogram. a Original image, b cipher image, c restored image after y0 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after y0 changed

Fig. 4
figure 4

Lena image histogram. a Original image, b cipher image, c restored image after z0 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after z0 changed

Fig. 5
figure 5

Lena image histogram. a Original image, b cipher image, c restored image after w0 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after w0 changed

Fig. 6
figure 6

Lena image histogram. a Original image, b cipher image, c restored image after l1 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after l1 changed

Fig. 7
figure 7

Lena image histogram. a Original image, b cipher image, c restored image after l2 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after l2 changed

Fig. 8
figure 8

Lena image histogram. a Original image, b cipher image, c restored image after l3 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after l3 changed

Fig. 9
figure 9

Lena image histogram. a Original image, b cipher image, c restored image after m1 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after m1 changed

Fig. 10
figure 10

Lena image histogram. a Original image, b cipher image, c restored image after m2 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after m2 changed

Fig. 11
figure 11

Lena image histogram. a Original image, b cipher image, c restored image after m3 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after m3 changed

Fig. 12
figure 12

Lena image histogram. a Original image, b cipher image, c restored image after r1 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after r1 changed

Fig. 13
figure 13

Lena image histogram. a Original image, b cipher image, c restored image after r2 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after r2 changed

Fig. 14
figure 14

Lena image histogram. a Original image, b cipher image, c restored image after s1 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after s1 changed

Fig. 15
figure 15

Lena image histogram. a Original image, b cipher image, c restored image after s2 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after s2 changed

Fig. 16
figure 16

Lena image histogram. a Original image, b cipher image, c restored image after t1 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after t1 changed

Fig. 17
figure 17

Lena image histogram. a Original image, b cipher image, c restored image after t2 changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after t2 changed

Fig. 18
figure 18

Lena image histogram. a Original image, b cipher image, c restored image after u changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after u changed

Fig. 19
figure 19

Lena image histogram. a Original image, b cipher image, c restored image after v changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after v changed

Fig. 20
figure 20

Lena image histogram. a Original image, b cipher image, c restored image after \({\varvec{\lambda}}\) changed, d histogram of original image, e histogram of cipher image, f histogram of restored image after \({\varvec{\lambda}}\) changed

Differential attack analysis

Differential attacks analysis tests determine the link between the original image and the cipher image by measuring the sensitivity of the model to the original image. The analysis is applied by assessing the number of pixels change rate (NPCR) and the unified average changing intensity (UACI) which are described as follows.


Number of pixel change rate (NPCR): It determines the rate of changing the value of cipher image pixels before and after changing one pixel of the original image. It is calculated using Eqs. (15), (16) [7, 14, 30]:

$$ {\text{NPCR}} = \mathop \sum \limits_{i, j} \frac{{D\left( {i, j} \right)}}{MN} \times 100\% $$
(15)
$$ D\left( {i, j} \right) = \left\{ {\begin{array}{*{20}l} {0\, if\, C_{1} \left( {i, j} \right) = C_{2} \left( {i, j} \right)} \\ {1\, if \,C_{1} \left( {i, j} \right) \ne C_{2} \left( {i, j} \right)} \\ \end{array} } \right., $$
(16)

where \(C_{1} \left( {i,{ }j} \right)\) and \(C_{2} \left( {i,{ }j} \right)\) are cipher image before and after one pixel changed. Moreover, the perfect value for NPCR is near 100% [31].

The proposed model results are compared to [16, 18,19,20,21, 24] results on Cameraman, Lena, Baboon, Peppers, White, and Black images in terms of NPCR in Table 4. The proposed model achieves higher results on Cameraman, Peppers, and White images with values of 99.64%, 99.63%, and 99.61%, respectively. On the other hand, the results are comparable to others on Lena, Baboon, and Black with values of 99.61%, 99.58%, and 99.56%, respectively. The proposed model is comparable to others with slightly higher performance.

Table 4 NPCR against other benchmark approaches

Unified average changing intensity (UACI): It detects the average of the distance intensity between the cipher image before and after changing one pixel in the original image. The UACI value is calculated by Eq. (17) [7, 14, 30]:

$$ {\text{UACI}} = \mathop \sum \limits_{i, j} \frac{{\left| {C_{1} \left( {i, j} \right) - C_{2} \left( {i, j} \right)} \right|}}{255 \times MN} \times 100\% , $$
(17)

where \(C_{1} \left( {i,{ }j} \right)\) and \(C_{2} \left( {i,{ }j} \right)\) are cipher image before and after changing one pixel. It is worth mentioning that the ideal value for UACI is near 33.33% [31].

With respect to UACI in Table 5, the proposed model results are compared to [16, 18,19,20,21, 24] results on Cameraman, Lena, Baboon, Peppers, White, and Black images. The proposed model surpasses the others on Cameraman, Lena, Peppers, and White images with values of 33.39%, 33.42%, 33.39%, and 33.4%, respectively. For Baboon and Black, the proposed model results are comparable to others with values of 33.48% and 33.44%, respectively. In general, the proposed model’s efficiency slightly surpasses the others in respect of UACI.

Table 5 UACI against other benchmark approaches

Robustness analysis

The robustness of the model is analysed by applying mean square error (MSE) and peak signal-to-noise ratio (PSNR) analysis.


Mean square error test (MSE): It describes the diffusion characteristics of the model. It is calculated using Eq. (18) [7, 11]:

$$ {\text{MSE}} = \frac{1}{MN} \mathop \sum \limits_{i = 1}^{M} \mathop \sum \limits_{j = 1}^{N} \left( {I\left( {i, j} \right) - C\left( {i, j} \right)} \right)^{2} , $$
(18)

where \(I\left( {i,{ }j} \right)\) and \(C\left( {i,{ }j} \right)\) are the values of pixel in the original and cipher images, respectively. The ideal value for MSE should be > 10,000 [13].

In terms of MSE, the proposed model results are compared to [18] on Cameraman, Lena, Baboon, Peppers, White, and Black images, as shown in Table 6. The model outperforms [18].

Table 6 MSE against other benchmark approaches

Peak signal-to-noise ratio (PSNR): It represents the peak of the error between the original and cipher images to describe the quality of the reconstruction of the image. It is calculated using Eq. (19) [11]:

$$ {\text{PSNR}} = 20 \log_{10} \left( {\frac{255}{{\sqrt {{\text{MSE}}} }}} \right). $$
(19)

The value of PSNR should be near 0 [11].

The proposed model results in Table 7 are compared to [18, 19] on Cameraman, Lena, Baboon, Peppers, White, and Black images regarding PSNR. The proposed model results surpass others on Cameraman, Lena, Peppers, White, and Black images with values of 6.1, 8.6, 7.4, 4.8, and 4.8. For the Baboon image, it is comparable to others with a minor difference of 0.3.

Table 7 PSNR against other benchmark approaches

Statistical attacks analysis

The model should be robust to the statistical characteristics of the original images. Therefore, statistical analysis should be applied to the proposed model, including histogram analysis, information entropy, chi-square χ2, irregular deviation ID, and correlation coefficient adjacent CCA.


Histogram analysis: It describes the allocation of the pixel intensity values. The even distribution of the histogram implies great hiding of the image [9]. The results of the histogram of the images are represented in Figs. 21, 22, 23, 24, 25, 26, 27, 28, 29 and 30.

Fig. 21
figure 21

Cameraman image histogram. a Original image, b cipher image, c restored image, d original image histogram, e cipher image histogram, f restored image histogram

Fig. 22
figure 22

Lena image histogram. a Original image, b cipher image, c restored image, d original image histogram, e cipher image histogram, f restored image histogram

Fig. 23
figure 23

Baboon image histogram. a Original image, b cipher image, c restored image, d original image histogram, e cipher image histogram, f restored image histogram

Fig. 24
figure 24

House image histogram. a Original image, b cipher image, c restored image, d original image histogram, e cipher image histogram, f restored image histogram

Fig. 25
figure 25

Peppers image histogram. a Original image, b cipher image, c restored image, d original image histogram, e cipher image histogram, f restored image histogram

Fig. 26
figure 26

Barbara image histogram. a Original image, b cipher image, c restored image, d original image histogram, e cipher image histogram, f restored image histogram

Fig. 27
figure 27

QR Code image histogram. a Original image, b cipher image, c restored image, d original image histogram, e cipher image histogram, f restored image histogram

Fig. 28
figure 28

Couple image histogram. a Original image, b cipher image, c restored image, d original image histogram, e cipher image histogram, f restored image histogram

Fig. 29
figure 29

White image histogram. a Original image, b cipher image, c restored image, d original image histogram, e cipher image histogram, f restored image histogram

Fig. 30
figure 30

Black image histogram. a Original image, b cipher image, c restored image, d original image histogram, e cipher image histogram, f restored image histogram


Information entropy: It measures the randomness of the images. It is calculated using Eq. (20) [32]:

$$ H = - \mathop \sum \limits_{i = 1}^{M} \mathop \sum \limits_{j = 1}^{N} \left. {\left( {p\left( {C\left( {i, j} \right)} \right) \times \log_{10} p\left( {C\left( {i, j} \right)} \right)} \right.} \right), $$
(20)

where \(C\left( {i,{ }j} \right)\) is the value of the pixel in the cipher image, \(p\left( {C\left( {i,{ }j} \right)} \right)\) is the occurrence probability of \(C\left( {i,{ }j} \right)\). The ideal value for information entropy should be near 8 [33].

Table 8 compares the proposed model results to [16, 18,19,20,21, 24] results on Cameraman, Lena, Baboon, Peppers, White, and Black images in respect of information entropy. The results of the proposed model outperform others in Baboon and White images with values of 7.9974 and 7.9973, respectively, while being comparable to others in Cameraman, Lena, Peppers, and Black images with values of 7.997, 7.9975, 7.9972, and 7.9974, respectively. To sum up, the proposed model implies comparable performance with the other approaches.

Table 8 Information entropy against other benchmark approaches

Chi-square test: The test quantitatively describes the distribution of the values of image pixels and justifies their uniformity. It is calculated using Eq. (21) [18, 19]:

$$ x^{2} = \mathop \sum \limits_{i = 0}^{255} \frac{{\left( {x_{i} - \overline{x}} \right)^{2} }}{{\overline{x}}}, $$
(21)

where \(x_{i}\) is the pixel value frequency, \(\overline{x}\) is the average of pixel value frequencies from 0 to 255.

χ2 test results are presented in Table 9. It is apparent that the values of the images are extremely high, ranging from 20,856 to 16,711,680. Yet, the values of encrypted images vary between 221 and 300, which implies a uniform distribution of pixel intensity when applying the proposed model.

Table 9 χ2 results

Irregular deviation: It detects the variation of image deviation from uniform distribution by calculating the pixel deviation before and after the encryption process. Equation (22) [7, 12] calculates ID:

$$ {\text{ID}} = \mathop \sum \limits_{i = 0}^{255} \left| {{\text{HD}}_{i} - {\text{MH}}} \right|, $$
(22)

where \({\text{HD}}_{i}\) is the histogram of the absolute values of the variation between the original image and the encrypted image, and MH is the HD average. The ideal value of ID should be the minimum to imply the uniformity of the histogram [34]. The results of the ID of the proposed model were shown earlier in Table 3.


Correlation coefficient adjacent (horizontal, vertical, diagonal): It calculates the similarity between each two adjacent pixels. It is calculated using Eq. (23) [35]:

$$ {\text{cc}} = \frac{{\left| {\mathop \sum \nolimits_{i = 1}^{M} \mathop \sum \nolimits_{j = 1}^{N} \left[ {C_{A1} \left( {i, j} \right) - \overline{{C_{A1} }} \left( {i, j} \right)} \right]\left[ {C_{A2} \left( {i, j} \right) - \overline{{C_{A2} }} \left( {i, j} \right)} \right]} \right|}}{{\sqrt {\mathop \sum \nolimits_{i = 1}^{M} \mathop \sum \nolimits_{j = 1}^{N} \left[ {C_{A1} \left( {i, j} \right) - \overline{{C_{A1} }} \left( {i, j} \right)} \right]^{2} } \sqrt {\mathop \sum \nolimits_{i = 1}^{M} \mathop \sum \nolimits_{j = 1}^{N} \left[ {C_{A2} \left( {i, j} \right) - \overline{{C_{A2} }} \left( {i, j} \right)} \right]^{2} } }}, $$
(23)

where \(C_{A1} \left( {i,{ }j} \right)\) and \(C_{A2} \left( {i,{ }j} \right)\) are gray-scale values of adjacent pixels, M and N are the image dimensions, \(\overline{{C_{A1} }} \left( {i, j} \right) = \mathop \sum \nolimits_{i = 1}^{M} \mathop \sum \nolimits_{j = 1}^{N} C_{A1} \left( {i, j} \right)/MN\) and \(\overline{{C_{A2} }} \left( {i,{ }j} \right) = \mathop \sum \nolimits_{i = 1}^{M} \mathop \sum \nolimits_{j = 1}^{N} C_{A2} \left( {i,{ }j} \right)/MN\). It is applied in horizontal, vertical, and diagonal directions. Its value for the original image should be near 100%, that for the encrypted image should be near 0%.

Regarding CCA, the proposed model results are compared to [16, 18,19,20,21, 24] results in Table 10 on Cameraman, Lena, Baboon, Peppers, White, and Black images. The results are comparable to others and tend to be zero [36]. To detect the improvement of the model, the average CCA is applied using Eq. (24) [14]:

$$ {\text{Correlation coefficient}} = \left( {\left| {{\text{HC}}} \right| + \left| {{\text{VC}}} \right| + \left| {{\text{DC}}} \right|} \right)/3, $$
(24)

where HC, VC, and DC are the correlation coefficient horizontally, vertically, and diagonally, respectively.

Table 10 CCA against other benchmark approaches

In Table 11, it is obvious that the proposed model results overcome the others on the Baboon image with a value of 0.0007 while being comparable to others on Cameraman, Lena, Peppers, White, and Black images with values of 0.0034, 0.0026, 0.0038, 0.0035, and 0.0042, respectively.

Table 11 CCA average against other benchmark approaches

Computational complexity analysis

Computational complexity measures the steps executed in the encryption model [15]. The computational complexity of the main module of [7] is O(M × N). The computational complexity of generating the sequence of coding rules is O(4 × M × N). Therefore, the proposed model’s computational complexity is O(M × N + 4 × M × N) ≈ O(M × N), which is linear and depends on the original image size.

Results interpretation

Evaluating the proposed model against recent models was challenging. Two main factors influenced the choice of the benchmark approaches. First is the evaluation metrics factor, where a minimum of four metrics should be used. The second factor is the number of images in the data set. Existing models were assessed using different numbers of images. Only one model [19] was applied to five images, one model [21] was applied to four images, one model [24] was applied to three images, whereas models [18, 20] were applied to two images, and one model [16] was applied to one image.

The models represent different techniques for dynamic DNA coding. The technique of a coding rule for the image is represented in [16], whereas the technique of a coding rule for each block in the image is represented in [18, 19]. Meanwhile, the technique of a coding rule for each row in block is represented in [20], the technique of a coding rule for each pixel is represented in [21], and the model of [24], in addition to the proposed model, represents the technique of a coding rule for every 2 bits of the image.

As shown in the experimental results section, the robustness of the model to statistical attacks depends on both the structure of the encryption model and the color intensity of different images. The diversity of the encryption layers and their number affect the distribution of the pixel values’ intensity in the encrypted image. This effect is demonstrated by information entropy and CCA. Moreover, the color distribution of the image has a great effect on its robustness to statistical attacks. By studying the histogram of the original images, the images with a more uniform distribution of the histogram perform better in terms of CCA, information entropy, and the X2 test. In contrast, by decreasing the uniformity of the histogram of the original images, the irregular deviation tends to the ideal value.

Also, the structure of the encryption model has a great impact on the generation of the encrypted image and its robustness for extracting the original image. Increasing the encryption layers with various properties and the applied technique of dynamic DNA coding led to the generation of an encrypted image with completely different pixel values. Some algorithms, such as shuffling algorithms [7, 14, 18, 20, 21, 24], change the position of the pixel value, which generates randomness in the image. Other algorithms [7, 10, 16, 19] change the value of the pixel, for example, addition, subtraction, and XOR operations. This effect is supported by the results of MSE and PSNR listed in Tables 6 and 7. Besides, the dynamic DNA-coding technique used also affected the results of MSE and PSNR. The technique increases the difference between the pixel values of the original image and the cipher image.

Furthermore, the layers of generation of the key affect the robustness of the model to differential attacks. These layers increase the level of security of the model, generating a more secure encrypted image. The sensitive algorithms used in key generation imply an effect on the security of the proposed model, which is proven by the results of NPCR and UACI in Tables 4 and 5. In addition to the proposed model, models in [16, 21] have an extremely sensitive algorithm for generating the key. These models imply superior performance in NPCR and UACI. The sensitivity of the key also supports this effect.

In general, the structure of the encryption model, the dynamic DNA-coding technique used, the sensitivity of the key generation, and the variation of the color intensity of the original images are cornerstones of the security of the proposed model. The results of the information entropy, CCA, and X2 test are affected by the image characteristics and encryption model. The encryption model also affects, in addition to the dynamic DNA-coding technique, the results of MSE and PSNR. The algorithms used in key generation and their sensitivity affect NPCR and UACI.

Conclusion

Dynamic DNA coding has recently been shown to have a crucial role in image encryption. It increases the randomness of the images and strengthens the model’s security. This study proposes a grayscale image encryption model with dynamic DNA coding. The original image and its metadata are hashed using the MD5 and SHA-256 procedures to generate a secret key. The image is then provided to the Arnold Transform method. The key is then assigned to HCS, which creates three chaotic sequences. The coding rules’ sequence is subsequently generated by LLCS using the key. The Arnold transform’s resulting image then gets dispersed outward using five chaotic maps. The last step in the process is to perform DNA operations using the chaotic sequences generated by HCS after DNA-encoding the resultant image using the coding rules sequence. The cipher image is then obtained by applying DNA-decoding to the image.

The model is assessed based on key analysis, differential attack analysis, robustness analysis, statistical attack analysis, and computational complexity analysis. Cameraman, Lena, Baboon, House, Peppers, Barbara, QR code, Couple, White, and Black were used as the ten prevalent images for the evaluation. Twelve metrics are used during the evaluation, including key space, key sensitivity, NPCR, UACI, MSE, PSNR, histogram, information entropy, χ2, ID, CCA, and computational complexity.

The proposed model’s key space is 21,453, and the results of the NPCR and UACI tests ranged between 99.56% and 99.64% and 33.39% and 33.48%, respectively. The results for MSE varied from 8579 to 21,774, while those for PSNR varied from 4.8 to 8.8. According to the results, the information entropy varied between 7.997 and 7.9976. The χ2 test had a range of 221 to 300, but the ID test had a range of 1 to 11,621 results. Between 0.0007 and 0.0042 were the results of the average CCA. The proposed model is O(4MN) in terms of complexity. In terms of NPCR, UACI, MSE, and PSNR, the model outperforms others. Information entropy and CCA are comparable to those of other models. The cipher image will be incorporated into a DNA sequence to strengthen the model's security, in addition to enhancing the runtime of the model in the future.