1 Introduction

With the widespread application of Internet technology in life, information transmission becomes more and more convenient. Among them, digital image plays an increasingly important role in information transmission, which is closely related to people’s life and work. And thus, people are becoming increasingly concerned about the security of image information, especially in areas related to privacy, security, and military affairs [1]. However, different from other ways of information dissemination, digital images have stronger data correlation [2]. The traditional text encryption algorithm is not suitable for image encryption, so experts and scholars are looking for an efficient image encryption scheme.

At the same time, because of the growth of chaos theory, experts have discovered that chaotic systems have several excellent qualities, including ergodicity, pseudo-randomness, unpredictability, and initial value sensitivity [3]. These characteristics are very suitable for image encryption, and scholars begin to use chaotic systems to design a variety of image encryption schemes. In 1989, Matthew proposed a chaos-based information encryption method, which made a way for the use of chaotic systems in the security of information [4]; in 1998, Fridrich proposed an encryption structure composed of confusion and diffusion, which laid the basic framework of image encryption [5]; in 2006, Pareek et al. used two groups of Logistic maps to block the image and realized the instantaneous encryption of the image [6]; in 2017, Wang et al. devised an algorithm for image block encryption that combined chaos theory and DNA coding to realize the interdisciplinary convergence of biology and cryptography [7]; in 2022, Huang et al. designed an image encryption algorithm based on a hyperchaotic system, which consists of two scrambling-diffusion operations and one scrambling operation. It can more effectively resist various image attacks [8]. Until now, new image encryption algorithms are still being produced, and various chaotic systems and encryption methods are emerging in endlessly. However, with the arrival of a new era, the new era has higher requirements for encryption algorithms, and researchers increasingly focus on the safety of encryption algorithms. It is under this background that this paper proposes a chaotic image encryption scheme with higher security.

Chaotic image encryption is mainly composed of two parts, one is chaotic systems and the other is image encryption. In the aspect of chaotic systems, with the in-depth analysis of various systems, we found that the one-dimensional chaotic system is simple to construct, and chaotic sequences can be generated in a short calculation time. However, the one-dimensional chaotic system has fewer control parameters and smaller key space, which is insufficient for encryption algorithms [9]; the high-dimensional chaotic system has a complex logical structure, high randomness, and more uniform distribution [10], but the encryption time is too long [11]. Therefore, it is necessary to find a chaotic system that can achieve a balance between security performance and computational efficiency [12]. And then, in the aspect of the encryption algorithm, through the analysis of the DNA encryption algorithm [13], we find that classical DNA image encryption relies too much on chaotic sequences [14]. Both coding rules and operation rules are controlled by chaotic sequences, which will bring a series of security problems. As long as the attacker deciphers the chaotic sequence, the whole encryption system can be broken, so the classical DNA encryption algorithm lacks security.

To solve the above problems, this paper makes the following improvements. In the aspect of chaotic systems, this paper constructs a new two-dimensional chaotic system named 2D-Sine-adjusted-Henon MAP (2D-SAHM). Through the performance analysis, it is found that the proposed system has a wider parameter range and better chaotic characteristics than the classical two-dimensional chaotic system. And compared with the traditional high-dimensional chaotic system, it has a faster calculation speed. In the aspect of encryption algorithm, this paper proposes a new DNA operation rule, which determines the operation symbol by the first three bases of each DNA encoding matrix, and gets rid of the dependence on chaotic series. This method can not only increase the randomness of the encryption algorithm but also improve security.

The remainder of this paper has the following structure: Sect. 2 proposes 2D-SAHM chaotic system and completes chaotic dynamics analysis; Sect. 3 proposes the encryption algorithm and decryption algorithm; Sect. 4 gives the algorithm simulation; Sect. 5 analyzes the performance of the encryption algorithm; Sect. 6 is the conclusion.

2 Chaotic system

2.1 2D-SAHM chaotic system

Here are two classical chaotic systems, namely Sine map and Henon map, and can be expressed by Eqs. (1) and (2)

$$\begin{aligned}{} & {} x(n+1)=\mu \sin (\pi x(n)) \end{aligned}$$
(1)
$$\begin{aligned}{} & {} \left\{ \begin{array}{ll} x(n+1)=ax{{(n)}^{2}}+y(n)+1 \\ y(n+1)=cx(n). \\ \end{array} \right. \end{aligned}$$
(2)

Among them, \(u\in (0,4];a=1.4,c\in (0,1.5)\).

The bifurcation diagrams for Sine mapping and Henon mapping are shown in Fig. 1a, b. There is a clear periodic window for the two mappings, as shown in the figure, for the Sine mapping, Only if \(\mu \in (3.46,4]\) in a chaotic state, for the Henon map, only if \(c\in (1.15,1.4]\) in a chaotic state, which means that the system is not in a chaotic state for the whole parameter range. In this case, the practical parameter range of the above two chaotic systems is also very limited, which will lead to a small key space and cannot ensure the security of the algorithm. Therefore, these chaotic systems cannot be used for image encryption.

To improve this situation, this paper combines Sine chaotic map and Henon chaotic map, and uses the output sequence generated by Sine map to adjust the input of Henon map, and then fixes the result to a certain value range by modulus operation, so as to obtain a bounded sequence. Finally, by adding some unknown parameters to the chaotic system, a new two-dimensional chaotic system named 2D-Sine-adjusted-Henon MAP (2D-SAHM) can be constructed, and its formula is Eq. (3).

Fig. 1
figure 1

Bifurcation diagram

$$\begin{aligned} \left\{ \begin{array}{ll} x(n+1)=\bmod ({{k}_{1}}{{(\mu \sin (\pi x(n)))}^{2}}+{{k}_{2}}\mu \sin (\pi y(n))+{{k}_{3}},1) \\ y(n+1)=\bmod ({{k}_{4}}\mu \sin (\pi x(n)),1) \\ \end{array} \right. \end{aligned}$$
(3)

In Eq. (3), \({{k}_{1}}\), \({{k}_{2}}\), \({{k}_{3}}\), \({{k}_{4}}\)—unknown parameters in 2D-SAHM;

\(\mu \)—control parameters in 2D-SAHM.

To keep the chaotic state of the system as much as possible within the parameter range, the parameters of the 2D-SAHM chaotic map are determined as \({{k}_{1}}\) = \(-\) 4.4736,\({{k}_{2}}\) = \(-\) 10.0000, \({{k}_{3}}\) = 10.0000,\( {{k}_{4}}\) = \(-\) 8.0189 by combining several indicators such as bifurcation diagram and Lyapunov exponent. And the following content will continue to use this parameter.

2.2 Simulation of bifurcation diagram

The bifurcation phenomenon refers to the qualitative change in the qualitative behavior of a nonlinear system as the parameters change. When the parameters of the 2D-SAHM chaotic map are set \({{k}_{1}}\) =\(-\) 4.4736,\({{k}_{2}}\) =\(-\) 10.0000,\({{k}_{3}}\) =10.0000,\({{k}_{4}}\) =\(-\) 8.0189, \(\mu \) is variables, and the initial values are x(0) = 0.1,y(0) = 0.2, the bifurcation diagram of 2D-SAHM is shown in Fig. 2. According to the Fig. 2, when the parameter is \(\mu >0.05\), the whole system has no periodic window and is in a chaotic state.

Fig. 2
figure 2

Bifurcation diagram of the 2D-SHAM

2.3 Lyapunov exponent

The Lyapunov exponent is another important statistical characteristic value in the analysis of chaotic maps. When the Lyapunov exponent exhibits a positive number, the system appears chaotic in character [15]. Meanwhile, the Lyapunov exponent becomes higher and the chaotic characteristics of the system become stronger. In setting the parameter of the 2D-SAHM chaotic map as \({{k}_{1}}\) = \(-\) 4.4736,\( {{k}_{2}}\) = \(-\) 10.0000,\( {{k}_{3}}\) = 10.0000, \({{k}_{4}}\) = \(-\) 8.0189, \(\mu \) is the variable, when the initial value x(0) = 0.1, y(0) = 0.2, the Lyapunov index of 2D-SAHM is shown in Fig. 3. According to the Fig. 3, when this parameter \(\mu >0.05\), the two Lyapunov exponents of this system are bigger than 0, and the system enters a hyperchaotic state with good chaotic characteristics, and the parameter range becomes significantly larger.

Fig. 3
figure 3

Lyapunov exponent

2.4 NIST test

The pseudo-randomness of chaotic sequences needs to be tested, and 15 indicators from the sts\(-\) 2.1.2 version in NIST are selected for this paper. The generated p value is used to evaluate the pseudo-randomness of the sequence, and the threshold \(\alpha >0.01\) is set. If the p value is higher than the threshold, it shows that the sequence passes the NIST randomness test [16]. Table 1 shows that the sequences created by the 2D-SAHM system pass 15 tests and can be used for image encryption.

Table 1 NIST test results

3 Encryption algorithm

This section proposes an image encryption algorithm based on 2D-SAHM chaotic system and a new DNA operation rule, which is mainly divided into three parts. The first part is to set the key of the encryption algorithm; the second part is to use the Joseph algorithm to scramble the image and divide it into several sub-images; the third part is to diffuse the image through the new DNA operation rule proposed in this paper, which determines the operation symbol of DNA by the type of amino acid.

3.1 Keys

The key of this encryption algorithm is composed of four parts, the first part is the key required by the chaotic sequence, which mainly includes five system parameters \({{k}_{1}},{{k}_{2}},{{k}_{3}},{{k}_{4}},{{\mu }_{0}}\), here five keys; the second part is the key needed in the scrambling phase. Joseph scrambling is controlled by the starting position s and the number interval g, here two keys; the third part is the key needed in the diffusion phase. In this phase, four chaotic sequences XYZH are needed for DNA diffusion, so two sets of system initial values \(({{x}_{1}},{{y}_{1}}),({{x}_{2}},{{y}_{2}})\) are needed, here four keys. The fourth part is the key of the algorithm itself. In the algorithm, the average gray values of the RGB three color channels of the color pictures are the set key, and there are three keys here. Therefore, there are 14 keys in this paper.

3.2 Scrambling algorithm

3.2.1 Double Joseph scrambling

The classical Josephus scrambling method is described as follows: Assuming that the size of the plaintext image is \(M\times N\), and it is necessary to generate a scrambling matrix of the same size to encrypt it. Set the length of Joseph as sequence \(a=[{{a}_{1}},{{a}_{2}},....,{{a}_{n}}]\), starting position s, and number interval g. According to the principle of the Joseph ring, the read \({{N}_{0}}\) is arranged row by row into matrix A of size \(M\times N\), and the matrix A is the scrambling matrix [17].

Here is a schematic diagram of Joseph scrambling on a matrix with 5 rows and 4 columns, as shown in Fig. 4: There are 20 elements in the matrix, first transform it into a one-dimensional vector, and then set the starting position as 3, and the interval of the number is 5. When executing the first Joseph loop, start from 48, end to 52, and finally eliminate 52 and put it into 1 row and 1 column of the scrambling matrix. In the second loop, starting from 52 and ending at 23, 23 is removed and put into 1 row and 2 columns of the scrambling matrix, and so on.The such loop is executed 20 times, and finally, a matrix whose element position is completely scrambled can be obtained, so as to achieve the purpose of matrix scrambling.

Double Joseph scrambling is two consecutive scrambles on the basis of classical Joseph scrambling, and the starting position of each scrambling is different.

Fig. 4
figure 4

Scrambling diagram

3.3 Diffusion algorithm

3.3.1 DNA encoding

DNA coding comes from biology. Four bases—adenine (A), guanine (G), cytosine (C), and thymine (T)—make up a DNA sequence. According to the principle of complementary pairing of mutual bases, A and T are complementary, G and C are complementary, and, in the binary system, 0 and 1 are complementary, so by combining the two, there are eight rules [18], the rules are shown in Table 2. DNA encoding is to convert every 1 decimal digit into 8 binary digits and then replace every 2 binary digits number by base according to the table below.

Table 2 DNA coding rules

3.3.2 DNA operation

After DNA coding of the pixel values, there are algebraic operations to be performed between DNA sequences, such as DNA addition, subtraction, XOR, and XNOR [19]. This operation mimics the classical calculation pattern in binary, so there are four operation rules for every type of DNA coding rule. Assuming that the first DNA coding rule in Table 2 is selected, the corresponding four operation rules are shown in Tables 3, 4, 5, and 6, respectively.

Table 3 DNA addition rules
Table 4 DNA subtraction rules
Table 5 DNA XOR rules
Table 6 DNA XNOR rules

3.3.3 A new DNA operation rule

In this paper, through in-depth analysis of DNA encryption algorithm, it is found that classical DNA encryption relies too much on chaotic sequence, both coding rules and operation rules are controlled by chaotic sequence, which will bring a series of security problems; for example, the hackers can break the whole encryption system after deciphering the chaotic sequence. Therefore, this paper proposes a new DNA operation rule. Its idea is as follows: three bases in DNA can determine an m-RNA codon, one m-RNA codon can combine with a t-RNA anti-codon, and a t-RNA represents an amino acid. This means that three bases in DNA can determine an amino acid; at this time, we only need to classify the types of amino acids, so that each type of amino acid represents an operation symbol. Finally, we can determine the operation symbol by the first three bases of each DNA coding matrix, and get rid of the dependence on the chaotic series. This method can improve both the randomness of the encryption algorithm and the security.

In this paper, we divide four kinds of amino acids, which represent four kinds of operation symbols, as shown in Table 7.

Table 7 Amino acid species and corresponding operation symbols

3.4 Encryption algorithm

Step 1: Use the SHA-256 hash function to obtain binary numbers from plaintext images, and then generate three sets of initial values \(({{x}_{1}},{{y}_{6}});({{x}_{2}},{{y}_{7}});({{x}_{3}},{{y}_{8}})\) of 2D-SAHM chaotic systems after the algebraic transformation of the following equation:

$$\begin{aligned} {{a}_{i}}= & {} K(5(i-1)+1:5(i-1)+40), \quad i=1,2,3,6,7,8 \end{aligned}$$
(4)
$$\begin{aligned} {{x}_{i}}= & {} \textrm{bisde}({{a}_{i}})/{{2}^{40}},\quad i=1,2,3 \end{aligned}$$
(5)
$$\begin{aligned} {{y}_{i}}= & {} \textrm{bisde}({{a}_{i}})/{{2}^{40}},\quad i=6,7,8, \end{aligned}$$
(6)

where K(x : y) in Eq. (4) represents the element distribution from x to y in vector K; \(\textrm{bisde}({{a}_{i}})\) in Eq. (5) represents the conversion of a binary number a to \({{a}_{i}}\) decimal number.

Step 2: Obtain the unknown parameter \({{k}_{1}},{{k}_{2}},{{k}_{3}},{{k}_{4}},{{\mu }_{0}}\) in the 2D-SAHM chaotic system through the bifurcation diagram and Lyapunov exponent of the chaotic system. As shown in Eq. (7)

$$\begin{aligned} \left\{ \begin{array}{ll} {{k}_{1}}=-4.4736 \\ {{k}_{2}}=-10.0000 \\ {{k}_{3}}=10.0000 \\ {{k}_{4}}=-8.0189 \\ \mu ={{\mu }_{0}}+{{x}_{1}}+{{y}_{1}}+{{x}_{2}}+{{y}_{2}}+{{x}_{3}}+{{y}_{3}}. \\ \end{array} \right. \end{aligned}$$
(7)

Step 3: Put the parameter \({{k}_{1}},{{k}_{2}},{{k}_{3}},{{k}_{4}},\mu \) and three groups of initial values \(({{x}_{1}},{{y}_{6}});({{x}_{2}},{{y}_{7}});({{x}_{3}},{{y}_{8}})\) into the 2D-SAHM chaotic system, which can generate six sets of chaotic sequences. To eliminate the effects of transient processes, the first 3000 points of each group of sequences are discarded, and finally, the chaotic sequence SGXYZH is obtained.

Step 4: After the chaotic sequence SGXYZH is obtained, the chaotic sequence S and G are processed according to the following equation, and the starting position s and the interval g of Joseph scrambling can be determined by obtaining the processed sequence value:

$$\begin{aligned} s= & {} \bmod (\textrm{round}(S\times {{10}^{4}},9)+1 \end{aligned}$$
(8)
$$\begin{aligned} g= & {} \bmod (\textrm{round}(G\times {{10}^{4}},9)+1. \end{aligned}$$
(9)

Step 5: Read the plaintext image, perform Joseph scrambling on the RGB tri-channel of the color plaintext image, and obtain the scrambling matrix \({{S}_{R}},{{S}_{G}},{{S}_{B}}\).

Step 6: After obtaining the scrambling matrix \({{S}_{R}},{{S}_{G}},{{S}_{B}}\), perform DNA operation on it. According to the principle of row priority, the following formula is performed on the scrambling matrix \({{S}_{R}},{{S}_{G}},{{S}_{B}}\) to obtain the matrix \({{A}_{R}},{{A}_{G}},{{A}_{B}}\):

$$\begin{aligned} \left\{ \begin{array}{ll} {{A}_{R}}=\textrm{Change}\{{{S}_{R}},2,r\} \\ {{A}_{G}}=\textrm{Change}\{{{S}_{G}},2,r\} \\ {{A}_{B}}=\textrm{Change}\{{{S}_{B}},2,r\}, \\ \end{array} \right. \end{aligned}$$
(10)

where the function \(\textrm{Change}\{S,2,r\}\) represents converting each 1-bit decimal element in the scrambling matrix S into an 8-bit binary number and dividing it into r blocks.

Step 7: Transform the Y sequence into an integer in the range of 0–255, and convert it into a two-dimensional matrix B of \(M\times N\)

$$\begin{aligned} y= & {} \bmod (\textrm{round}(Y\times {{10}^{4}}),256) \end{aligned}$$
(11)
$$\begin{aligned} B= & {} \textrm{reshape}(y,M,N). \end{aligned}$$
(12)

Step 8: According to the row priority principle, perform the following operation on the matrix B to obtain the diffusion matrix R:

$$\begin{aligned} R=\textrm{Change}\{B,2,r\}, \end{aligned}$$
(13)

where the function \(\textrm{Change}\{B,2,r\}\) means to convert every 1-bit decimal element in scrambled matrix B to 8-bit binary number and divide it into r blocks.

Step 9: Use X sequence and Z sequence to encode DNA for scrambling matrix A and diffusion matrix R, respectively. There are 8 encoding rules determined by the chaotic sequence, so the range is 1–8, as shown in Table 2. After encoding, the encoding matrix EA and ER are obtained

$$\begin{aligned}{} & {} X=\bmod (\textrm{round}(X\times {{10}^{4}}),8)+1 \end{aligned}$$
(14)
$$\begin{aligned}{} & {} Z = \bmod (\textrm{round}(Z\times {{10}^{4}}),8)+1 \end{aligned}$$
(15)
$$\begin{aligned}{} & {} \left\{ \begin{array}{ll} \textrm{EA}_{R}=\textrm{DNA}\_\textrm{encode}({{A}_{R}},X) \\ \textrm{EA}_{G}=\textrm{DNA}\_\textrm{encode}({{A}_{G}},X) \\ \textrm{EA}_{B}=\textrm{DNA}\_\textrm{encode}({{A}_{B}},X) \\ \end{array} \right. \end{aligned}$$
(16)
$$\begin{aligned}{} & {} \textrm{ER}=\textrm{DNA}\_\textrm{encode}(R,Z), \end{aligned}$$
(17)

where the function \(\textrm{DNA}\_\textrm{encode}(A,X)\) represents the matrix A encoded according to the rules corresponding to the X sequence.

Step 10: Perform DNA operations on each scrambled matrix EA and each diffusion matrix ER after coding, and determine the operation symbol \({{Q}_{1}}\) from the first three bases of scrambled matrix EA, as shown in Table 7. In this way, the operation matrix EC is obtained. And then, store the operation symbol \({{Q}_{1}}\) in order

$$\begin{aligned} \left\{ \begin{array}{ll} \textrm{EC}_{R}=\textrm{DNA}\_\textrm{compute}(\textrm{EA}_{R},\textrm{ER}_{{}},{{Q}_{1}},{{r}_{{}}}) \\ \textrm{EC}_{G}=\textrm{DNA}\_\textrm{compute}(\textrm{EA}_{G},\textrm{ER}_{{}},{{Q}_{1}},{{r}_{{}}}) \\ \textrm{EC}_{B}=\textrm{DNA}\_\textrm{compute}(\textrm{EA}_{B},\textrm{ER}_{{}},{{Q}_{1}},{{r}_{{}}}), \\ \end{array} \right. \end{aligned}$$
(18)

where the function \(\textrm{DNA}\_\textrm{compute}(\textrm{EA}_{{}},\textrm{ER}_{{}},{{Q}_{{}}},{{r}_{{}}})\) represents the EA matrix of the r block and the ER matrix of the r block to perform the \({{Q}_{1}}\) operation of DNA.

Step 11: To increase the randomness, perform DNA operation again for each operation matrix EC and each diffusion matrix ER, and determine the operation symbol \({{Q}_{2}}\) from the first three bases of the operation matrix EC, as shown in Table 7; The output matrix ED is obtained in this way. At the same time, store the operation symbol \({{Q}_{2}}\) in order

$$\begin{aligned} \left\{ \begin{array}{ll} \textrm{ED}_{R}=\textrm{DNA}\_\textrm{compute}(\textrm{EC}_{R},\textrm{ER}_{{}},{{Q}_{2}},{{r}_{{}}}) \\ \textrm{ED}_{G}=\textrm{DNA}\_\textrm{compute}(\textrm{EC}_{G},\textrm{ER}_{{}},{{Q}_{2}},{{r}_{{}}}) \\ \textrm{ED}_{B}=\textrm{DNA}\_\textrm{compute}(\textrm{EC}_{B},\textrm{ER}_{{}},{{Q}_{2}},{{r}_{{}}}). \\ \end{array} \right. \end{aligned}$$
(19)

Step 12: Use the H sequence to decode the r block output matrix ED. There are eight decoding rules determined by the H sequence, so the range is from 1 to 8, as shown in Table 2. Finally, the decoding matrix DT is obtained

$$\begin{aligned}{} & {} H=\bmod (\textrm{round}(H\times {{10}^{4}}),8)+1 \end{aligned}$$
(20)
$$\begin{aligned}{} & {} \left\{ \begin{array}{ll} \textrm{DT}_{R}=\textrm{DNA}\_\textrm{decode}(\textrm{ED}_{R},H) \\ \textrm{DT}_{G}=\textrm{DNA}\_\textrm{decode}(\textrm{ED}_{G},H) \\ \textrm{DT}_{B}=\textrm{DNA}\_\textrm{decode}(\textrm{ED}_{B},H), \\ \end{array} \right. \end{aligned}$$
(21)

where the function \(\textrm{DNA}\_\textrm{decode}(\textrm{ED},H)\) represents the decoding of the matrix ED according to the rules corresponding to the H sequence.

Step 13: Combine the r-block decoding matrix DT into one block and convert it into a decimal number of 0–255. And then superimpose the ciphertext matrix of RGB three color channels. Finally, a ciphertext image CT is generated

$$\begin{aligned}{} & {} \left\{ \begin{array}{ll} \textrm{CT}_{R}=\text {uint8}\{\textrm{DT}_{R}\} \\ \textrm{CT}_{G}=\text {uint8}\{\textrm{DT}_{G}\} \\ \textrm{CT}_{B}=\text {uint8}\{\textrm{DT}_{B}\} \\ \end{array} \right. \end{aligned}$$
(22)
$$\begin{aligned}{} & {} CT=\textrm{Unite}(\textrm{DT}_{R},\textrm{DT}_{G},\textrm{DT}_{B}), \end{aligned}$$
(23)

where the function \(\text {uint8}\{\textrm{DT}\}\) represents the conversion of the decoding matrix DT into decimal numbers from 0 to 255. The function \(\textrm{Unite}(\textrm{DT}_{R},\textrm{DT}_{G},\textrm{DT}_{B})\) represents stacking the ciphertext matrices of the three color channels together.

3.4.1 Encryption flowchart

The encryption flowchart is shown in Fig. 5.

Fig. 5
figure 5

Encryption flowchart

3.5 Decryption algorithm

The algorithm is a symmetric encryption algorithm. And so, decryption is the inverse process of encryption. The decryption process is as follows:

  1. Step 1:

    Input the key to obtain the chaotic sequence SGXYZH and the operation symbol \({{Q}_{1}},{{Q}_{2}}\) of each matrix during encryption. At the same time, read the ciphertext image to obtain the ciphertext matrix CT, and divide the ciphertext matrix into \(\textrm{CT}_{R},\textrm{CT}_{G},\textrm{CT}_{B}\) three color channels.

  2. Step 2:

    According to the principle of row priority, convert every 1-bit decimal element in the ciphertext matrix \(\textrm{CT}_{R},\textrm{CT}_{G},\textrm{CT}_{B}\) into 8-bit binary number and divide it into r blocks.

  3. Step 3:

    Through the chaotic sequence Y, obtain the diffusion matrix R.

  4. Step 4:

    Use H sequence and Z sequence to encode DNA for block matrix DT and diffusion matrix R, respectively, and obtain the coding matrices ED and ER.

  5. Step 5:

    After encoding, each ED matrix and each diffusion matrix ER are, respectively, performed DNA operation, and the operation symbol \({{C}_{2}}\) was symmetrically converted from \({{Q}_{2}}\), and the operation matrix EC was obtained by this way.

  6. Step 6:

    Each EC matrix and each diffusion matrix ER were performed another DNA operation, and the operator symbol \({{C}_{1}}\) was symmetrically converted from \({{Q}_{1}}\). The matrix EA is obtained in this way.

  7. Step 7:

    Use the X sequence to decode the matrix EA and obtain the decoding matrix A.

  8. Step 8:

    Combine the r-block decoding matrix A into a block and convert it into a decimal number of 0–255 to obtain the scrambling matrix S.

  9. Step 9:

    Use the chaotic sequence SG to determine the starting position s of the Joseph scrambling and the counter interval g. And then, perform Joseph restoration on the scrambling matrix \({{S}_{R}},{{S}_{G}},{{S}_{B}}\), and obtain the restoration matrix \({{P}_{R}},{{P}_{G}},{{P}_{B}}\). Finally, the restoration matrix is superimposed to get the plaintext image P.

4 Simulation

The algorithm is realized using simulation software and a personal computer with AMD R7-5800 H CPU, 3.20 GHZ, and 16GB memory, and running in Windows 10 operating system environment, and the test images include three color images “Lena”, “House”, and “Pepper”, where the graph size of “Lena” and “Pepper” is \(512\times 512\), and the graph size of “House” is \(256\times 256\). Figure 6 shows the plaintext image, ciphertext image, and decrypted image. The simulation results show that the encrypted output is like a snowflake and cannot provide any relevant information, and the plaintext image can be completely restored after decryption.

Fig. 6
figure 6

Simulation result

5 Performance analysis

5.1 Key space analysis

The key space can be used to determine whether a cryptosystem can resist exhaustive attacks; the larger the key space, the more secure the cryptosystem. The key space of this paper mainly includes four parts, the first part is the five parameters \({{k}_{1}},{{k}_{2}},{{k}_{3}},{{k}_{4}},{{\mu }_{0}}\) of the chaotic system, and the second part is the starting position s of Joseph scrambling and the number interval g. The third part is the initial value \(({{x}_{1}},{{y}_{6}});({{x}_{2}},{{y}_{7}})\) of the chaotic system, and the fourth part is the three average gray values of the RGB three color channels in the algorithm. Therefore, there are 14 keys in this paper.

In the experiment, the computer accuracy can reach \({{10}^{-14}}\), and the space of the SHA-256 hash value is \({{2}^{256}}\), so the total key space is \({{2}^{340}}\), and the key space is much larger than \({{2}^{100}}\) [20]. The encryption algorithm in this paper can resist exhaustive attacks.

5.2 Key sensitivity analysis

Key sensitivity refers to the large change in the ciphertext image after a small change in the initial key during the encryption and decryption process [21]. Figure 7a, d, g shows the decrypted images with the correct key, and Fig. 7b, c, e, f, h, i shows the decrypted images with the wrong keys which is only a slight difference compared to the correct key. And the result shows that the algorithm has extremely high key sensitivity.

Fig. 7
figure 7

Key sensitivity. a, d, g: decrypted image using original key; b, e, h decrypted image using wrong key, where \({{x}_{0}}={{x}_{0}}+{{10}^{-14}}\); c, f, i decrypted image using wrong key, where \(\mu =\mu +{{10}^{-14}}\)

5.3 Histogram analysis

When analyzing the effect of image encryption, we usually use the histogram of the image to estimate the pixel value distribution of the image, and the encrypted histogram should be more evenly distributed. As shown in Fig. 8, the ciphertext image generated by this algorithm has a smooth histogram distribution.

Fig. 8
figure 8

Histogram analysis

5.4 \({{\textrm{ }\!\!\chi \!\!\text { }}^{\textrm{2}}}\) analysis

It is not enough to observe only from the perspective of drawing histograms. To further analyze the histogram properties, we use \({{\chi }^{2}}\) test to evaluate the frequency of different pixels in the image [22]. The lower the value of \({{\chi }^{2}}\), the more homogeneous the image. The criteria for judging the histogram uniformity are as follows: when the significance level \(\alpha \) is set to 0.05, \({{\chi }^{2}}\le 293.24783\) will pass the \({{\chi }^{2}}\) test. Table 8 shows that all ciphertext images can pass \({{\chi }^{2}}\) test

$$\begin{aligned} {{\chi }^{2}}=\sum \limits _{i=0}^{255}{\frac{({{f}_{i}}-g)}{g}} \end{aligned}$$
(24)
Table 8 The \({{\chi }^{2}}\) test of the picture

5.5 Correlation analysis

Correlation represents the association between adjacent pixels of an image, and for an encryption algorithm, a lower correlation means better encryption [23]. Lena correlation from Fig. 9 shows that the plaintext images are concentrated in the diagonal region with extremely high correlation. However, the ciphertext image is the opposite; it is evenly distributed throughout the region and has only a low correlation. Meanwhile, it can be observed quantitatively from Table 9 that the correlation of plaintext images is approaching to 1, while, the correlation of ciphertext images is approaching to 0. And, as shown in Table 10, this algorithm can decrease the correlation of images more effectively than other algorithms

$$\begin{aligned} {{\gamma }_{xy}}= & {} \frac{{\text {cov}}(x,y)}{\sqrt{D(x)}\sqrt{D(y)}} \end{aligned}$$
(25)
$$\begin{aligned} {\text {cov}}(x,y)= & {} \frac{1}{N}\sum \limits _{i=1}^{N}{({{x}_{i}}-E(x))({{y}_{i}}-E(y))} \end{aligned}$$
(26)
$$\begin{aligned} D(x)= & {} \frac{1}{N}\sum \limits _{i=1}^{N}{{{({{x}_{i}}-E(x))}^{2}}} \end{aligned}$$
(27)
$$\begin{aligned} E(x)= & {} \frac{1}{N}\sum \limits _{i=1}^{N}{{{x}_{i}}}. \end{aligned}$$
(28)
Fig. 9
figure 9figure 9

Correlation analysis

Table 9 Correlation of adjacent pixels
Table 10 Comparison of correlation between adjacent pixels

5.6 Information entropy analysis

Information entropy represents the confusion level of the system. If the information entropy is large, it proves that the system is very messy. On the contrary, it means that the system is quite orderly. When encrypting an image, the greater the information entropy of the ciphertext image, the better the encryption effect. And the theoretical value is 8. It can be seen from Table 11 that the results of the encrypted images in this paper are approaching the ideal value 8. In Table 12, we can see that the information entropy of this paper is higher and the encryption effect is better compared with other encryption algorithms

$$\begin{aligned} H=-\sum \limits _{i=1}^{L}{p(i)}{{\log }_{2}}p(i). \end{aligned}$$
(29)
Table 11 Information entropy analysis
Table 12 Information entropy comparison

5.7 Differential attack analysis

The pixel number change rate (NPCR) and the uniform average change intensity (UACI) are commonly used to measure the sensitivity of plaintext images and also for quantitative and qualitative analyses of processed images. Here, the significance level \(\alpha =0.05\) is defined. In Table 13, if the value of NPCR is higher than the critical score \(\textrm{NPCR}_{0.05}^{*}\) and the value of UACI falls into the critical interval \((\textrm{UACI}_{0.05}^{*-},\textrm{UACI}_{0.05}^{*+})\), we can assume that the encrypted image is resistant to differential attacks. The experimental results are shown in Table 14. It can be found in the table that the NPCR values of the three channels of each color image are greater than the critical theoretical value, and the UACI values fall within the theoretical interval. In addition, the values calculated in the table are very close to the ideal value of NPCR 99.6094\(\%\) and UACI 33.4635\(\%\), which indicates that the encryption algorithm has an excellent ability to resist differential attacks. At the same time, Table 15 can prove that this algorithm has stronger anti-differential attack performance than other algorithms

$$\begin{aligned} \textrm{NPCR}({{P}_{1}},{{P}_{2}})= & {} \frac{1}{MN}\sum \limits _{i=1}^{M}{\sum \limits _{j=1}^{N}{D(i,j)}}\times 100\% \end{aligned}$$
(30)
$$\begin{aligned} \textrm{UACI}({{P}_{1}},{{P}_{2}})= & {} \frac{1}{MN}\sum \limits _{i=1}^{M}{\sum \limits _{j=1}^{N}{\frac{|{{P}_{1}}(i,j)-{{P}_{2}}(i,j)|}{255}}}\times 100\%. \end{aligned}$$
(31)
Table 13 Index judgment
Table 14 The resistance to differential attack test of the picture
Table 15 Comparison of resistance to differential attacks

5.8 Robustness analysis

Robustness can be used to describe the anti-interference ability of cryptographic systems. During information transmission, information loss or noise interference is inevitable. Therefore, the encryption algorithm must be effective at restoring the image. In this paper, the Pepper ciphertext image with the size of \(512\times 512\) is subjected to data clipping and noise interference, and then decrypted, and the results are shown in Figs. 10 and 11. It is easy to find that the Pepper image affected by various cropping attacks and noise interference can still obtain the main feature information of the original image after decryption. It is proved that the encryption scheme can effectively resist cropping attacks and noise interference.

Fig. 10
figure 10

Shear attack resistance test of Pepper image

Fig. 11
figure 11

Experimental results of anti-salt-pepper noise attack in Pepper diagram

5.9 Encryption and decryption time

To meet the realistic needs of image encryption, it is necessary to measure the encryption time. Calculate the average encryption time of several color images with the size of \(256\times 256\) and \(512\times 512\), and get the results in Table 16. At the same time, compare with other image encryption algorithms in Table 17, the encryption time of this algorithm is relatively short.

Table 16 Image encryption time test
Table 17 Comparison of encryption duration

6 Conclusions

This paper first proposes a new 2D-SAHM chaotic system, which can be seen as the combination of Sine mapping and Henon mapping. Compared with the traditional two-dimensional mapping, this system has a wider parameter range and better chaotic characteristics and can produce chaotic sequences with stronger randomness. And then, based on this system, this paper designs the image encryption algorithm of scrambling and diffusion operation. And this algorithm first uses 2D-SAHM chaotic system and SHA-256 hash function to obtain the chaotic sequence related to the plaintext image. Then, it uses the double Joseph algorithm to scramble and block the plaintext image. After that, the algorithm uses new DNA operation rules to complete pixel diffusion Finally, the simulation results and performance analysis show that the new DNA operation rules in the algorithm solve the problem that traditional DNA encryption relies too much on the chaotic sequence, and further enhance the security and anti-interference ability of the encryption algorithm.