1 Introduction

This era is the most beneficent for the human beings in the sense of information. Few decades back, humans were not very involved in sharing their information, in such a fast and efficient way. However, security of this sharing is very important phase, as now a days, a lots of information travel through networks. As the evolvement of internet increase the use of computer network, the security of data became the essential focus of the user. Image data is one of the important data types exchanged in bulk by the user and, in some situations, it requires much focus to exchange securely. In era of current 21st, cryptographic algorithms for securing digital using chaotic systems have fascinated a lot of researchers [4, 7, 13, 15, 18, 21, 22, 27, 30, 33, 34, 43, 45, 46, 48] due to numerous imperative features, such as extremely sensitive dependence on initial conditions, pseudo randomness and ergodicity. The above discussed properties made chaotic system highly suitable candidate to build secure encryption schemes [15, 22, 27, 45].

Chaos based image encryption ciphers are proposed generally on Fridrich’s architecture proposed in 1998 [12] which consists of two phases; diffusion and confusion where each phase may have several rounds. The former phase also known as permutation which is used for disruption of the correlation among contiguous pixels of the digital images by exchanging pixel’s positions within the image. But this disruptions does not affect the frequencies of gray levels means histograms remains same. The 2nd phase of Fridrich’s architecture also called substitution that modifies the pixel intensities, which is a crucial procedure and cannot omitted but permutation can be omitted. This is the reason that security of chaos-based cryptosystems depend both on permutation and diffusion phases. Some of the chaos based image cryptosystems have been cryptanalyzed [20, 32] and shown that they are not secure enough to resist against some known attacks. Yen et al. [44] proposed HCIE scheme and Li et al. [19] cryptanalyzed this technique, and found a weakness that cipher-text only attack can be launched on HCIE. In 2017 Eric Y. Xie et al. [42] cracked Fridrich’s chaotic scheme for images. Chanil Pak’s introduced new Logistic-Logistic System, Sine-Sine System and proposed an image encryption scheme [30] which soon cryptanalyzed using chosen plaintext attack [37]. But these numbers are limited.

An efficient cipher to encrypt color images is introduced by B. Norouzi et al. [28] based on two hyper-chaotic systems. These chaotic systems were used to generate pseudo-random numbers to perform diffusion and confusion of R, G and B channels of the image simultaneously at pixel level. But permutation phase takes more time than the substitution phase, so the security of cipher does not compromise to run it faster without permutation. In Ref. [29] authors proposed a novel image cipher which utilized hash function and encryption solely depends only on substitution phase without permutation. The substitution phase consists of two-round; horizontal division of plain image and vertical division of plain image. In horizontal division, an array is generated consisting of 1024 segments sized 8 × 8, and, in vertical division transpose is applied on the array obtained in horizontal division.

Due to the properties of massive parallelism and astonishing material compactness, Deoxyribonucleic Acid (DNA) computing has arrived in the field of encryption for digital images [2, 8, 10, 11, 16, 17, 25, 31, 35, 36, 39, 40, 47]. To achieve encryption using concept of DNA, pseudo random numbers are transformed into DNA bases by employing DNA complementary rules. After that, DNA computations are achieved through biological operations for substitution. Usually, diffusion is followed to increase the safety of proposed cipher. There are eight different DNA rules for transforming digital data into DNA bases and back to digital format. The algebraic operations like additions, subtraction and Exclusive-OR are works on these DNA bases. X. Wei et al. [39] designed a cipher technique for color images using Deoxyribonucleic acid, addition operation on DNA bases by employing hyperchaotic system. J. Kalpana et al. [16] suggested three modifications in [39] to improve the randomness and better results. In Ref. [47], a new image encryption technique was proposed using DNA sequence operation and hyperchaotic system known to image fusion scheme. Soon it was cryptanalyzed by applying chosen plaintext attack and known plaintext attack [41]. Rehman et al. proposed modified dual fusion technique using SHA-256 to avoid chosen plaintext attack [2]. In 2014, Enayatifar et al. [10] proposed an encryption technique for images using hybrid model of Deoxyribonucleic acid (DNA) masking, based on a genetic algorithm and Logistic map. The same author Enayatifar et al. in [11], designed another novel image encryption technique based on hybrid model of the Tinkerbell chaotic map. X. Wu et al. [40] generated DNA matrices from 1D chaotic sequence and perform XOR operations between encoded plain image and DNA matrices. These DNA matrices are divided into blocks, permute these blocks randomly, and at last Exclusive-OR and addition operations are applied on DNA bases to achieve image encryption. The motivation of the proposed work is to overcome the limited use of DNA complementary rules which were focused only for transformation from digital to DNA [35, 40, 47] and as well as to resist plaintext attacks.

The proposed system has adopted a novel diffusion/confusion approach called Dual Diffusion/Confusion to achieve encryption for three channels of a color image. A SHA-256 hash function is used to modify the initial conditions and to avoid chosen-plaintext attack. The permutation phase consists of two sub phases; called Inter-channel and Intra-channel permutation that applied on the rows and the columns of each channel respectively using 2-Dimensional chaotic maps. The recently proposed [2] DNA encoding and decoding mechanism is adopted to encode every pixel with different DNA rules selected chaotically. The novel Dual confusion phase is accomplished by simple DNA diffusion and Exclusive OR operation on each block/group of the color image. The simple diffusion during confusion phase is processed by randomly selecting DS-boxes and in 2nd confusion, DNA complementary rules are selected chaotically to perform exclusive-OR operation on groups of color image. The proposed scheme has a clear advantage over other encryption techniques that it has nice feature to resist transmission noise, occlusion attack and other impairments.

This paper is organized as follows; in the first two sections, preliminary work is discussed and in section 3 encryption scheme will be introduced. Simulation results and security analysis are presented in section 4 and conclusion is left to the final section of the article.

2 Related work

2.1 2D logistic map

In encryption technique, 2-Dimensional coupled Logistic map [24] is utilized for diffusion and confusion which is as follows,

$$ {\displaystyle \begin{array}{ll}{u}_{n+1}& ={\mu}_1{u}_n\left(1-{u}_n\right)+{\gamma}_1{u}_n\kern5em \\ {}{v}_{n+1}& ={\mu}_2{v}_n\left(1-{v}_n\right)+{\gamma}_2\left({u}_n^2+{u}_n{v}_n\right)\end{array}} $$
(2.1)

The above system of equation is chaotic when 2.75 < μ1 < 3.4, 2.7 < μ2 < 3.45, 0.15 < γ1 < 0.21 and 0.13 < γ2 < 0.15 to generate pseudo-random numbers w and x in the interval (0, 1). The Eq. (2.1) is iterated 4MN times using seed and parameters as: μ0 = 0.256789, v0 = 0.854321, μ1 = μ2 = 3.12 and γ1 < 0.19, γ2 < 0.14. Both sequences u and v have poor distribution, auto-correlation and cross-correlation features [1]. The average values of two sequences are 0.6534 and 0.6554 but Ref. [1] suggested following processing to incorporate better uniform distribution,

$$ {\displaystyle \begin{array}{l}{u}_i={10}^6\times floor\left({10}^6\left({u}_i\right)\right)\\ {}{v}_i={10}^6\times floor\left({10}^6\left({v}_i\right)\right)\end{array}} $$
(2.2)

The mean value of u is 0.5013 and mean of v is 0.5006, which are almost close to the ideal mean of 0.5 and can be employed in a cryptographic algorithm.

2.2 DNA coding and complementary rules and algebraic operations

Deoxyribonucleic Acid (DNA) is a biological material found in almost all living beings. It is responsible to transmit parental features into child and also known. In humans, it exists in twisted ladder like structure where DNA bases A, G, C and T are paired. These bases are Adenine (A), Cytosine (C), Guanine (G) and Thymine (T). In 1953, Watson and Crick published article in Nature which defines principle of complementary base pairing [38] and also known as complementary rule. According to complementary rule, DNA bases in each pair must complement to each other like A and T are complementary, C and G are complementary. The binary number system consists of two numbers only; 0 and 1 which are opposite to each other or complementary. In the same way, 00 and 11 are complementary, while 01 and 10 are also complementary. The above discussed four bases A, C, G and T are used to symbolize the binary sequence 00, 11, 10 and 01. There are total twenty-four kinds of DNA transforming rules, however, only eight kinds of them meet the Watson–Crick complementary rule, shown in Table 1. A digital image has pixels of intensities ranging from 0 to 255, so to represent 8-bit pixel intensity value into DNA domain that requires only four DNA bases. For example, if a pixel intensity has a value of 93, its binary value will be “01 01 11 01”. The DNA transformed value of 93 depends on the selection of a DNA rule, it will become “AACA” if DNA encoding rule 5 is used as presented in Table 1. To obtain the same intensity value of 93 by using same DNA rule 5 to transform “AACA” into digital format. However, if we select another DNA rule like Rule 1 then “AACA” will be ‘00 00 01 00’ and pixel’s intensity value will be 2. This is DNA encoding/decoding method.

Table 1 Eight kinds of DNA mapping rules

A. Rehman2016 [2] proposed a new way where eight DNA rules which are separated into encoding and decoding groups at pixel level and has better results. There are some algebraic operations are introduced for DNA bases like addition (+), subtraction (−) and Exclusive or (XOR). Only XOR is highlighted in Table 2 that would be applied in proposed scheme.

Table 2 XOR operations for DNA Bases

3 Proposed scheme

3.1 Initial conditions for chaotic maps

SHA-2 family of hash algorithms has more complex structure than MD5 and MD4, hence more secured. A SHA-256 generates a digest of 256-bits regardless of the size of the input. If there is one bit difference between two inputs, their message digest will be completely different [14]. So, this is used to generate digest of the color image to which encryption is to be done. The message digest is splits into blocks of bits and then convert it into a floating decimal number keyjϵ(0, 0.0156) by Eq. (3.1):

$$ {key}_j= hex2 dec\left({k}_i.\dots {k}_n\right)/{2}^{50} $$
(3.1)

Where {j = 1,…,4}, {i = 1,2,….,44} and k represents the bits of message digest and the last two keys are generated using 40 bits each as follows

$$ {\displaystyle \begin{array}{l}{key}_5= hex2 dec\left({k}_{177}.\dots {k}_{216}\right)/{2}^{46}\\ {}{key}_6= hex2 dec\left({k}_{217}.\dots {k}_{256}\right)/{2}^{46}\end{array}} $$
(3.2)

Now, let denote the six common secret input as a0, b0, e0, d0, x0, y0 then on another key is calculated as

$$ key={u}_0+{v}_0+{e}_0+{d}_0+{x}_0+{y}_0\kern0.75em \operatorname{mod}\ 1 $$
(3.3)

Suppose, u0, v0 are initial conditions for 2D logistic map to generate two U and V sequences for intra-channel permutations for diffusion and confusion phases then new seeds are as follows;

$$ \left\{\begin{array}{l}{u}_0^{\prime }={u}_0+{key}_1+ key\\ {}{v}_0^{\prime }={v}_0+{key}_2+ key\end{array}\right.\kern0.5em \operatorname{mod}\ 1 $$
(3.4)

There is requirement of two more pseudo-random arrays for encoding and decoding of Red, Green and Blue channels of an image. The initial conditions e0 and d0 are used to generate pseudo -random arrays called E and D Then new seed can be designed as follows;

$$ \left\{\begin{array}{l}{e}_0^{\prime }={e}_0+{key}_3+ key\\ {}{d}_0^{\prime }={d}_0+{key}_4+ key\end{array}\right.\kern0.5em \operatorname{mod}\ 1 $$
(3.5)

Two more arrays of deterministic pseudo-random numbers are required; one for inter-channel permutation of pixels of Red, Green and Blue channels and other to select DNA Rules for Exclusive-OR operation during confusion phase which can be symbolized as x0, y0 and new seed are as follows:

$$ \left\{\begin{array}{l}{x}_0^{\prime }={x}_0+{key}_5+ key\\ {}{y}_0^{\prime }={y}_0+{key}_6+ key\end{array}\right.\kern0.5em \operatorname{mod}\ 1 $$
(3.6)

The dependence of keys on plain image make sure to change for every input, hence more secure [32].

3.2 Diffusion

The color image consists of three matrices called Red, Blue and Green channel. To encrypt all the three channels, 2-dimensional Logistic map is used to generate pseudo-random numbers for permutation. For encryption, 24-bit gray image I(M × N × 3) is used as an input, compute hash value and modify common initial conditions as described in section 3.1. The permutation can be explained as:

  1. Step 1:

    For permutation, iterate 2D Logistic map using seed \( {u}_0^{\prime } \) and \( {v}_0^{\prime } \) up to 4MN times to produce vector U and V. To normalize U with respect to the set {0, 1, 2, 3, 4, 5}, we use the following operation,

$$ U={}_{i=1}{}^{4 MN}\left[\left(U\times {10}^{14}\right) \operatorname {mod}\ 6\right] $$
(3.7)

Now, construct a vector λ using U of dimension 1 × (M + N) such that

$$ \lambda {=}_{k=4 MN-\left(M+N\right)+1}^{4 MN}\left[U(k)\right] $$
(3.8)

Split λ into U1 and U2 sub arrays of size 1× M and 1 × N respectively. These arrays are used for inter-permutation of the rows and columns of matrices R, G and B on which image I is based.

$$ {U}_1=\left\{{\lambda}_1,{\lambda}_2,\cdots, {\lambda}_M\right\}\kern0.5em {U}_2=\left\{{\lambda}_{M+1},{\lambda}_{M+2},\cdots, {\lambda}_{MN}\right\} $$
(3.9)

However, U1 and U2 can be possible representation of sub-arrays and are used to select permutations set called DC_SETS in Table 4. These randomly selected DC_SETS will decide which rows/columns of matrices are interchanged. As an example, if permutation (213) is selected in the beginning of diffusion then 1st row of Green matrix is exchanged with 1st row of Red channel while 1st row of Blue matrix will remain unchanged.

  1. Step 2:

    Now, U1 and is used to select random inter-channel permutations called DC_SETS as according to Table 4 to exchange the rows of RED, GREEN and BLUE channels of an image I using Algorithm 1. After row permutation, U2 is used to exchange columns of I using Algorithm 2 as described below.

figure c
figure d
  1. Step 3:

    For 2nd phase of diffusion called intra-permutation, above said 2D Logistic map iterated 3MN times using seed \( {x}_0^{\prime } \) and \( {y}_0^{\prime } \) to get two vectors X and Y. The X is split into three non-overlapped equal sized sub-vectors called X1, X2 and X3. The permuted image I is split into three channel of one dimensional array called red, green and blue, sort X1, X2, X3 and record their index as,

$$ {\displaystyle \begin{array}{l}\left[{V}_1,{Idx}_1\right]=\mathrm{sort}\left({X}_1\right)\ \\ {}\left[{V}_2,{Idx}_2\right]=\mathrm{sort}\left({X}_2\right)\ \\ {}\left[{V}_3,{Idx}_3\right]=\mathrm{sort}\left({X}_3\right)\end{array}} $$
(3.10)

where [•,•] = sort(•) is the sequencing index function, V1 is the new sequence after sorting in ascending order, Idx1is the index value of V1. After this, re-arrange/diffuse the elements of red, green and blue channels as given;

$$ {\displaystyle \begin{array}{l} re{d}^{\prime }= red\ \left({Idx}_1\right)\\ {} gree{n}^{\prime }= green\ \left({Idx}_2\right)\\ {} blu{e}^{\prime }= blue\ \left({Idx}_3\right)\end{array}} $$
(3.11)

3.3 DNA encoding

Encoding of an image into DNA bases is simple as discussed in [2] using Table 3 but with little difference. In A. Rehman2016 [2], a new DNA model is used for encoding two key images while decoding is done in conventional way. The encoding of Red, Green and Blue channels is completed using 1st four DNA rules and other four rules are reserved for decoding. For DNA encoding, two more chaotic sequences E and D of size 3MN are generated using new secret keys shown in Eq. (3.5). The elements of E are divided into three equal sized sub-vectors called E1, E2 and E3 where each having size of MN. Now, DNA encoding is applied on each channel independently using chaotic sequence for the selection of DNA rules as given in Table 3.

$$ {\displaystyle \begin{array}{l}R\_ DNA= Encode\left( re{d}^{\prime },{E}_1\right)\\ {}G\_ DNA= Encode\left( gree{n}^{\prime },{E}_2\right)\\ {}B\_ DNA= Encode\left( blu{e}^{\prime },{E}_3\right)\end{array}} $$
(3.12)
Table 3 DNA complementary rules for plain image and key image [2]

In this way, each color channel is transformed into 1 × 4MN array and then matrix of size 3 × 4MN is built called IMAGE in which each row represents a colored channel of DNA encoded RGB image.

$$ IMAGE= cat\left(R\_ DNA,G\_ DNA,B\_ DNA\right) $$
(3.13)

3.4 Novel confusion

Before going into detail of novel confusion phase, algorithm requires two pseudo-random sequences to accomplish dual confusion,

  1. Step 1:

    Now, two pseudo-random sequences V and Y of sizes 4MN and 3MN, which were generated in step 1 and 3 at diffusion phase, remain unused. The vector V is processed into floating point values set {0, 1, 2, 3, 4, 5} and Y into another set {0, 1, 2, 3, 4, 5, 6, 7} called V and Y shown in Eq. (3.14).

$$ {\displaystyle \begin{array}{l}{V}^{\prime }=\left(V(i)\times 1{0}^{12}\right) \operatorname {mod}\ 6\\ {}{Y}^{\prime }=\left(Y(i)\times 1{0}^{12}\right) \operatorname {mod}\ 8\end{array}} $$
(3.14)
  1. Step 2:

    The matrix called IMAGE is divided into sequential blocks bi of size 3 × 1 as shown in Eq. (3.15). Each block bi consists of three DNA bases, one from each channel, hence total b4MN blocks will be formed.

$$ b=\left({b}_i,{b}_{i+1},\dots, {b}_{i+\frac{IMAGE}{3\times 1}}\right) $$
(3.15)
  1. Step 3:

    The 1st confusion phase is accomplished by applying permutation on each block of image IMAGE. For this, chaotic sequence V′ is used to select DC_SETS according to Table 4 for each block bi of size 3 × 1 and exchange DNA bases as follows,

Table 4 Combination for Inter-diffusion/Confusion for encryption
$$ {\displaystyle \begin{array}{l}S= DC\_ SETS\left({V}^{\prime }(i)\right)\\ {}{b}_i^{\prime}\left(1,1\right)={b}_i\left(S(1),1\right)\\ {}{b}_i^{\prime}\left(2,1\right)={b}_i\left(S(2),1\right)\\ {}{b}_i^{\prime}\left(3,1\right)={b}_i\left(S(3),1\right)\end{array}} $$
(3.16)

The Eq. (3.16) is used to permute the DNA bases of all 4MN blocks where i = 1, 2,….,4MN. This permutation is called the Intra-Channel permutation and it will modify intensities at 2-bits level in each color channel. This is first phase of confusion.

  1. Step 4:

    In the next phase of confusion, matrix of size 3 × 4MN in which each row represents a colored channel is transformed into one vector of size 1 × 12MN. This 1D array is split into groups; each having four DNA bases representing a pixel as shown in Fig. 1. These groups are then substituted using Exclusive – OR operation with chaotically selected DNA rules using random sequence Y according to Table 4,

Fig. 1
figure 1

Splitting of large array into groups of 4 DNA bases each

$$ {\displaystyle \begin{array}{l} Rule= DNA\_ RULES\left({Y}^{\prime }(i)\right)\\ {}{g}^{\prime }(i)=g(i)\oplus Rule\end{array}}\kern0.5em \mathrm{where}\ i=1,2,3\dots .3 MN $$
(3.17)

3.5 DNA decoding

The substituted groups \( {g}_i^{\prime } \) for each colored channel are decoded back to digital format by selecting DNA rules randomly according to Table 4. The pseudo-random array D of size 3MN is used for selecting DNA Rules randomly shown in Eq. (3.18). This array produced during encoding process was still free to use. After this, encrypted image is split into three equal size arrays; representing a color channel,

$$ Cipher(i)= Decode\left({g}_i^{\prime }(i),D(i)\right) $$
(3.18)

At last Cipher image is split into three 2D-matrices representing Red, Green and Blue channels of encrypted image.

3.6 Illustration of confusion

A 3 × 4MN matrix is achieved after permutation shown in Fig. 2 in which each row is representing color channel and it is divided into 3 × 1 sized blocks bi + 1, bi + 2 and so on. Each block consists of three DNA bases, one from each channel.

Fig. 2
figure 2

Blocks bi of color image after DNA encoding

The first block b1 can be presented as {A, G, C}, b2 is {C, T, A}, b3 is {T, A, A} and fourth block b4 is {T, C, T} as shown in Fig. 2. Suppose Y = {0, 3, 5, 2} then DC_SETS {[1 2 3], [2 1 3], [3 2 1], [2 3 1]} will be selected for inter-channel permutation. The DNA bases of blocks b1, b2, b3 and b4 are scrambled according to DC_SETS into new orders {A, G, C}, {T, C, A}, {A, A, T} and {C, T, T} which is actually confusion and new blocks look like as shown in Fig. 3. In next phase of confusion, these blocks are combined as 3 × 4MN matrix and then transformed into 1 × 12MN. This vector is divided into groups of four DNA bases each. Suppose, V = {7, 1, 0, 4} then DNA rules {‘TCGA’, ACGT’ and ‘AGCT’, ‘GTAC’} are selected to Exclusive-ORed with groups g1, g2, g3, g4 shown in Fig. 4. All the phases of proposed scheme are explained in Fig. 5 and encryption and decryption is applied on different images named Lena, Panda and Vegetables as shown in Fig. 6.

Fig. 3
figure 3

block bi of Color image after 1st Confusion

Fig. 4
figure 4

Blocks g1 to g4 of a color image after 2nd Confusion

Fig. 5
figure 5

Block Diagram of Phases of Dual Diffusion/Confusion Image encryption technique

Fig. 6
figure 6

Experimental results: (a) plain-image of Lena; (b) plain-image of Vegetables; (c) plain-image of Panda; (d) cipher-image of Lena; (e) cipher-image of Vegetables; (f) cipher-image of Panda; (g) deciphered image of Lena; (h) deciphered image of Vegetables; (i) deciphered image of Panda

4 Security analysis

In proposed algorithm, SHA-2 hash is employed to adapt the initial conditions for chaotic maps. The simulation of the proposed system is done on Intel(R) Corei3 processor 3 GHz with 4GB of RAM. The algorithm is coded in Matlab R2015a and compiled by 5.5 on Windows 7 Home Premium. The parameters and initial values set for chaotic maps u0 = 0.12345678901234, v0 = 0.23456789012345, e0 = 0.34567890123456, d0 = 0.44567890123456, x0 = 0.55678901234567 and y0 = 0.68901234562567 used. The control parameters for 2D logistic map remain fixed which are μ1 = μ2 = 3.12, γ1 < 0.19 and γ2 < 0.14.

4.1 Key space analysis

To resist brute force attack, the system must have large key space [12]. The proposed system has high security; because the large key space. The proposed algorithm used ten different common initial conditions to accomplish the cryptographic task and sensitivity to the initial values for coupled logistic map is considered as 10−14. So key space for initial conditions is \( S={u}_0^{\prime }{u}_0^{\prime }{v}_0^{\prime }{e}_0^{\prime }{d}_0^{\prime }{x}_0^{\prime }{y}_0^{\prime }={10}^{14\times 6}\cong {10}^{84} \) and SHA-2 has space of 2256. Consequently, the total key space is 10161. Therefore, the total key space 2535 is much higher than required key space that is 2128 [23] to make brute force attack ineffective. The key space is larger than some of the existing cipher techniques [10, 11, 25, 36, 39, 40] as shown in Table 5.

Table 5 Comparison of Key space

4.2 Key sensitivity analysis

Chaotic maps are good random number generators which have high sensitivity to initial value and control parameter. The 2-dimensional chaotic system shown in Eq. (2.1) is extremely sensitive to its initial conditions and control parameter with precision of 10−14. The plain image of Panda which is shown in Fig. 7(a) and its encrypted image with \( {u}_0^{\prime } \)=0.12345678901234 is displayed in Fig. 7(b) and its decrypted image using key \( {u}_0^{\prime }={u}_0^{\prime }+0.00000000000001 \) of only one bit difference that results in failure is shown in Fig. 7(c) and (d) is the difference of 7(b) and 7(c). A swift change in one of the secret key; results a total failure in deciphering into plain image. For further investigation of key sensitivity, comparison would be made between different key-sets starting from \( {\alpha}_0=\left[{u}_0^{\prime },{v}_0^{\prime },{e}_0^{\prime },{d}_0^{\prime },{x}_0^{\prime },{y}_0^{\prime}\right] \) as an initial key-set. After a tiny modification in key set α0 we obtained another key set α1 by changing only value \( {u}_0^{\prime }={u}_0^{\prime }+{10}^{-14} \), keeping other values unchanged. The key-set α0 is used to encrypt Panda, Vegetables, Lena, Goat and Pepper images of size 256 × 256 and then same images are encrypted using new key set called α1. The pixel-by-pixel difference of two encrypted images that are generated using α0 and α1 is measured and the rate of difference is 99.6053% as illustrated in Table 6 for Lena image. Similarly, to analyze the sensitivity of the all secret keys, six different key sets are generatedα1, α2, α3, α4, α5andα6as shown in Table 6. Using these key sets, the rate of difference is calculated for Lena, Vegetables, Panda and Goat as shown in Table 6. The results of key sensitivity are also compared to [31, 36, 40] and the proposed cipher has clear advantage over others.

Fig. 7
figure 7

Key sensitivity test: (a) the original image of Panda; (b) the encrypted image of Panda with u0 = 0.1234567890134; (c) Encrypted image of Panda \( {u}_0^{\prime }+1{0}^{-14} \); (d) the pixel-by-pixel difference between (b) and (c)

Table 6 Difference rates between two cipher-images generated by slightly different keys

4.3 Statistical analysis

Claud E. Shannon said, “It is possible to solve many kinds of ciphers by statistical analysis”, and therefore he suggested two methods of diffusion and confusion for frustrating the powerful statistical analysis. In the coming sections, it will be validated that the above defined image cipher has good diffusion and confusion properties.

4.3.1 Histogram analysis

Histogram displays the statistical information of an image. To resist the statistical attack, histogram of encrypted image must be uniform and completely different from histogram of plain image. One typical example LENA image is used to show histogram analysis in Fig. 8. The Fig. 8(a) to (c) are histograms for three color channels and its corresponding encrypted channel shown in Fig. 8(d) to (f). It is obvious that histograms for all channels of encrypted image have almost equal distribution of pixels for each gray levels and completely different from the original image’s histogram.

Fig. 8
figure 8

Histogram of plain and encrypted Lena image for Red, Green and Blue channels

According to the quantitative analysis method in Refs. [36, 40], the uniformity of encrypted image is measured by calculating the variance of histograms. The uniform distribution of encrypted image is revealed by the variance value, lowers the variance score, and hence better is the uniformity. Table 7 provides the variances of histograms of the encrypted images of Lena, Vegetables and Panda, where each column represents variance calculated by each keyset from α0 to α6. These key sets are obtained by tiny changing in one of secret keys. The differences of the variances scores in percentage between histograms of two encrypted images obtained separately by the initial key set α0 and the key set αi (i = 1, 2,.. ., 6); where αi are defined as those in Section 4.2. The corresponding results are listed in Table 8. In addition, it can be observed from Table 8 that the average variance values change with different plain-images ranging 0.07 to 0.17% which is lower than X. Wu [40] ranging from 0.01 to 0.26%. The results are better than A. RehmanApril-2018 [36] which has average variance fluctuation range 0.10 to 0.30%.

Table 7 Image histogram’s variation under different keys
Table 8 Percentage of histogram’s variance difference of the cipher-images

4.3.2 Correlation coefficient

The adjacent pixels have similar intensities in digital images; hence have strong correlation. These strong correlations must be broken in order to avoid statistical attack. The correlation coefficient can be measured within an encrypted image in; horizontal, diagonal and vertical directions by randomly selecting different number of pairs of adjacent pixels. The correlation coefficient values can be measured by Eq. (4.1) which scores between −1 to +1. If the result is close to +1 then it means strong correlation exist or vice versa. The strong and weak correlations are shown in Fig. 9(a) to (c) for plain image and (d) to (f) for cipher image.

$$ {\displaystyle \begin{array}{l}{r}_{xy}\kern0.5em =\frac{\mid (Cov)\mid }{\sqrt{D(x)\times D(y)}}\\ {}\begin{array}{ll} Cov\left(x,y\right)& =\frac{1}{N}\sum \limits_{i=1}^N\left({x}_i-E(x)\right)\left({y}_i-E(y)\right)\end{array}\\ {}\begin{array}{ll}E(x)& =\frac{1}{N}\sum \limits_{i=1}^N{x}_i\end{array}\\ {}\begin{array}{ll}D(x)& =\frac{1}{N}\sum \limits_{i=1}^N{\left({x}_i-E(x)\right)}^2\end{array}\end{array}} $$
(4.1)
Fig. 9
figure 9

Correlation of Horizontally, Vertically and Diagonally adjacent pixels of Plain and Encrypted Lena: Original Lena (a) Red Channel (b) Green Channel (c) Blue Channel, Encrypted Lena: (d) Red Channel (e) Green Channel (c) Blue Channel

In (4.1); x and y represent gray values of two adjacent pixels; E(x) and D(x) are mean and variance values, respectively while cov(x,  y) represent the covariance. The Table 9 depicts the results of adjacent pixels in all three directions of plain and corresponding encrypted images of Lena. It is obvious that encrypted images have significantly lower correlation (close to zero) and also better than [16, 36, 39, 40].

Table 9 Correlation analysis and comparison of plain and encrypted image of Lena

4.3.3 Information entropy analysis

Entropy is a measure of randomness of a message. It computes the spread of the pixels for each gray levels of each color channel. If an image has good uniform distribution, it will be stronger against statistical attacks. For color images, Red, Green and Blue channels having intensities between 0 and 255, the ideal entropy score of encrypted message is 8, or in other words; higher the entropy score, higher will be the uniform distribution. It can be defined as,

$$ H(X)=\sum \limits_{i=1}^LP\left({x}_i\right){\mathit{\log}}_2\Pr \left({x}_i\right) $$
(4.2)

where x(i) is ith grey value, Pr(xi) is the probability of grey level x(i). Information entropy is a kind of quantitative measurement of how random a signal source is. In other words, the information entropy can be used to measure the randomness of the image. The information entropy is measured for different images of size 256 × 256 and their average is also listed in Table 10 and has better than Ref. [36, 39, 40] and comparable to [16].

Table 10 Comparison of entropy for different images

4.3.4 Peak signal to noise ratio (PSNR)

The Peak Signal to Noise Ratio (PSNR) can be calculated using following equation [16].

$$ PSNR\left(E,I\right)=10{\log}_{10}\frac{255^2\left(M,N\right)}{\sum_{\forall i,j}E\left(M,N\right)-I\left(M,N\right)} dB $$
(4.3)

where M and N give the size of the two images for three different channels, E and I represent encrypted and plain images respectively. The PSNR results of the proposed system are shown and compared and far better than Refs. [16, 36, 39] given in Table 11.

Table 11 PSNR comparison

4.3.5 Gray difference degree

The Gray difference degree is another statistical measure of randomness by comparing original and ciphered image. It can be computed by using the following equation that is defined as [16].

$$ GN\left(x,y\right)=\frac{\sum {\left[G\left(x,y\right)-G\left({x}^{\prime },{y}^{\prime}\right)\right]}^2}{4}\ \mathrm{here}\ \left({x}^{\prime },{y}^{\prime}\right)=\left\{\begin{array}{l}\left(x-1,y\right)\\ {}\left(x+1,y\right)\\ {}\left(x,y+1\right)\\ {}\left(x,y-1\right)\end{array}\right. $$
(4.4)

where as G(x, y) symbolizes the gray score at position (x, y). The average neighborhood Gray difference of the whole image can be computed by,

$$ \mathrm{GVD}=\frac{A{N}^{\prime}\left[ GN\left(x,y\right)\right]- AN\left[ GN\left(x,y\right)\right]}{A{N}^{\prime}\left[ GN\left(x,y\right)\right]+ AN\left[ GN\left(x,y\right)\right]} $$
(4.5)
$$ AN\left[ GN\left(x,y\right)\right]=\frac{\sum_{x=2}^{M-1}{\sum}_{y=2}^{N-1} GN\left(x,y\right)}{\left(M-2\right)\left(N-2\right)} $$
(4.6)

In Eqs. (4.5) and (4.6), AN and AN represent Average Neighborhood gray image; but former represent before encrypting and later used to represent after encryption. The final result of the above equations is called GVD score and it will be 0 if two images are completely same or else 1. The GVD score of encrypted and plain images for Lena and Baboon are computed displayed in Table 12 against each 2-diemnsional matrix of color image independently. The GVD score approaches to 1 for each channel which indicates that plain and encrypted are completely different. The listed results are comparable to Refs. [16, 36, 39].

Table 12 Comparison of Gray Value Difference

4.4 Differential analysis

Two known tests called Number of Changing Pixel Rate (NPCR) and Unified Averaged Changed Intensity (UACI) are devised by Eli and Biham [5, 6] to evaluate ciphers against differential attacks. The N(C1, C2) and U(C1, C2) are defined for NPCR and UACI scores in which C1 and C2 are cipher-text images generated from the inputs that differ in one-bit only. The tests for NPCR and UACI are defined in Eqs. (4.7) and (4.8) where L symbolize the largest intensity in the image, M and N are height and width of cipher-text image.

$$ N\left({C}^1,{C}^2\right)=\sum \limits_{i=1}^M\sum \limits_{j=1}^N\frac{D\left(i,j\right)}{M\times N}\times 100\% $$
(4.7)
$$ U\left({C}^1,{C}^2\right)=\sum \limits_{i=1}^M\sum \limits_{j=1}^N\frac{\left|{C}^1\left(i,j\right)-{C}^2\Big(i,j\Big)\right|}{L\bullet M\times N}100\% $$
(4.8)
$$ D\left(i,j\right)=\left\{\begin{array}{l}0.\kern1.25em \mathrm{if}\ {C}^1\left(i,j\right)={C}^2\left(i,j\right)\\ {}1,\kern1.25em \mathrm{if}\ {C}^1\left(i,j\right)\ne {C}^2\left(i,j\right)\end{array}\right.. $$
(4.9)

The results of NPCR, UACI for three channels of color images Lena and Baboon are shown in Table 13. The scores for NPCR>0.9962 and UACI>0.3352 prove that proposed system has strong resistance against differential attacks and has high quality of encryption than Ref. [36, 39] and comparable to Ref. [16]. In order to address the sensitivity of the plaintext, 150 ciphered images are generated from each of the plain image of Lena, Vegetables, Panda, Goat and Pepper by changing 1-bit of a pixel at a time. These 150 encrypted images are generated using secret key setα0.At last, average NPCR and UACI scores of three channels are measured and listed in Table 14 which clearly show that proposed system is better than [36, 40].

Table 13 Comparison of NPCR and UACI of Lena
Table 14 The results of average NPCR R, G, B and UACI R, G, B for different color images for 150 images

4.5 Robustness test

The real issue is that errors often occur in the data while being transferred over the internet using physical communication system. A trivial alteration in the ciphered image may carry a strong distortion in the decryption process which results in a failure to recover the original image as in Refs. [2, 3]; an error in one pixel; one loses the original image completely. A decent system should be designed in a way that it does not have domino effect in decryption process. The prefer usage to test the robustness is to use Gaussian noise which represents the inevitable randomness of the real physical medium. Besides this, other impairments are also used to verify the strength of the proposed system.

4.5.1 Noise addition

In the real world environment, noise accumulation is being occurred frequently. This noise lowers and bends the visual information of digital images. For this purpose, Gaussian noise with densities 0.0001, 0.0003 and 0.0005 are added to Fig. 6(d) and different results are measured to compare with Refs. [17, 26]. The proposed system has better robustness than Refs. [17, 26] shown in Table 15. In the next step, ciphered Panda image in Fig. 6(e) is polluted by Gaussian noise with different densities of 0.002, 0.05 and 0.3 as presented in Fig. 10(a) to (c) and corresponding deciphered images are displayed in Fig. 10(d) to (f). Similarly, the encrypted Panda images is contaminated with Salt & Pepper noise with different densities as shown in Fig. 11(a)–(c) and corresponding decrypted images displayed in Fig. 11(d) to (f). The comparison of PSNR for Gaussian and Salt & Pepper noise are measured shown in Table 16. The PSNR value of the proposed system for Salt & Pepper noise is better than [36, 40] but lower in Gaussian noise.

Table 15 Comparison of robustness against Gaussian noise
Fig. 10
figure 10

Gaussian Noise with different variances and corresponding decrypted images

Fig. 11
figure 11

Salt & Pepper Noise with different variances and its decrypted images

Table 16 The PSNR results between the decrypted images and the original Panda image under noise addition

4.5.2 Occlusion attack

During communication over the internet, part of an image can be lost and proposed cipher must be capable to handle deciphering of lossy image in an appropriate manner. To demonstrate the strength of proposed cipher against such a situation, 1/16, 1/8, 1/4 and 1/2 part of encrypted image of Fig. 6(d) is removed which can be seen in Fig. 12(a) to (d) and resultant decrypted images are shown in Fig. 12(e) to (h). The PSNR, Mean Squared Error, NPCR and UCI scores are measured for lossy decrypted images and listed in Table 17. The NPCR and UACI score are better than A. RehmanApril-2018 [36] and X. Chai [9] but PSNR has lower values than [9].

Fig. 12
figure 12

Occlusion attack analysis by removing a part of (a) 1/16 of encrypted Lena; (b) 1/8 of encrypted Lena; (c) 1/4 of encrypted Lena; (d) 1/2 of encrypted Lena; (e) Decrypted image of (a); (f) Decrypted image of (b); (f) Decrypted image of (c); (g) Decrypted image of (d)

Table 17 MSE, PSNR, NPCR and UACI between plain and decrypted image under different clipping size

4.5.3 Histogram equalization

Histogram of an image contains range of gray levels as well as occurrences of each gray level. It may be possible that some of gray levels exist with ‘zero’ frequency. In statistical terminology, Histogram Equalization is a method to stretch the range of gray level from 0 to 255 or in other words increases the contrast. So this technique is applied on the encrypted image of Panda that revealed in Fig. 6(e) on each channel and shown in Fig. 13(a). This histogram equalized image is decrypted and shown in Fig. 13(b). The PSNR value between the decrypted and original Panda images is 33.19 dB as shown in Table 16. It is obvious that the proposed cipher can counterattack the histogram equalization and has better value than Ref. [40] and comparable to Ref. [36].

Fig. 13
figure 13

Histogram Equalization analysis: (a) encrypted histogram equalized Panda image; (b) Decrypted Panda image from (a)

4.5.4 Contrast Adjustment

A suitable level of brightness and contrast must exist in an image for comfortable viewing where former represent lightness or darkness of a whole image while later defines the difference of brightness to identify clear separation of different regions. Therefore, contrast adjustment is an image processing mechanism in which the input intensities are mapped to a desired level to enhance the area of interest or region. This contrast enhancement is applied on encrypted image of Panda shown in Fig. 6(e) at two different levels, 70% and 30% where lower value means higher the contrast. These enhanced encrypted images are shown in Fig. 14(a) and (c) and corresponding decrypted images are shown in Fig. 14(b) and (d). The Peak Signal to Noise (PSNR) is computed between the decrypted and original Panda images which are 13.72 dB and 11.29 dB, for 70% and 30% contrast enhancement. The PSNR value is comparable to Ref. [36, 40]. Therefore, our proposed scheme is robust against contrast adjustment attacks.

Fig. 14
figure 14

Contrast Adjustment attack for Panda Image: (a) contrast adjustment increased by 70%; (b) Decrypted image from (a); (c) contrast adjustment increased by 30%; (d) Decrypted image from (c)

5 Conclusion

A novel color image encryption algorithm is proposed in this paper based on chaotic maps and SHA-2 hash function. The three channels of a color image are permuted in two phases called Inter-channel and Intra-channel permutation using 2-Dimensional Logistic chaotic map. The recently proposed DNA encoding and decoding mechanism is adopted for each pixel to achieve better randomness. Likewise diffusion, confusion are also performed in two phases; by permutation of DNA bases and using Exclusive-OR operation with DNA complementary rules. After permutation and DNA encoding, color image is transformed into three linear rows; each representing a color channel. This image is divided into blocks; each having three DNA bases, one from each channel. The 1st confusion is performed on each block by inter-DNA permutations using randomly selected permutation sets. For 2nd phase of confusion, three linear arrays are split into groups of four DNA bases, each group representing a pixel and is Exclusive-ORed with DNA complementary rules. The permutation sets for inter-DNA permutation and DNA rules for Exclusive-OR operation are selected randomly. The extensive simulated experiments results prove that proposed algorithm has excellent encryption results in single round and suitable for real time applications due to high efficiency. This scheme is advantageous over other encryption techniques that it has nice feature to resist transmission noise.