1 Introduction

As the Internet increasingly becomes the preferred channel of communication worldwide, more and more information such as images, videos and other forms of data are transmitted over the internet, but convenient access to the network brings lots of concerns about information security such as copyrights pirating and threats to safety of online personal properties. It is extremely urgent to develop some more reliable and effective cryptographic techniques to protect the information [20]. Therefore, many encryption algorithms are designed to protect information security. Ref. [16] proposed a new privacy-preserving patient-centric clinical decision support system, the system can efficiently calculate patient’s disease risk with high accuracy in a privacy-preserving way. Ref. [27] proposed a new fingerprint encryption scheme which utilizes the high-dimension space projection. Ref. [28] proposed aprivacy-preserving face recognition protocol with outsourced computation to protects individuals privacy.

Unlike text files, digital image has some intrinsic features such as bulk data capacities, strong correlation between the adjacent pixels and high redundancy, previous algorithm such as AES and DES [15, 19, 21, 22] are not efficient for proper encryption. Therefore, several methods have been proposed by scientists. The characteristics of chaotic system determine that it can be applied to image encryption [2, 9, 18], Ref. [13] proposed a color image encryption based on one-time keys and robust chaotic maps which has good shear resistance. Ref. [17] proposed a new image encryption scheme based on double chaotic system to complete scrambling and replacement of images. Ref. [12] proposed an adaptive parameter image encryption algorithm based on chaotic theory, result shows that it has good performance.

Image encryption based on DNA computing is an important content of the intersection for computer science and biological science. It is a new developing trend with the successful completion of the human genome project. In 1994, Dr. Adleman [1] of University of Southern California implemented the Directed Hamilton path problem by using the complementary pairing principle of DNA molecules. The birth of DNA computing symbolizes the emergence of a new computing model, breaks original computing model and opens up a new path for solving various complex problems. Image encryption based on DNA computing has been well developed [29]. Ref. [10] proposed a pseudo DNA cryptography method which has better effect. The combination of DNA computation and cat mapping improve the security intensity. Image scrambling after Chebyshev mapping and DNA encoding has good effect on gray scale images [3, 30].

The rest of this paper is organized as follows: Section 2 introduces basic theories of proposed algorithm. Section 3 describes the implementation of algorithm in detail. Section 4 shows simulation experiments results. Section 5 provides security analysis. Conclusions are drawn in Section 6.

2 Basic theory of proposed algorithm

2.1 Logistic maps

Logistic map is strongly sensitive to initial parameter values [8], slight alteration will cause huge changes, the function is described by (1).

$$ \begin{array}{ll} X_{n + 1}=\mu*X_{}*(1-X_{n}) \hspace{0.5cm} \mu\in[0,4], X\in[0,1], \end{array} $$
(1)

Figure 1a shows bifurcation diagram when μ ∈[3.56,4.0], especially μ near to 4. Figure 1b shows values distribution when μ = 3.99. Figure 1c shows when μ ∉[3.56,4.0], the result tend to a specific value.

Fig. 1
figure 1

The characteristics of Logistic system

2.2 Deoxyribonucleic acid sequence

Nowadays, DNA computing has permeated the domain of cryptography. DNA cryptogram utilizes DNA as information carrier and takes advantage of biological technology to achieve encryption. DNA consists of four types deoxyribonucleic acid: A, G, C, T. A and T, G and C are complementary bases. There are 24 encoding schemes to represent a case by two bits, 8 of them conform to Watson-Crick [11] complementary based pairing rules shown in Table 1. We use 4 bits DNA sequences to represent pixel values. For example, the pixel value is 231, it’s binary array is [1 1 1 0 0 1 1 1], the DNA sequence is [T C G T] coded by first coding rule.

Table 1 Eight of pairing rules

2.3 Spatial chaotic system

Chaotic encryption was first proposed by Halle and Hasler [6, 7] in 1993. Spatial chaotic system is a deterministic random processes in nonlinear dynamics system with m and n two variables in the space of chaotic mapping. Spatial chaotic sequences than 2D (a variable m) is more complex, more randomness, more difficult to predict chaotic sequences [4, 5, 23, 24]. Based on the properties of chaotic system, we use spatial chaotic system in encrypting image. The differential form of the two-dimensional system for spatial generalization is shown in (2).

$$ \begin{array}{ll} X_{m + 1,n}+\omega X_{m,n + 1}= 1-(\beta(1+\omega)\times X_{m,n})^{2}, \end{array} $$
(2)

where m, n, Xm, n is geometric coordinates of 3D space, β is real parameter, ω is real number. Research shows that when β ∈ [1.55, 2.0], ω ∈ (-1,1), system presents chaotic state, as is shown in Fig. 2.

Fig. 2
figure 2

Chaotic behavior of spatial chaos system

3 Algorithm description

The detailed description of proposed algorithm is shown in Fig. 3. The algorithm involves dynamic index image scrambling scheme and a new spatial chaotic based diffusion scheme. In the encryption procedure, The logistic map is used to scramble image pixels, and we proposed a new spatial chaotic sequence for diffusion. In addition, DNA coding and XOR are introduced to enhance encryption effect and improve the complexity of algorithm. The encryption process is divided into 6 steps and the detailed description of proposed algorithm is shown in Fig. 3.

Step1::

The color image A(m,n,3) is converted into three matrices R(m,n), G(m,n) and B(m,n) and then calculate pixel average L1, L2 and L3 of each channel.

Step2::

Scrambling the R(m,n), G(m,n) and B(m,n), the detail steps are described as follows:

Fig. 3
figure 3

Specific steps of algorithm

Firstly, define initial parameters L1, L2, L3, offset= 3000, μ = 3.99. According to (1), we can get X1, X2 and X3.

Secondly, select an array of the same size as the original matrix.

Thirdly, sort the sequences X1, X2 and X3, as (3) shows.

$$ \left\{ \begin{array}{ll} \left[Sort\_StdX1, Flag1\right]=sort(X1) \\ \left[Sort\_StdX2, Flag2\right]=sort(X2)\\ \left[Sort\_StdX3, Flag3\right]=sort(X3) \end{array} \right. $$
(3)

where [StdXi, Flagi] = sort(Xi) is the sequencing index function, Flag1, Flag2, and Flag3 are the index sequences of L1, L2 and L3.

Finally, sort the index sequences and get the final sorted matrices based on (4).

$$ \left\{ \begin{array}{ll} Rscr(: , 1 )=Sort\underline{\hspace{0.5em}}StdL1(Flag1(: , 1), : )\\ Gscr(: , 2 )=Sort\underline{\hspace{0.5em}}StdL2(Flag2(: , 1), : )\\ Bscr(: , 3 )=Sort\underline{\hspace{0.5em}}StdL3(Flag3(: , 1), : ) \end{array} \right. $$
(4)
Step3::

The pixel values are changed by XOR operation between scrambled sequences and the random sequences Ch(i) generated by (7). After that, we can get a new image matrix \(R^{\prime }(m,n)\), \(G^{\prime }(m,n)\) and \(B^{\prime }(m,n)\) as follows:

$$ \left\{ \begin{array}{ll} R(i,1) XOR Ch1 \rightarrow R^{\prime}(i,1) \\ G(i,1) XOR Ch2 \rightarrow G^{\prime}(i,1) \\ B(i,1) XOR Ch3 \rightarrow B^{\prime}(i,1) \end{array} \right. $$
(5)
$$ \left\{ \begin{array}{ll} Ch1=uint8(fix(mod(StdL1*10^{12},256))) \\ Ch2=uint8(fix(mod(StdL2*10^{12},256))) \\ Ch3=uint8(fix(mod(StdL3*10^{12},256))) \end{array} \right. $$
(6)

where i = 1,2, ⋯65536.

Step4::

According to the DNA coding rule proposed in Table 1, the matrices can be encoded.

Step5::

Define initial parameters of spatial system ω=-0.05, β= 1.75, A(1,1)= 0.27, A(1,2)= 0.83, A(2,1)=-0.45 and substituting initial parameters into (2), we can get a submatrix B. Do the following operation for B to get a submatrix Ch which has same size with the sorted component matrices.

$$ \begin{array}{ll} Ch=fix (mod(B\times10^{12},4)) \end{array} $$
(7)
Step6::

In order to increase the complexity of the algorithm, we define an addition operation, as shown in Table 2. Using another DNA rule to decrypt the DNA matrices and changing the binary matrices into decimal matrices. Through the above steps, we can obtain an encrypted image. Table 3 illustrates the scrambling scheme by pseudo code. Similarly diffusion scheme is described in Table 4.

Table 2 Addition operation
Table 3 Scrambling scheme description
Table 4 diffusion scheme description

It is worth mentioning that the reverse process of encryption is decryption, Fig. 4 shows the concrete steps of the decryption process.

Fig. 4
figure 4

Decryption flow chart

4 Simulation results

We use Matlab R2014a to run the encryption and decryption process in computer with 2.30 GHz CPU, 8 GB memory and Microsoft Windows 10 operation system. The initial image we choose is Lena.bmp of size 256×256, the keys we select are ω=-0.05, β= 1.75, A(1,1)= 0.27, A(1,2)= 0.83, A(2,1)=-0.45. In Fig. 5, we show the results of encryption and decryption.

Fig. 5
figure 5

Algorithm implementation

5 The security analysis

This section reports the simulation results and performance analysis for the proposed algorithm. A good encryption system should resist to all kinds of known attacks and the corresponding security analyses have been performed on the proposed algorithm, including gray histogram analysis, key space analysis, sensitivity analysis, information entropy analysis, correlation coefficient analysis and statistical analysis, noise interference analysis.

5.1 Gray histogram analysis

The histogram is one of the most statistical characteristics of an image, and represents the frequency of all the gray level values from all over the image. Figure 6a, b and c show the R G B component gray histogram of initial color image respectively, Fig. 6d, e and f show the R G B component gray histogram of decrypted color image respectively. From Fig. 6 we can see that the histogram of the ciphered image is fairly uniformly distributed, this is important in resisting statistical analysis attack.

Fig. 6
figure 6

Gray histograms of initial image and encrypted image

5.2 Secret keys space analysis

A good image encryption system should be sensitive to cipher keys, and the key space needs to be large enough to make the brute-force impossible [26]. To our proposed encryption algorithm, the key consists of the initial values L1, L2, L3 of logistic map, control parameter of logistic map μ, initial value and control parameter of spatial map A(1,1), A(1,2), A(2,1), β and ω. The precision is 10− 15, so the key space is larger than 10135. So the key space is large enough to resist all kinds of brute-force attacks.

5.3 Sensitivity analysis

Chaotic sequences have high sensitivity to initial value and rapid diffusibility. In implementation of the algorithm, we decrypt the cipher image Fig. 5a using β = 1.75 + 10− 9 with other keys the same. The decryption image and its corresponding histogram are shown in Fig. 7. From Fig. 7, we see that the decryption image is completely different from the original image and is nearly uniformly distributed, which means proposed encryption method provides a high key sensitivity.

Fig. 7
figure 7

Sensitivity analysis

5.4 Information entropy analysis

Information entropy is a concept used in the information theory to measure the amount of information. The more orderly a system is, the lower the entropy of information. Therefore, information entropy is also an evaluation criteria for the level of system confusion. The calculation formula is shown in (8).

$$ H=-\sum\limits_{i = 0}^{255}p_{(i)}\log_{2}p_{(i)}, $$
(8)

where i is gray value of image, P(i) is emergence probability of i.

According to (8), we can get the ideal H = 8, which shows that the information is random. Hence the information entropy of the ciphered image should be close to 8 after encryption. The closer it gets to 8, the less possible for the cryptosystem to divulge information. Table 5 shows the information entropy of different algorithms.

Table 5 Information entropy

5.5 Correlation coefficient analysis

An image generally has high data redundancy and thus its pixels have high correlations with their neighboring pixels. A good image encryption algorithm should have the ability of breaking these correlations. Mathematically, the correlation coefficients of the mentioned pixels in vertical, horizontal and diagonal direction are measured using (9).

$$ \left\{ \begin{array}{ll} E(x) = \frac{1}{N}\sum_{i = 1}^{N}x_{i}\\ D(x) = \frac{1}{N}\sum_{i = 1}^{N}(x_{i}-E(x))^{2}\\ cov(x,y) = \frac{1}{N}\sum_{i = 1}^{N}(x_{i}-E(x))(y_{i}-E(y)))\\ r_{xy} = \frac{cov(x,y)}{\sqrt{D(x)\times\sqrt{D(y)}}} \end{array} \right. $$
(9)

where x and y are gray-scale values of two adjacent pixels in image, N is the total number of pixels which are selected from image.

We randomly select 1000 pairs of two adjacent pixels from initial image, Fig. 8a, b and c show R G B component correlation of initial image, Fig. 9a, b and c show encrypted image.

Fig. 8
figure 8

Correlation of initial image

Fig. 9
figure 9

Correlation of encrypted image

In the Table 6, we have given the correlation coefficients for the encrypted and initial images respectively which more irrelevant than the algorithm proposed by Ref. [4]. Table 7 shows same position correlations between R, G, B components, the result of the initial image are close to 1 while the encrypted image’s result are closer to 0 than wang’s algorithm [25]. These further verify that the encrypted image by proposed algorithm has extremely low correlation.

Table 6 Correlation coefficients of two adjacent pixels in three typical directions
Table 7 Same position correlations between R, G, B components

5.6 Noise interference analysis

It is easy to lose information in the process of image transmission. In order to verify the interference resistance of the algorithm, we selected nine parts from the Lena.jpg (the size is 256 × 256 × 3), each of part has size of 30 × 30 and then set the pixel value to 0 as the Fig. 10b shows. Then decrypt this incomplete image and get the result of in Fig. 10c. When the image lost 12% information, it can also get the primary information. Compared with Ref. [8] which lost 2% data, the proposed algorithm has stronger ability of resisting noise interference.

Fig. 10
figure 10

Noise interference analysis

6 Conclusions

In this paper, a new way of color image encryption algorithm have been proposed which utilizes logistic maps, spatial maps and DNA coding. The initial conditions for both the logistic maps are derived using initial image. In the proposed encryption process, logistic maps is used for scrambling pixel, spatial maps is used for replacing pixel, DNA coding and ROX operations are used to enhance the complexity of the algorithm. To make the cipher more robust against any attack, the secret key is modified after DNA coding. We have carried out statistical analysis, key sensitivity analysis, key space analysis and etc to demonstrate the security of the new image encryption procedure. Finally, we conclude with the remark that the proposed method is expected to be useful for real time image encryption and transmission applications.