1 Introduction

Security of image data transmitted over public network is a major challenge due to the risk of eavesdropping. Since image is large in size and it has special storage format, traditional encryption techniques like RSA, DES, AES and IDEA are not suitable options for image data encryption due to their increased computation. Encryption of image should be faster to meet the real time constraint. Various encryption techniques have been introduced by the research community for image data which are faster and secure in nature.

Chaotic maps are nonlinear and deterministic. They are very sensitive to the input parameters and a slight change in these parameters results an entirely different output in the chaotic maps [10]. A number of image encryption algorithms using chaotic maps have been proposed in literature. Bourbaki’s et al.[2] suggested an encryption technique using SCAN patterns that encrypts as well as compresses an image simultaneously. N. Pareek et al [16] used a one dimensional chaotic logistic map for image encryption. They used 8 different encryption/decryption operations depending on the output of the logistic map whereas Schwinger [18] proposed a chaotic Kolmogorov flow based encryption technique where entire image is treated as a single block and it is permuted with the help of key based chaotic system. To increase the key space size, multidimensional chaotic maps have also been used. Fridrich [5] used two dimensional standard baker map to generate symmetric block encryption of image. Authors in [15][3] generalized a two dimensional chaotic maps to three dimensional for real time secure image encryption. They utilized this three dimensional chaotic map to scramble the position of pixels and to confuse the correlation among the encrypted and original image. A. Jain et al. [8] suggested a two layered chaotic image encryption in which the first layer creates diffusion and the second layer creates substitution and authors claimed the proposed technique to be more secure in terms of known plain text attack. Y. Wang et al. [21] proposed a faster image encryption technique in which an image is partitioned in to a number of block and these blocks are shuffled though a chaotic sequence. At the same time, content of the block is also modified.

With the introduction of DNA computing which supports high parallelism and huge information density, DNA cryptography is born which is used for image data encryption. Gehani at el. [6] used DNA strands to introduce one time pad image cryptography which is effective but incorporates complex biological operations. Authors in [11] suggested an image encryption approach in which the secret key is generated using input image and a common key. Pixels in an image are DNA encoded and each nucleotide in DNA encoded image is transformed to its base pair for random number of times with the help of DNA complementary rule. Q. Zhang at el. [24][23] used the concept of pseudo DNA sequence to transform the image and suggested image encryption techniques using hyper chaotic map and DNA addition operation. A. Jain at el. [9] used replication property of DNA alongwith DNA addition and complement rules for image encryption. Initial conditions of chaotic map are generated using 72-bit external key and authors claimed for larger key space. Authors in [19] proposed an image encryption technique using block shuffling and chaotic map. They randomly permuted overlapping image blocks as first level of encryption and used a secret key generated with the help of a chaotic map to perform xor operations with the image blocks and randomly selected secret key blocks for second level of encryption. Authors claimed for a larger Kay space and low computation cost.

Q. Zhang at el.[25] proposed an image encryption algorithm based on DNA encoding and two chaotic maps. They first transformed the image pixels using DNA sequence and divided the transformed image into some equal blocks. These blocks are DNA added with the help of a two dimensional chaotic map and finally the complement process is applied on the result with the help of a binary matrix generated by a one dimensional chaotic map. However, this technique has severe drawbacks as analyzed by H. Hermia’s at el. [7]. They found this encryption approach as non-invertible and prone to known plain text attack. Later, authors in [25] modified their work and proposed an invertible technique for GB image encryption by modifying the DNA addition in [12] which was again cryptanalyst by A. Belazi at el. [1] and subsequently by Y. Liu at el. [14] and though it was found to be invertible but still vulnerable to known plain text attack. Authors in [14] also analyzed it for the encryption results in terms of key and image sensitivity and found that it is not sensitive to changes in them. Further, it can be observed that this technique is not suitable for gray image cryptography.

In this paper, the image encryption technique proposed in [25] (referred as original encryption scheme hereafter) has been modified and a new encryption scheme is proposed which is not only invertible but it can resist the plain text attack also. The paper is organized as follows. In Section 2, a brief introduction to chaotic maps, DNA encoding and DNA operations used in this paper are given. Section 3 describes the proposed image encryption technique which is followed by its advantages over the original encryption scheme in Section 4. Experimental results and analysis is performed in Section 5 and paper is concluded in Section 6.

2 Chaotic maps, DNA encoding and DNA operations

2.1 Chaotic maps

The proposed image encryption technique uses two logistic maps - 1D logistic map and 2D logistic map as given in the following (1) and (2) respectively [13].

$$ X_{n+1} = rX_{n}(1 - X_{n}) $$
(1)

It has been found that for the values of parameter r in the range 3.057 to 4, outcome of (1) is highly chaotic in nature.

$$\begin{array}{@{}rcl@{}} X_{n+1} & = & r_{1}X_{n}(1 - X_{n}) + s_{1}{Y_{n}^{2}} \\ Y_{n+1} & = & r_{2}Y_{n}(1 - Y_{n}) + s_{2}({X_{n}^{2}} + X_{n}Y_{n}) \end{array} $$
(2)

where r 1, r 2, s 1 and s 2 are parameters to control the chaotic behavior of logistic map in (2). When 2.75<r 1≤3.4, 2.75<r 2≤3.45, 0.15<s 1≤0.21 and 0.13<s 2≤0.15, (2) generates chaotic sequence in the range of [0,1]. Values of parameters s 1ands 2 have been set as 0.17 and 0.14 for the experimental results in this paper.

2.2 DNA encoding and decoding

There are four nucleic acid bases A, C, G and T used in a DNA sequence in which A is complement to T and C is complement to G. Two bit binary sequences 00, 01, 10 and 11 are used to represent them. As bit 0 is complement to bit 1, binary sequence 00 is treated as complement to 11 and 01 to 10. Therefore, one way to encode 00, 01, 10 and 11 using DNA bases is C, A, T and G respectively. Using this encoding, if the grey scale value of an image pixel is 135, its binary value 10000111 can be DNA encoded as TCAG from which pixel value can be obtained back through DNA decoding by replacing DNA bases with their binary sequences. Figure 1 shows the flowcharts of DNA encoding and decoding processes used in this paper.

Fig. 1
figure 1

Flowchart of (a) DNA encoding (b) DNA decoding

2.3 DNA addition, subtraction and complement operations

Addition and subtraction operations of DNA bases are shown in Table 1 and Table 2 respectively.

Table 1 Addition operation of DNA sequences
Table 2 Subtraction operation of DNA sequences

Each DNA sequence base m i ∈(A,C,G,T) satisfies the following rule for complementary operation as suggested in [11] -

$$\begin{array}{@{}rcl@{}} m_{i} \not=BP(m_{i})\not=BP(BP(m_{i}))\not=BP(BP(BP(m_{i}))) \\ m_{i} = BP(BP(BP(BP(m_{i})))) \end{array} $$
(3)

where B P(m i ) is the base pair of m i which is different from m i in at least one bit position. There are total 6 group complementary rules (AT)(TC)(CG)(GA), (AT)(TG)(GC)(CA), (AC)(CT)(TG)(GA), (AC)(CG)(GT)(TA),(AG)(GT)(TC)(CA) and (AG)(GC)(CT)(TA). Any one of them can be applied though group complementary rule (AT)(TC)(CG)(GA) has been chosen in the proposed technique. In this complementary rule, T is the base pair of A, C is the base pair of T, G is the base pair of C and A is the base pair of G.

3 Proposed image encryption technique

The block diagram of the proposed image encryption algorithm in shown in Fig. 2.

Fig. 2
figure 2

Block diagram of the proposed image encryption algorithm

3.1 Generation of secret key

Secret key for an image is generated using the method suggested in [4]. Two initial values x 1andy 1 have been chosen to compute x 0andy 0 as follows -

$$\begin{array}{@{}rcl@{}} x_{0} & = & (\frac { mod ({\sum}_{i=1}^{m/2} p_{ij},256) } {256} + x_{1} )mod 1 \\ y_{0} & = & (\frac { mod ({\sum}_{i=m/2+1}^{m} p_{ij},256) } {256} + y_{1} )mod 1 \end{array} $$
(4)

where p i j is the pixel value of 8-bit input image of size m×n. These values of x 0, and y 0 along with two different values of system parameter r (r 3 and r 4 ) are used to generate chaotic sequences with the help of 1D logistic map given in (1) whereas x 0,y 0,r 1 and r 2 are chosen as parameters for 2D logistic map given in (2). Therefore, these parameters (x 1,y 1,r 1,r 2,r 3,r 4) work as secret key for the proposed image encryption method.

3.2 Image encryption using DNA sequence

  1. 1.

    In the input image B of size m×n, perform DNA encoding on the binary representation of each pixel as shown in Fig. 1 to obtain DNA encoded matrix Bb of size m×4n.

  2. 2.

    Generate a chaotic sequence C s e q =(c 1,c 2,.............c m n ) of length m×n under initial condition x 0 and r 3 using (1). Convert each value of c i ,1≤im n into its binary form, extract 8 most significant bits and encode them using DNA encoding. Arrange all the values in a matrix mask form M of size m×4n. A flowchart for the generation of mask matrix M is shown in Fig. 3.

  3. 3.

    Perform DNA addition using mask matrix M and matrix Bb to generate matrix Temp of size m×4n.

  4. 4.

    Two chaotic sequences z 1 and z 2 are produced by using two 1D logistic maps given in (1) with initial conditions (x 0,r 3) and (y 0,r 4) whose lengths are m and 4n respectively. Reconstruct z 1 and z 2 as two matrices Z 1(m,1) and Z 2(1,4n). Multiply Z 1 and Z 2 to obtain matrix Z of size m×4n. Map the values z of Z into (0,1,2,3) using the following function f(x) to get a complementary matrix -

    $$ \text{f(x)} = \left\{ \begin{array}{rl} 0, & 0<z\leq0.25 \\ 1, & 0.25<z\leq0.50 \\ 2, & 0.5<z\leq0.75 \\ 3, & 0.75<z\leq1 \end{array} \right. $$
    (5)
  5. 5.

    Use DNA complementary rule as suggested in Section 2.3 to complement matrix Temp obtained in step 3. Therefore, coefficient Temp(i,j) of matrix Temp is complemented as in (6) based on the value of z(i,j) of matrix Z.

    $$ Temp(i,j)= \left\{ \begin{array}{rl} comp_{0}(Temp(i,j)) & if \text{ }z(i,j) = 0 \\ comp_{1}(Temp(i,j)) & if \text{ }z(i,j) = 1 \\ comp_{2}(Temp(i,j)) & if \text{ }z(i,j) = 2 \\ comp_{3}(Temp(i,j)) & if \text{ }z(i,j) = 3 \end{array} \right. $$
    (6)

    where c o m p 0(m)=m c o m p 1(m)=B(m) c o m p 2(m)=B(B(m)) c o m p 3(m)=B(B(B(m))). Complemented Temp matrix is represented as Bcomp of size (m, 4n).

  6. 6.

    Divide Bcomp into equal size blocks Bcomp(i,j) of size 4×4 where \(1 \leq i \leq \frac {m}{4} \text { and } 1 \leq j \leq n\).

  7. 7.

    Generate two chaotic sequences X=(x 1,x 2,.............x m/4) and Y=(y 1,y 2,..........y n ) through 2D logistic map given in (2) under the initial values x 0 and y 0 and system parameters r 1,r 2,s 1 and s 2.

  8. 8.

    Sort sequences X and Y in the ascending order and the location of values in sort(X) and sort(Y) in original X and Y are used to generate new sequences X’ and Y’.

  9. 9.

    Let the values in X’ and Y’ represent the row and column coordinates used for shuffling the blocks of Bcomp. In other words, it can be expressed as Bcomp(\(x_{i}^{\prime },y_{j}^{\prime }\)) where \((x_{1}^{\prime }, x_{2}^{\prime },.....x_{m/4}^{\prime }) \text { and } (y_{1}^{\prime }, y_{2}^{\prime },....... y_{n}^{\prime })\) are location values in X’ and Y’. Shuffling of blocks is performed by interchanging blocks Bcomp(i,j) with Bcomp(\(x_{i}^{\prime },y_{j}^{\prime }\)).

  10. 10.

    Combine the new blocks to generate DNA cipher matrix D.

  11. 11.

    Convert matrix D back into decimal number using DNA decoding to get the the final cipher image.

Fig. 3
figure 3

Flowchart for generation of mask matrix

Decryption of the cipher image is parallel to the encryption process. At the receiver end, secret keys are obtained from sender and the coefficients of Bcomp matrix in step 5 are complemented using complement rules as suggested in [11]. DNA addition operation in step 3 is replaced by DNA subtraction operation with other steps kept unchanged.

4 Advantages of proposed image encryption

In Section 1, it has been pointed out that the original image encryption scheme suggested in [25] is found to be non-invertible and prone to known plain text attack by H.Hermassi at el. [25]. In this section, it is being proved that the proposed encryption technique is invertible and it can resist known plain text attack.

4.1 Invertibility

Following steps are used for decryption process -

  1. 1.

    Transform the cipher image of size m×n into DNA encoded matrix of size m×4n.

  2. 2.

    Divide the DNA encoded matrix into blocks of size 4×4 and perform the shuffle operation \(Block(i,j) \rightleftharpoons Block(x_{i}^{\prime },y_{j}^{\prime })\) where \(x_{i}^{\prime } \text { and } y_{j}^{\prime }\) are location values in sequences X’ and Y’ obtained in step 8 in encryption process. After combining all blocks, Bcomp matrix of size (m, 4n) is obtained.

  3. 3.

    Perform complement rule on the coefficients of Bcomp to obtain Temp matrix using complementary matrix Z(m, 4n).

  4. 4.

    Generate mask matrix M(m, 4n) as in step 2 of encryption process and obtain matrix Bb(m, 4n) using DNA subtraction as follows - Bb = Temp - M

  5. 5.

    Perform DNA decoding operations on Bb as shown in Fig. 1 to get back the original plain image.

Therefore, the proposed image encryption scheme is fully invertible in nature.

4.2 Robustness to known plain text attack

In the original encryption scheme, the complementary matrix is found to be recoverable using chosen plain text in which the known input image with all pixel intensities as zero is taken. Such input image is chosen to make it invariant to the DNA addition operation in the original image encryption technique. In the proposed method of this paper, since the chaotic sequence based masked image M is used for addition operation, one will get the masked image M after addition for input with all zero pixel values and M is unknown to attacker.

To further explain, consider the following example in which DNA encoded blocks of size 4×4 of input image P with all zero pixel values as well as mask M is taken.

$$P_{Block} = \left[ \begin{array}{cc cc} C & C & C & C \\ C & C & C & C \\ C & C & C & C \\ C & C & C & C \end{array} \right] $$
$$M_{Block} = \left[ \begin{array}{cccc} A & T & C & G \\ G & C & A & A \\ T & A & C & G \\ G & T & A & C \end{array} \right] $$

After addition operation, corresponding block of Temp matrix will be T e m p B l o c k =P B l o c k +M B l o c k , which is same as M B l o c k . Similar is the case for remaining blocks of Temp matrix and therefore after DNA addition, Temp matrix will be same as mask M.

Since there are 6 group complementary rules and any of them can be used to generate complement matrix, total possible number of complement matrices can be six as well. Further, Bcomp matrix in encryption process is divided into 4×4 blocks, there are total \(\frac {mn}{4}\) such blocks and these blocks are swapped using chaotic sequences. Hence, for a DNA encoded image of size m×4n, there are total \(\frac {mn}{4}\)! permutation of swapping. So to retrieve Temp matrix of step 3 in encryption process, it requires \(\frac {mn}{4}! \times 6\) operations provided we know the DNA encoding of image. In other words, for an input image of size 256×256, no. of operations required are (64×256)!×6.

Further, since the generation of complement matrix Z and sequences X and Y in Section 3.2 is input image dependent, their values will be different for different input images. Therefore, it is very difficult to hack the encryption information for an attacker using known plain text attack.

5 Experimental results and analysis

For experimental results, the image database of USC-SIPI (available at http://sipi/usc.edu/database/) maintained by University of South California has been used. Images of different content and size have been used in this paper. Values of parameters x 1,y 1,r 1,r 2,r 3 and r 4 have been chosen as 0.62, 0.12, 3.2, 3, 3.9 and 3.85 respectively as in the original paper. Performance evaluation of the proposed image encryption algorithm is done in terms of resistance to statistical attack using parameters like histogram analysis and correlation coefficient analysis and resistance to differential attack using parameters like number of pixel change rate (NPCR) and unified average changing intensity (UACI). Further, its performance has been compared with other encryption techniques with respect to the correlation coefficients between the plain and cipher images. Key sensitivity and key space analysis of the proposed technique has also been performed. In the last, proposed algorithm is analysed for entropy measurement and robustness in terms of attacks on encrypted images with other encryption techniques. Simulation work has been carried out on a computing device with intel core i3-370M processor with 2.4 GHz speed and 3MB L3 cache and 4GB RAM on MATLAB 7.4 using window-7 platform.

5.1 Histogram analysis

Histogram of an image represents the intensity distribution of pixels and it is used to identify the no. of pixels with same intensity value. Histogram of an encrypted image must be different from the histogram of the original image and it should have almost uniform distribution of pixel values.

Figure 4 shows the standard Lena image followed by its histogram in Fig. 5 whereas Fig. 6 shows the corresponding encrypted image and its histogram in Fig. 7. It can be seen that the distribution of pixels in the histogram of encrypted image is almost uniform and it is very different from the pixels distribution in the histogram of the original image. Moreover, the image information in Fig. 4 is not at all relevant with that of its encrypted version in Fig. 6.

Fig. 4
figure 4

Image before encryption

Fig. 5
figure 5

Histogram of the plain image

Fig. 6
figure 6

Image after encryption

Fig. 7
figure 7

Histogram of the encrypted image

5.2 Correlation coefficient analysis

Correlation coefficient between two images has been calculated using (7).

$$ Corr = \frac { N{\sum}_{i=1}^{N}(x_{i}\times y_{i}) - {\sum}_{i=1}^{N}x_{i}\times {\sum}_{i=1}^{N}y_{i} } { \sqrt { (N{\sum}_{i=1}^{N}{x_{i}^{2}} - ({\sum}_{i=1}^{N}x_{i})^{2})\times (N{\sum}_{i=1}^{N}{y_{i}^{2}} - ({\sum}_{i=1}^{N}y_{i})^{2}) } } $$
(7)

where x i and y i are the corresponding pixels in two images and N is the total number of pixels in the images used for computing correlation.

Figure 8 and Fig. 9 show the correlation of two horizontally adjacent pixels in original Lena image and its encrypted version. It can be seen that pixels are highly correlated in plain image whereas this correlation is drastically reduced in the encrypted image. Further, Fig. 10 and Fig. 11 show the correlation for the same image between vertically adjacent pixels and it can be observed that the correlation of pixel in Fig. 11 is very poor.

Fig. 8
figure 8

Correlation of horizontally adjacent pixels in plain image

Fig. 9
figure 9

Correlation of horizontally adjacent pixels in cipher image

Fig. 10
figure 10

Correlation of vertically adjacent pixels in plain image

Fig. 11
figure 11

Correlation of vertically adjacent pixels in cipher image

Table 3 shows the average correlation coefficient values (computed using horizontal, vertical and diagonal values) for input images, encrypted images using [19], [25] and the proposed encryption scheme. It can be seen that there is an average decrement of 54 % and 97 % in the value of correlation coefficients in the proposed technique than the suggested in [19] and [25] respectively.

Table 3 Average correlation coefficients of two adjacent pixels

5.3 Differential attack analysis

Proposed image encryption scheme has been analyzed for differential attack on Lena image using two parameters - number of pixel change rate (NPCR) and unified average changing intensity (UACI) which are defined for an image size of m×n using .(8) and (9) respectively.

$$\begin{array}{@{}rcl@{}} NPCR & = & \frac{{\sum}_{i=1}^{m} {\sum}_{j=1}^{n} g(i,j)}{m \times n} \end{array} $$
(8)
$$\begin{array}{@{}rcl@{}} UACI & = & \frac{{\sum}_{i=1}^{m} {\sum}_{j=1}^{n}|I_{1}(i,j) - I_{2}(i,j)|} {255\times m \times n} \end{array} $$
(9)

where g(i,j) in (8) is

$$ g(i,j)= \left\{ \begin{array}{rl} 0, & if \text{ }I_{1}(i,j) = I_{2}(i,j) \\ 1, & if \text{ }I_{1}(i,j) \not= I_{2}(i,j) \end{array} \right. $$
(10)

and I 1 and I 2 denote the encrypted images of plain image before and after modification in plain image. For analysis, 1st pixel of input image has been changed to get the encrypted image I 2. In simulation, values of NPCR and UACI has been found to be 99.62% and 33.06% respectively.

5.4 Key sensitivity and key space analysis

The proposed image encryption scheme uses (x 1,y 1,r 1,r 2,r 3,r 4) as secret key and as discussed in the beginning of this section values of these parameters have been chosen as (0.62,0.12,3.2,3,3.9,3.85). After slightly changing the value of parameter x 1 to 0.620000000001 and keeping remaining parameters same, Fig. 12 shows the decrypted image of Fig. 4 using modified secret key and Fig. 13 shows its histogram. It can be seen that the decrypted image is entirely different from the original image and its histogram is almost uniformly distributed. Similarly, by changing other parameters of secret key it has been found that decrypted image is very different from the original one. It proves that proposed encryption technique is robust for exhaustive attack.

Fig. 12
figure 12

Image after decryption with secret key (0.620000000001,0.12,3.2,3,3.9,3.85)

Fig. 13
figure 13

Histogram of the decrypted image

Since there are six parameters used in secret key in the proposed image encryption scheme, if the precision of 10−12 is chosen for each parameter, the size of secret key space will be 1012×1012×1012×1012×1012×1012=1072 which is large enough for exhaustive attack. Further, if parameters s 1 and s 2 in (2) are also kept secret and a precision of 10−12 is used for them, then the key space will expand upto 1096.

5.5 Analysis of entropy

Entropy of a message is used to define the quantum of randomness present in that message [17]. For a message A, consisting of q symbols (a 0,a 1,..a i ,...a q−1) with the probability of occurrence of symbol a i as p i is defined as

$$ H(A) = -{\sum}_{i=1}^{q-1}p_{i}log_{2}p_{i} $$
(11)

For an 8-bit gray image, q = 256 and the permitted values of each symbol a i are 0 to 255. As can be seen from (11), maximum entropy of such an image will be 8 when all the pixels are equally distributed. Table 4 gives the comparative study of the entropy of encrypted images using [19], [25] and the proposed algorithm. It can be seen that values of entropies in the encrypted image using proposed technique is very close to the ideal entropy value 8.

Table 4 Entropy comparison of encrypted images among different encryption techniques

5.6 Robustness Analysis

Robustness analysis of image encryption techniques has been performed by using the encrypted image and attacking it through various operations and reconstructing the original image using respective image decryption techniques. For operations to attack the encrypted image, Gaussian white noise contamination, salt and paper noise contamination and block loss have been used. Standard lena image (512x512) is taken as input and noise contaminations on encrypted image are performed for different parameters. For block loss operation, randomly located blocks of size 20x20 are removed from the encrypted image. Table 5 shows the quantitative analysis of encryption techniques in terms of peak signal to noise ratio (PSNR) and structural similarity (SSIM) index. MATLAB code of SSIM index from [20] designed by Z.Wang at el. [22] has been used with its default parameters. Since image encryption technique in [25] is non invertible, it has not been used for robustness analysis.

Table 5 PSNR (dB) and SSIM index comparison of different encryption techniques

5.7 Computational cost

Computational cost of the proposed image encryption algorithm has been evaluated in terms of execution time measured in seconds. Table 6 shows the comparative study of execution time for the proposed technique with that of [19] and [25]. Though the time taken by the proposed algorithm is larger than those presented in [19] and [25] but it is very effective with reference to other parameters discussed above. Also with the development of DNA computers equipped with massive parallel computing, time taken for the proposed technique will be negligible.

Table 6 Performance comparison in terms of execution time (sec)

6 Conclusion

In this paper, a new image encryption scheme using DNA operations and chaotic maps has been proposed which is a modification of encryption technique proposed in [25]. It generates a mask matrix using 1D chaotic map which is DNA added with the DNA encoded input image and the intermediate result is complemented with the help of a complement matrix generated through two 1D chaotic maps and finally the result is permuted using a 2D chaotic map. Proposed technique is not only invertible but it is robust to various attacks like known plain text attack, statistical attacks and differential attacks.