1 Introduction

In recent years, with the rapid development of the Internet and modern communications, the quantity of data for multimedia transmission and sharing has increased significantly. Digital images are widely used in personal, social, national and other fields as an important multimedia resource. The question of how to ensure the safe transmission of images has piqued the interest of an increasing number of people. Since digital images are characterized by high data redundancy and large data volume, they are susceptible to various attack types throughout the transmission process. Therefore, image encryption algorithms have been extensively studied. However, due to the amount of information included in the image, classic encryption algorithms such as AES and DES [1, 2] are no any longer applicable in the field of image encryption. For a large amount of information, the encryption speed will be very slow. Research on more applicable image encryption methods has become a more urgent need in real applications. In 1989, the mathematician Matthews introduced chaos into the encryption system for the first time, and proposed and explained the concept of chaotic cryptography [3]. Since then, various schemes have been developed for chaos-based image encryption, which show higher encryption efficiency compared with traditional image encryption methods. In 1998, Fridrich J was the first to propose an image encryption algorithm based on a chaotic system [4]. Then, some researchers continue to propose image encryption schemes that make considerable use of chaotic systems. Nezhad et al. proposed a chaos-based image encryption algorithm using Tent chaos map and DNA coding [5]. Moumen et al. proposed an image encryption method based on steganographic LSB, AES and RSA algorithms [6]. This algorithm eliminates the secret key sharing step in the encryption process. Ye et al. proposed a quantum logistic image encryption algorithm based on SHA-3 and RSA. The proposed algorithm is very suitable for secure communication in public cryptosystems [7]. Sun et al. [8] proposed an optical color image encryption scheme based on fingerprint keys, which can encrypt the primary color image hidden in the grayscale carrier image into three noise-like holograms. Li et al. introduced a two-dimensional smooth map and investigated its robustness to chaos in infinite parameter spaces [9]. At the same time, a chaos-based pseudo-random number generator is designed based on the optimized robust chaotic map. The analysis shows that the pseudo-random number generator has high randomness. Yu et al. [10] proposed an encryption separation algorithm using compressed sensing, which has the potential to greatly increase the key space while also significantly improving the algorithm’s security. Moumen et al. proposed a new secure partial encryption method for medical images using the graph coloring problem, and experiments show that encrypted data have better security [11]. Huang et al. proposed a two-dimensional linear canonical transform for an optical multi-image encryption scheme [12], using two-dimensional LCT parameters and Logistic map as the master key to expanding the key space. Zhou et al. proposed an image encryption algorithm based on circle index table scrambling and partition diffusion [13]. Through experimental analysis, the superiority of this scheme is verified.

Because of their fast iteration speed and easy implementation, low-dimensional chaotic systems are commonly used in image encryption. Liu et al. proposed a digital image watermarking method based on Logistic and RSA encryption [14]. Li et al. proposed a chaos-based bit-level permutation encryption scheme for color images [15], using Tent chaotic map to generate control sequences, but because the Tent chaotic map parameters are relatively singular, the chaotic space is small, and it is insecure and easy to predict. With continuous research, many scholars have discovered that low-dimensional chaotic systems have a small number of variables and parameters, and the key space is small, which makes their structure simple and therefore insecure. High-dimensional chaotic systems are more complex, have more control parameters and have better randomness than low-dimensional chaotic systems. As a result, numerous researchers use high-dimensional chaotic systems for image encryption algorithms. Hosny et al. proposed a hyperchaotic image encryption algorithm [16]. The algorithm uses a six-dimensional hyperchaotic system and uses the Fibonacci Q-matrix to diffuse the image. Liu et al. proposed an encryption algorithm based on compressed sensing and nonlinear diffusion. The designers proposed a new five-dimensional chaotic system with a more complex key stream [17]. High-dimensional chaotic maps have more variables or parameters, so there is a larger chaotic space. However, this requires considerable time, so it is not suitable for real-time applications [18]. Therefore, in recent years, some scholars have proposed new chaotic systems and designed chaotic maps with more complex and rich dynamical behaviors. Teng et al. constructed a crossed 2D hyperchaotic map using a nonlinear function and two chaotic maps with crossed structures [19]. Additionally, the control parameter range is larger, and the chaotic system can have the complex chaotic trajectory phenomenon of a high-dimensional chaotic system, so complex chaotic behavior is easier to realize. Hua et al. proposed a chaotic 2D-LASM map with higher ergodicity [20], and the proposed new chaotic system has larger parameters scope. Li et al. propose a scheme for self-reproducing dynamics in a two-dimensional discrete map, to study self-reproducing dynamics in discrete-time systems by constructing a two-dimensional map with an infinite number of fixed points [21]. Ye et al. developed an elliptic curve public key cryptography algorithm and proposed a new ImproBsys chaotic system with better chaotic behavior. It has two positive Lyapunov exponents to show hyperchaotic phenomena [22].

Generally, image processing algorithms are more complex and take much longer to calculate. Quantum computing has made breakthrough progress. Using the superposition characteristics of quantum states, computing efficiency can be greatly improved. Combining quantum images with classical image encryption is a safe and effective cryptographic system scheme. Some scholars have designed a variety of quantum image representation models [23,24,25,26,27,28,29,30,31,32]. Among them, flexible representation of quantum image (FRQI) and novel enhanced quantum representation (NEQR) models are frequently used because their coding modes are similar to classical images. The NEQR model can accurately restore the original information through measurement [33]. Zhou et al. used the NEQR representation model to propose a quantum image encryption method based on the Lorenz hyperchaotic system [34]. Hu et al. proposed a quantum image encryption algorithm based on Logistic map, using the generalized Arnold transform. It performs very well improving the efficiency of image encryption algorithms [35]. Liu et al. proposed a three-level quantum image encryption algorithm based on Logistic map [36]. Using Quantum Arnold Transform (QArT) to process qubits representing position information, the proposed encryption method has higher security. In addition, the processing efficiency is higher than that of the traditional encryption scheme. Dai et al. [37] proposed a novel quantum multi-image compression encryption algorithm based on the quantum discrete cosine transform and four-dimensional hyperchaotic Henon map. Luo et al. proposed an image encryption scheme based on hyperchaos and quantum coding [38]. It is performed by a bit-level adjacency swap operation, which has less complexity than a traditional bit-level swap operation.

In response to the above problems, we proposed a new 2D cross \(Sine^2-Logistic\) chaotic map, and proposed a quantum image encryption method based on the chaotic map. The simulation results derived from bifurcation diagrams, phase diagrams and Lyapunov exponents show that the 2D cross \(Sine^2-Logistic\) map has a hyperchaotic state and very good chaotic performance. The method proposed in this paper combines quantum images with classical encryption methods. Specifically, the novel enhanced quantum representation (NEQR) model is used to represent a traditional digital image as a quantum state. The key is related to the plaintext image; that is, different grayscale images generate different keys, which improves the resistance to the selected plaintext attack safety. The gray value of the quantum state is changed by the quantum selective scrambling method, and the diffusion effect can be achieved by scrambling the position level. A chaos-based row/column cyclic shift operation is used to change the position of the gray value. Moreover, in order to improve the security of the algorithm, a diffusion method of quantum overlapping feedback diffusion is proposed, which diffuses the scrambled image and finally obtains the encrypted image.

The main contributions of this paper are as follows:

  1. 1.

    A new type of two-dimensional cross hyperchaotic map is proposed, which solves the shortcomings of the small key space and simple structure of low-dimensional chaotic systems, and overcomes the obvious periodic window behavior of existing chaotic maps. It greatly improves the range of control parameters, solves the defects of slow iteration speed and high computational cost of high-dimensional chaotic systems, realizes the complexity of chaotic mapping, is easier to implement and shows very good chaotic behavior.

  2. 2.

    A quantum selection scrambling operation based on the NEQR model is proposed. By scrambling the qubit level, the pixel value can be changed, the effect of diffusion can be achieved at the same time, and the security of the data can be improved.

  3. 3.

    A chaos-based quantum overlapping feedback diffusion method is proposed, which further improves the security of the algorithm and improves the avalanche effect of the encryption algorithm. Even a small change in the original plaintext will cause a large difference in the ciphertext image.

The remaining sections of this article are organized as follows. Section 2 details the 2D cross \(Sine^2-Logistic\) hyperchaotic system and evaluates its chaotic behavior. Section 3 introduces the NEQR quantum image representation model. Section 4 introduces the quantum selective scrambling method in detail. Section 5 introduces the overlapping feedback diffusion method of the quantum image. Section 6 describes the proposed quantum image encryption scheme in detail. Section 7 describes the simulation results and performance analysis. Conclusions are provided in Sect. 8.

2 The proposed 2D hyperchaotic map

2.1 Definition of the 2D cross \(Sine^2-Logistic\) hyperchaotic system

In this paper, we propose a new 2D cross \(Sine^2-Logistic\) hyperchaotic system with two input states \(x_n,y_n\) and two cross outputs states \(x_{n+1},y_{n+1}\). The mathematical expression of this cross-system is shown in Eq. (1). Generally, functions \(f_1\) and \(f_2\) are two chaotic maps. The output is \(x_{n+1}\) when the input is \(y_n\) and \(y_{n+1}\) when the input is \(x_n\).

$$\begin{aligned} {\left\{ \begin{array}{ll}x_{n+1}=f_1(y_n)\\ y_{n+1}=f_2(x_n) \end{array}\right. } \end{aligned}$$
(1)

Here, we designed and improved the cross-chaotic system. The sine square chaotic system and the classic logistic chaotic system are introduced. In particular, it needs to be pointed out that the System (2) combines the characteristics of sine chaotic map and logistic chaotic map and retains the advantages of the low-dimensional chaotic system such as fast iteration speed and high operating efficiency. Additionally, our hyperchaotic system effectively avoids the security risks caused by the periodic window embedded in chaotic domain. Experimental analysis shows that this 2D system exhibits excellent hyperchaotic behavior. The state equations of the 2D cross \(Sine^2-Logistic\) hyperchaotic system are shown in Eq. (2).

$$\begin{aligned} {\left\{ \begin{array}{ll}x_{n+1}=\textrm{sin}^2({\mu }*\textrm{arcsin}\sqrt{y_n}) \\ y_{n+1}={\alpha }*x_n*(1-x_n) \end{array}\right. } \end{aligned}$$
(2)

where \( {\alpha },{\mu }\) are control parameters. When \({\alpha }=4,{\mu }\in [0.5,+\infty ]\), the chaotic system has good hyperchaotic behavior. That is, there are two stable positive Lyapunov exponents.

2.2 Performance analysis

2.2.1 Bifurcation diagram

The chaotic behavior of the system may be determined using the bifurcation diagram of the chaotic sequence. To better describe the dynamic behavior and performance improvement of this 2D cross \(Sine^2-Logistic\) hyperchaotic system, we compare its bifurcation diagram with the bifurcation diagrams of the original Sine map and the Logistic map, as shown in Fig. 1.

Fig. 1
figure 1

a Sine map; b logisitc map; c \({Sine^2-Logistic}\) map of x sequence for \({\mu }\in [0,4]\); d \({Sine^2-Logistic}\) map of y sequence for \({\mu }\in [0,4]\); e \({Sine^2-Logistic}\) map of x sequence for \({\mu }\in [0,50]\); f \({Sine^2-Logistic}\) map of y sequence for \({\mu }\in [0,50]\)

From Fig. 1a, b, it is not difficult to find that the Sine map and Logistic map only exhibit chaotic properties in a small range of parameters and furthermore, manifest distinct periodic window behavior. Figure 1c, d shows bifurcations of the x-sequence and y-sequence in the \(Sine^2-Logistic\) hyperchaotic systems, respectively, when the initial conditions are \(x_0=0.3538\) and \(y_0=0.4262\) and the control parameter \({\mu }\in [0,4]\). This hyperchaotic map has a larger parameter range and better stochasticity than the Sine and Logistic map and presents a full mapping state more quickly when entering chaotic behavior.

To better demonstrate the long-range validity of this hyperchaotic system parameter, we control the parameters \({\mu }\) to keep increasing, and the System (2) still has excellent chaotic behavior. Figure 1e, f shows the bifurcation results of \({\mu }\in [0,50]\). As a result, the 2D cross \(Sine^2-Logistic\) hyperchaotic system has a larger range of control parameters and better stochasticity than the traditional Sine map and Logistic map.

2.2.2 Phase diagram

The phase diagram represents the distribution of chaotic attractors on the two-dimensional phase plane. The larger the area occupied in the phase diagram is, the better the chaotic performance of the chaotic system. The initial conditions are set to \(x_0=0.3538\) and \(y_0=0.4262\), and the phase diagram of system (2) is shown in Fig. 2. Figure 2a is the phase diagram of the 2D Logistic Map (2D-LM) [39], Fig. 2b is the phase diagram of the 2D Sine Logistic Modulation Map (2D-SLMM) [40], and Fig. 2c, d is the 2D cross \(Sine^2-Logistic\) phase diagrams when the parameters \({\mu }=3.6239\) and \({\mu }=6.9521\).

The results show that our system is more distributed, covering almost all areas, and not clustered in one region. In other words, the hyperchaotic sequence generated by system (2) is a uniform random sequence with good ergodic properties.

Fig. 2
figure 2

a 2D-LM; b 2D-SLMM; c \(Sine^2-Logistic\) map phase diagram for \({\mu }=3.6239\); d \(Sine^2-Logistic\) map phase diagram for \({\mu }=6.9521\)

Fig. 3
figure 3

a Sine map; b logisitc map; c \({Sine^2-Logistic}\) map

2.2.3 Lyapunov exponent

Using the Lyapunov exponent, it is possible to describe the sensitivity of chaotic systems to initial values. To determine whether a nonlinear system has chaotic motion, it is necessary to check whether its Lyapunov exponent \(\lambda \) is positive.

There may be more than one Lyapunov exponent greater than zero in high-dimensional phase space, complicating the system’s motion. Chaos with more than one positive exponent in the high-dimensional phase space has been called hyperchaos.

Fig. 4
figure 4

a 0–1 test experiment comparison; b \({Sine^2-Logistic}\) map of x sequence for \({\mu } \in [0,50]\); c \({Sine^2-Logistic}\) map of y sequence for \({\mu } \in [0,50]\)

In a general sense, the higher the dimensionality is, the higher the possibility of hyperchaotic phenomena in nonlinear systems. However, high-dimensional chaotic systems usually have long iteration times and high computational complexity. This measurement uses the separation rate between infinitely close trajectories, as shown in Eq. (3).

$$\begin{aligned} {\lambda }={ \displaystyle \lim _{n \rightarrow \infty }} \frac{1}{n}\displaystyle \sum _{i=0}^{n-1}\ln \mid f^\prime (x_i) \mid \end{aligned}$$
(3)

Figure 3a, b shows the Lyapunov of Sine and Logistic chaotic maps. As can be shown, the Lyapunov exponent value of the two is greater than 0 only over a small parameter range. As shown in Fig. 3c, when the parameters of our proposed chaotic system are greater than 0.5, the Lyapunov exponent values are all greater than 0. The lower right part of Fig. 3c is a zoomed-in local area picture. Literature [9] proposed a compound operation-based optimization control method of complexity. Theoretical analysis shows that the values of Lyapunov exponent will increase in logarithmic form when the control parameters vary in real space. Thus, the complexity of the chaotic sequence increases. From this, we can also clearly see that the Lyapunov exponent of the proposed chaotic map increases with the increase in the parameters. Meanwhile, the chaotic system has two positive Lyapunov exponent values, indicating that the chaotic system we proposed is a hyperchaotic system with more complex dynamics. The chaos performance is better. Meanwhile, literature [13] mentions that the applied map can keep robust hyperchaotic behaviors by selecting proper parameters. In fact, our proposed chaotic map, when the control parameter is increased to a larger positive number, the value of the Lyapunov exponent is still a positive number, maintaining robust hyperchaotic behavior. Compared with the Sine map and the Logistic map, the 2D \({Sine^2-Logistic}\) chaotic system we proposed has a greater Lyapunov exponent value, a larger parameter range and exhibits good chaotic behavior.

2.2.4 The 0–1 test

The 0–1 test [41] is used to evaluate the chaotic performance of the proposed 2D cross \({Sine^2-Logistic}\) system. For \(c\in [0,\pi ]\), the 0–1 test value K of chaotic sequence \(\left\{ {W_j} \right\} ,j\in [1,2,\ldots ,n]\) is calculated as shown in Eq. (4):

$$\begin{aligned}{} & {} K = \frac{\log M_c (n)}{\log n} \end{aligned}$$
(4)
$$\begin{aligned}{} & {} \begin{aligned} M_c (n)&={\lim _{N \rightarrow \infty }}\frac{1}{N}\sum _{j=1}^{n}{[p_c(j+n)-p_c(j)]}^2 \\&\quad +{[q_c(j+n)-q_c(j)]}^2 \end{aligned} \end{aligned}$$
(5)
$$\begin{aligned}{} & {} p_c(n)= \displaystyle \sum _{j=1}^{n}W_j \textrm{cos}(ir) \end{aligned}$$
(6)
$$\begin{aligned}{} & {} q_c(n)= \displaystyle \sum _{j=1}^{n}W_j \textrm{sin}(ir) \end{aligned}$$
(7)

The closer K gets to 1, the more complex its dynamic behavior, and the faster it is equal to 1, the faster it enters into the chaotic state. Figure 4a presents the 0–1 test results of Sine, Logistic, and x, y sequences of the 2D cross \({Sine^2-Logistic}\) chaotic map, \({\mu }\in [0,4]\). Obviously, the proposed hyperchaotic system has more complex chaotic behavior than the other two systems.

To further demonstrate the long-range chaotic performance of this hyperchaotic system, we also calculated the K values, \({\mu }\in [0,50]\), as shown in Fig. 4b, c. Experimental results show that our chaotic system exhibits good chaotic behavior over a wide range of parameters.

Fig. 5
figure 5

a Sample entropy test comparison; b \({Sine^2-Logistic}\) map of x sequence for \({\mu }\in [0,50]\); c \({Sine^2-Logistic}\) map of y sequence for \({\mu }\in [0,50]\)

2.2.5 Sample entropy

Sample entropy is a measurement tool used to quantitatively measure the complexity of a dynamic system [42]. When sample entropy is positive, the nonlinear system behaves as chaos.

The two sequences x and y of the proposed hyperchaotic system demonstrate good chaotic performance. When \(\mu \) is greater than 0.6, the sample entropies are significantly higher than 1, as shown by the red and blue lines in Fig. 5a. In contrast, neither traditional Sine nor Logistic map has a sample entropy greater than 1. In other words, the complexity of this 2D cross \({Sine^2-Logistic}\) chaotic map is much higher than that of Sine map and Logistic map.

We tested the effect of increasing the parameter range on the sample entropy in this chaotic system in Fig. 5b, c. The results show that the system has consistently stable chaotic properties when the control parameter is extended. This means that if this proposed chaotic system is used as the random number generator of the cryptosystem, this cryptosystem will have a wider key space and can better resist brute-force attacks.

2.2.6 Sensitivity analysis of the initial value

Sensitivity to initial values is one of the important characteristics of chaotic systems. When the initial value changes slightly, completely different chaotic sequences will be generated.

We modified the initial values of Sine map and Logistic map as well as the proposed hyperchaotic system \(10^{-16}\). After about 55 iterations, the Sine and Logisitc chaotic sequences are completely different from the original sequences, as shown in Fig. 6a, b. However, the 2D cross \({Sine^2-Logistic}\) chaotic system requires only 25 iterations, and the generated chaotic sequences are completely different from the original, as shown in Fig. 6c, d. Therefore, the transient effects of chaotic systems can be effectively mitigated and the security of chaotic systems can be improved.

Fig. 6
figure 6

a Sine map; b logisitc map; c \({Sine^2-Logistic}\) map of x sequence; d \({Sine^2-Logistic}\) map of y sequence

2.2.7 NIST test

The NIST test is a tool for evaluating the nonlinear properties of chaotic systems and the stochastic performance of data [43]. NIST random tests include 16 different test measures, and each test will produce a P value. Only when the P value is within the range of [0.01, 1], the test be judged to have passed. We performed NIST random tests on the data sequences generated by the 2D cross \({Sine^2-Logistic}\) hyperchaotic system, and the results are listed in Table 1. All results pass the tests, indicating that our chaotic sequences have measurable randomness.

Table 1 NIST statistical test results

In addition to the above performance analysis, we also analyze the complexity of the chaotic system. We iterate through different chaotic systems and compare them with our proposed chaotic system. Among them, the 2D Sine Logistic modulation graph is from the literature [40], as shown in Eq. (8). It can be found that the chaotic map also uses the sine function. Additionally, it is compared with other two-dimensional chaotic systems. Table 2 shows that the iteration time of the proposed chaotic system is longer than that of the same-dimensional chaotic system, but the iteration is generally fast. Furthermore, the proposed chaotic system still exhibits hyperchaotic behavior even with a two-dimensional chaotic map.

Table 2 Iterative comparison of chaotic systems
$$\begin{aligned} {\left\{ \begin{array}{ll}x_{n+1}={\alpha }(\textrm{sin}({\pi }y_n)+\beta )x_n(1-x_n) \\ y_{n+1}={\alpha }(\textrm{sin}({\pi }x_{n+1})+\beta )y_n(1-y_n) \end{array}\right. } \end{aligned}$$
(8)

The above performance analysis shows that our proposed chaotic system has a very large parameter range and has hyperchaotic behavior. At the same time, it exhibits good chaotic characteristics, and can generate more complex chaotic sequences. In applications, it is very suitable for encryption systems.

3 NEQR representation model

Zhang et al. [24] improved the FQRI model and proposed a novel enhanced quantum representation (NEQR) model for representing quantum images. A grayscale image I of \(2^n \times 2^n\) is represented by the NEQR model as follows:

$$\begin{aligned} |I\rangle =\frac{1}{2^n} \displaystyle \sum _{y=0}^{2^n -1}\sum _{x=0}^{2^n -1}|P_{YX}\rangle \otimes |yx\rangle \end{aligned}$$
(9)

where \(|P_{YX}\rangle =|p_{yx}^7p_{yx}^6 \cdots p_{yx}^1p_{yx}^0\rangle \) denotes the grayscale information of the pixel corresponding to the position \(|yx\rangle \), and \(|yx\rangle =|y\rangle |x\rangle =|y_{n-1}y_{n-2} \cdots y_0\rangle |x_{n-1}x_{n-2} \cdots x_0\rangle \) is the position coordinate; the symbol \(\otimes \) represents the tensor product operation. Take a \(2 \times 2\) sized quantum image as an example, as shown in Fig. 7, and its NEQR model is represented as Eq. (10):

$$\begin{aligned} \begin{aligned} |I\rangle&=\frac{1}{2}(|0\rangle \otimes |00\rangle +|100\rangle \otimes |01\rangle +|200\rangle \otimes |10\rangle \\&\quad +|255\rangle \otimes |11\rangle ) \\&=\frac{1}{2}(|00000000\rangle \otimes |00\rangle +|01100100\rangle \otimes |01\rangle \\&\quad +|11001000\rangle \otimes |10\rangle +|11111111\rangle \otimes |11\rangle ) \end{aligned} \end{aligned}$$
(10)

4 Qubit-level selection scrambling

In this section, we propose a quantum selective scrambling method. The method consists of three functional modules: qubit-level shift operation, qubit-level cross-XOR-Shift operation and qubit-level cyclic shift operation. Qubits are selectively scrambled to alter the grayscale of a quantum image diffuse the image.

4.1 Qubit-level shift operation

We design a quantum circuit consisting of controlled swap gates. The value of each pixel (Y, X) is changed by using a qubit-level shift operation.

Fig. 7
figure 7

A grayscale image represented by NEQR model

Taking the quantum circuit shown in Fig. 8 as an example, we perform a shift operation on the qubits, i.e., first swap the 7th qubit with the 3rd qubit, the 6th qubit with the 2nd qubit, the 5th qubit with the 1st qubit, and the 4th qubit with the 0th qubit, and then swap the 6th qubit with the 5th qubit, the 4th qubit with the 3rd qubit and the 2nd qubit with the 1st qubit. The resulting qubit-level can be expressed as:

$$\begin{aligned} \begin{aligned} |p_{yx}^{7^\prime }\rangle =|p_{yx}^3\rangle \qquad |p_{yx}^{6^\prime }\rangle =|p_{yx}^1\rangle \\ |p_{yx}^{5^\prime }\rangle =|p_{yx}^2\rangle \qquad |p_{yx}^{4^\prime }\rangle =|p_{yx}^7\rangle \\ |p_{yx}^{3^\prime }\rangle =|p_{yx}^0\rangle \qquad |p_{yx}^{2^\prime }\rangle =|p_{yx}^5\rangle \\ |p_{yx}^{1^\prime }\rangle =|p_{yx}^6\rangle \qquad |p_{yx}^{0^\prime }\rangle =|p_{yx}^4\rangle \\ \end{aligned} \end{aligned}$$
(11)

For the pixel value (Y, X), the qubit-level shift operation can be realized by the controlled swap gate \(U_{YX}\), and the controlled swap gate \(U_{YX}\) is defined as:

$$\begin{aligned} \begin{aligned} U_{YX}(|P_{YX}\rangle )&=U_{YX}(|p_{yx}^7p_{yx}^6 \cdots p_{yx}^1p_{yx}^0\rangle )\\&=|p_{yx}^3p_{yx}^1p_{yx}^2p_{yx}^7p_{yx}^0p_{yx}^5p_{yx}^6p_{yx}^4\rangle \end{aligned} \end{aligned}$$
(12)

The gray value is changed from \(|p_{yx}^7p_{yx}^6 \cdots p_{yx}^1p_{yx}^0\rangle \) to \(|p_{yx}^3p_{yx}^1p_{yx}^2p_{yx}^7p_{yx}^0p_{yx}^5p_{yx}^6p_{yx}^4\rangle \) by the shift operation on the qubit-level. Although swap gates only change the position of the qubits, they change the pixel value to achieve diffusion.

Fig. 8
figure 8

Quantum circuit for qubit-level shift operations

Fig. 9
figure 9

Quantum circuit with cross-XOR-shift operation

4.2 Qubit-level cross-XOR-shift operation

In the proposed scheme, cross exclusive OR and shift operations are performed on the qubit level, as shown in Fig. 9.

First the XOR operation of the quantum bit is performed. In quantum circuits, CNOT gates are used to implement the XOR operation. The specific execution process is as follows: the 0th qubit is XOR with the 7th qubit to obtain the new 7th qubit state, the 1st qubit is XOR with the 6th qubit to obtain the new 6th qubit state, the 2nd qubit is XOR with the 5th qubit to get the new 5th qubit state, the 3rd qubit is XOR with the 4th qubit to get the new 4th qubit state. The resulting qubits are expressed as:

$$\begin{aligned} \begin{aligned}&|p_{yx}^{7^\prime }\rangle =|p_{yx}^0 \oplus p_{yx}^7\rangle \qquad |p_{yx}^{6^\prime }\rangle =|p_{yx}^1 \oplus p_{yx}^6\rangle \\&|p_{yx}^{5^\prime }\rangle =|p_{yx}^2 \oplus p_{yx}^5\rangle \qquad |p_{yx}^{4^\prime }\rangle =|p_{yx}^3 \oplus p_{yx}^4\rangle \\&|p_{yx}^{3^\prime }\rangle =|p_{yx}^3\rangle \qquad |p_{yx}^{2^\prime }\rangle =|p_{yx}^2\rangle \\&|p_{yx}^{1^\prime }\rangle =|p_{yx}^1\rangle \qquad |p_{yx}^{0^\prime }\rangle =|p_{yx}^0\rangle \\ \end{aligned} \end{aligned}$$
(13)

The gray value changes from\(|p_{yx}^7p_{yx}^6 \cdots p_{yx}^1p_{yx}^0\rangle \) to \(|p_{yx}^{7^\prime }p_{yx}^{6^\prime } \cdots \) \( p_{yx}^{1^\prime }p_{yx}^{0^\prime }\rangle \).

Second, the bit-level shift operation on the gray value\(|p_{yx}^{7^\prime }p_{yx}^{6^\prime } \) \(\cdots p_{yx}^{1^\prime } p_{yx}^{0^\prime }\rangle \) can be implemented by the controlled swap gate \(U_{YX}\). The gray value is changed from \(|p_{yx}^{7^\prime }p_{yx}^{6^\prime } \cdots p_{yx}^{1^\prime }p_{yx}^{0^\prime }\rangle \) to \(|p_{yx}^{3^\prime }p_{yx}^{5^\prime }p_{yx}^{1^\prime }p_{yx}^{4^\prime }p_{yx}^{0^\prime }p_{yx}^{2^\prime }p_{yx}^{6^\prime }p_{yx}^{7^\prime }\rangle \), and the obtained qubits can be expressed as:

$$\begin{aligned} \begin{aligned} \qquad&|p_{yx}^{7^\prime }\rangle =|p_{yx}^{3^\prime }\rangle \qquad |p_{yx}^{6^\prime }\rangle =|p_{yx}^{5^\prime }\rangle \\ \qquad&|p_{yx}^{5^\prime }\rangle =|p_{yx}^{1^\prime }\rangle \qquad |p_{yx}^{4^\prime }\rangle =|p_{yx}^{4^\prime }\rangle \\ \qquad&|p_{yx}^{3^\prime }\rangle =|p_{yx}^{0^\prime }\rangle \qquad |p_{yx}^{2^\prime }\rangle =|p_{yx}^{2^\prime }\rangle \\ \qquad&|p_{yx}^{1^\prime }\rangle =|p_{yx}^{6^\prime }\rangle \qquad |p_{yx}^{0^\prime }\rangle =|p_{yx}^{7^\prime }\rangle \\ \end{aligned} \end{aligned}$$
(14)

By the controlled swap gate \(U_{YX}\), the pixel value (YX) of the quantum image can execute the qubit-level cross-XOR-shift operations; then, the controlled swap gate can be defined as:

$$\begin{aligned} \begin{aligned} U_{YX}(|P_{YX}\rangle )&=U_{YX}(|p_{yx}^7p_{yx}^6 \cdots p_{yx}^1p_{yx}^0\rangle )\\&=|p_{yx}^{3^\prime }p_{yx}^{5^\prime }p_{yx}^{1^\prime }p_{yx}^{4^\prime }p_{yx}^{0^\prime }p_{yx}^{2^\prime }p_{yx}^{6^\prime }p_{yx}^{7^\prime }\rangle \end{aligned} \end{aligned}$$
(15)

4.3 Qubit-level cyclic shift operation

The cyclic left shift operation of the pixel value(YX) is realized through the quantum swap gate. As shown in Fig. 10, the pixel value (Y, X) of the quantum image is cyclically shifted t times to the left. The left side of Fig. 10 illustrates that the quantum bits are sequentially cyclically shifted 1 bit left, i.e.,\(|p_{yx}^7\rangle \) to \(|p_{yx}^6\rangle \) to \(|p_{yx}^5\rangle \) to \(|p_{yx}^4\rangle \) to \(|p_{yx}^3\rangle \) to \(|p_{yx}^2\rangle \) to \(|p_{yx}^1\rangle \) to \(|p_{yx}^0\rangle \) to \(|p_{yx}^7\rangle \). The right side of Fig. 10 shows the result of a circular left shift of t bits.

The controlled swap gate \(U_{YX}\) performs a qubit-level cyclic shift operation on the pixel value (Y,X). The \(U_{YX}\) is defined as:

$$\begin{aligned} \begin{aligned} U_{YX}(|P_{YX}\rangle )&=U_{YX}(|p_{yx}^7p_{yx}^6 \cdots p_{yx}^1p_{yx}^0\rangle )\\&=|p_{yx}^{7-t} \cdots p_{yx}^0 \cdots p_{yx}^{7-t+1}\rangle \end{aligned} \end{aligned}$$
(16)

In addition, the entire quantum image can be completed through the cyclic shift control sequence \(CS=\left\{ t_1,t_2,\ldots ,t_{2^{2n}}\right\} \). \(2^{2n}\) is the total number of pixels in the image, and CS can be generated by the sender and receiver of the data through a chaotic system; see Sect. 6 for details.

Fig. 10
figure 10

Quantum circuit of qubit-level cyclic shift operation

5 Overlapping feedback diffusion of quantum images

In order to improve the avalanche effect of the encryption algorithm, an overlapping feedback diffusion method of quantum images is proposed, as shown in Fig. 11. Small changes in the original plaintext will also cause great differences in the ciphertext. The quantum overlapping feedback diffusion operation is shown in Eq. (17):

$$\begin{aligned} {\left\{ \begin{array}{ll}|c_{yx}^j\rangle =|C_{y-1x}^j\rangle \oplus |Z_{yx}^j\rangle \\ |C_{yx}^j\rangle =|c_{yx}^j\rangle \oplus |X1_{yx}^j\rangle \end{array}\right. } \end{aligned}$$
(17)

where X1 denotes the sequence of encryption keys, and the quantum image is used to store the encryption key. Therefore, the quantum key image \(|X1\rangle \) is generated using the NEQR model.

Z is the input of the diffusion operation. Depending on the actual encryption process, it can be either the original plaintext or the output result of the previous encryption operation. In our proposed algorithm, here Z is the result of the previous scrambling step. As a result, the NEQR model is used to construct the quantum image\(|Z\rangle \).

\(|c_{yx}^j\rangle \) is the j-th qubit of the y-th element of the x-th row in the diffusion intermediate result. \(|C_{y-1x}^j\rangle \) is the j-th qubit of the (\(y-1\))-th element of the x-th row in the diffusion output result. \(|C_{yx}^{j^\prime }\rangle \) is the j-th qubit of the y-th element of the x-th row in the diffusion output result.

where the first value of \(|C_{yx}^j\rangle \) is the inverse of the first value of the \(|Z_{yx}^j\rangle \) value. \(j=0\),1,2,...,7.

The result of quantum image overlap feedback diffusion related is not only to the encryption key, but also to the result of the previous qubit diffusion, which can satisfy the avalanche effect and improve the security of the algorithm.

Fig. 11
figure 11

Quantum circuit with overlapping feedback diffusion

Fig. 12
figure 12

Encryption flow chart

6 Quantum image encryption scheme

The designed quantum image encryption scheme consists of three stages. In the key generation stage, a 2D cross \(Sine^2-Logistic\) chaotic map is used to generate random key sequences related to the plaintext image. In the qubit-level scrambling stage, the quantum selective scrambling operation is used to scramble the position of the qubit, and at the same time, it can disguise pixel values, achieving the effect of confusion and diffusion. In the qubit-level diffusion stage, the avalanche effect of the encryption scheme is further improved using the overlapping feedback diffusion method. The proposed scheme’s specific implementation steps are described below, and the encryption flowchart is shown in Fig. 12.

Step 1. Use SHA-256 to calculate the hash value of the plaintext image I with the size of \(M \times N\). The following formula may be used to obtain the 256-bit hash value represented by a hexadecimal array:

$$\begin{aligned} H(I)=Sha256(I)=[h_1,h_2,\ldots ,h_{64}] \end{aligned}$$
(18)

Step 2. The initial value of the 2D cross \(Sine^2-Logistic\) chaotic map is generated using array H (I) in the following ways:

$$\begin{aligned} {\left\{ \begin{array}{ll}x_0=hex2dec(H(I)(\alpha :\alpha +7))\times 10^{-10}\\ y_0=hex2dec(H(I)(\beta :\beta +7))\times 10^{-10} \end{array}\right. } \end{aligned}$$
(19)

where hex2dec( ) represents the conversion function of the hexadecimal number to the decimal number. \(\alpha ,\beta \) are the keys set by the user.

Step 3. According to the NEQR model shown in Eq. (9), the classical image I is represented as a quantum image \(|I\rangle \).

Step 4. Iterate the 2D cross \(Sine^2-Logistic\) chaotic map with the initial values \(x_0,y_0\) obtain two pseudo-random sequences X, Y with lengths of \(M \times N\). The pseudo-random sequences X and Y are then mapped to between 0 and 255, representing X1 and Y1.

$$\begin{aligned} {\left\{ \begin{array}{ll}X=\left\{ x(1),x(2),x(3),\ldots ,x(M \times N)\right\} \\ Y=\left\{ y(1),y(2),y(3),\ldots ,y(M \times N)\right\} \end{array}\right. } \end{aligned}$$
(20)

Step 5. The cyclic row/column shift control sequences CRS1, CRS2, CCS1, CCS2 are obtained by segmentation:

$$\begin{aligned} {\left\{ \begin{array}{ll} CRS1=X1{(1:M)}\\ CRS2= X1{({M+1}:{2\times M})}\\ CCS1=Y1{(1:N)} \\ CCS2= Y1{({N+1}:{2 \times N})} \end{array}\right. } \end{aligned}$$
(21)

Step 6. The chaotic random sequence Y is mapped between 1 and 3, and between 1 and 4 to obtain the selection control sequence SC and the cyclic shift control sequence CS, respectively.

$$\begin{aligned} {\left\{ \begin{array}{ll}SC=uint8(mod(ceil(Y*10^6),3)+1) ,\\ \qquad \qquad SC \in [1,2,3]\\ CS=uint8(mod(ceil(Y*10^6),4)+1) ,\\ \qquad \qquad CS \in [1,2,3,4] \end{array}\right. }\nonumber \\ \end{aligned}$$
(22)

Step 7. The proposed quantum selective scrambling method (in Sect. 4) changes the gray value of the quantum image \(|I\rangle \). The controlled swap gate \(U_{YX}\) is defined as the sub-operation \(S_{YX}\). The specific description is as follows:

$$\begin{aligned} S_{YX}{} & {} =\left( I \otimes \sum _{y=0}^{2^n -1}\sum _{\begin{array}{c} x=0 \\ {yx \ne YX} \end{array}}^{2^n -1} |yx\rangle \langle yx|\right) \nonumber \\ {}{} & {} \qquad +{\left\{ \begin{array}{ll}U_{YX} \otimes |YX\rangle \langle YX|,SC=1\\ U_{YX} \otimes |YX\rangle \langle YX|,SC=2\\ U_{YX} \otimes |YX\rangle \langle YX|,SC=3 \end{array}\right. } \end{aligned}$$
(23)

The qubit-level selective shift operation of the pixel value, which can be realized by the quantum sub-operation \(S_{YX}\);

$$\begin{aligned} \begin{aligned}&S_{YX}|I\rangle \\ {}&=S_{YX}\left( \frac{1}{2^n} \sum _{y=0}^{2^n -1}\sum _{x=0}^{2^n -1}|P_{yx}\rangle |yx\rangle \right) \\&=\frac{1}{2^n}S_{YX} \left( \sum _{y=0}^{2^n -1}\sum _{\begin{array}{c} x=0 \\ {yx \ne YX} \end{array}}^{2^n -1}|P_{yx}\rangle |yx\rangle +|P_{YX}\rangle |YX\rangle \right) \\&=\frac{1}{2^n}\left( \sum _{y=0}^{2^n -1}\sum _{\begin{array}{c} x=0 \\ {yx \ne YX} \end{array}}^{2^n -1}|P_{yx}\rangle |yx\rangle \right. \\&\left. +{\left\{ \begin{array}{ll}U_{YX} |P_{YX}\rangle |YX\rangle ,SC=1 \\ U_{YX} |P_{YX}\rangle |YX\rangle ,SC=2\\ U_{YX} |P_{YX}\rangle |YX\rangle ,SC=3\end{array}\right. } \!\!\!\!\!\!\right) \\ {}&=\frac{1}{2^n}\left( \sum _{y=0}^{2^n -1}\sum _{\begin{array}{c} x=0 \\ {yx \ne YX} \end{array}}^{2^n -1}|P_{yx}\rangle |yx\rangle + \right. \\&\left. {\left\{ \begin{array}{ll}|p_{YX}^3p_{YX}^1p_{YX}^2p_{YX}^7p_{YX}^0p_{YX}^5p_{YX}^6p_{YX}^4\rangle |YX\rangle ,SC=1\\ |p_{YX}^{3^\prime }p_{YX}^{5^\prime }p_{YX}^{1^\prime }p_{YX}^{4^\prime }p_{YX}^{0^\prime }p_{YX}^{2^\prime }p_{YX}^{6^\prime }p_{YX}^{7^\prime }\rangle |YX\rangle ,SC=2\\ |p_{YX}^{7-t} \cdots p_{YX}^0 \cdots p_{YX}^{7-t+1}\rangle |YX\rangle ,SC=3\end{array}\right. } \!\!\!\!\!\!\right) \end{aligned} \end{aligned}$$
(24)
$$\begin{aligned} \begin{aligned}&S_{{Y_1}{X_1}}S_{YX}|I\rangle \\ {}&=S_{{Y_1}{X_1}}(S_{YX}(\frac{1}{2^n} \sum _{y=0}^{2^n -1}\sum _{x=0}^{2^n -1}|P_{yx}\rangle |yx\rangle )) \\ {}&=\frac{1}{2^n}\left( \sum _{y=0}^{2^n -1}\sum _{\begin{array}{c} x=0 \\ {yx \ne YX,{Y_1}{X_1}} \end{array}}^{2^n -1}|P_{yx}\rangle |yx\rangle \right. \\&\left. \quad + {\left\{ \begin{array}{ll}U_{YX} |P_{YX}\rangle |YX\rangle ,SC=1\\ U_{YX} |P_{YX}\rangle |YX\rangle ,SC=2\\ U_{YX} |P_{YX}\rangle |YX\rangle ,SC=3 \end{array}\right. } \right. \\&\left. \quad + {\left\{ \begin{array}{ll}U_{YX} |P_{{Y_1}{X_1}}\rangle |{Y_1}{X_1}\rangle ,SC=1\\ U_{YX} |P_{{Y_1}{X_1}}\rangle |{Y_1}{X_1}\rangle ,SC=2\\ U_{YX} |P_{{Y_1}{X_1}}\rangle |{Y_1}{X_1}\rangle ,SC=3 \end{array}\right. }\!\!\!\!\!\!\right) \\ {}&=\frac{1}{2^n}\Bigg (\sum _{y=0}^{2^n -1}\sum _{\begin{array}{c} x=0 \\ {yx \ne YX,{Y_1}{X_1}} \end{array}}^{2^n -1}|P_{yx}\rangle |yx\rangle \\&\quad +{\left\{ \begin{array}{ll}|p_{YX}^3p_{YX}^1p_{YX}^2p_{YX}^7p_{YX}^0p_{YX}^5p_{YX}^6p_{YX}^4\rangle |YX\rangle ,\\ \qquad SC=1\\ |p_{YX}^{3^\prime }p_{YX}^{5^\prime }p_{YX}^{1^\prime }p_{YX}^{4^\prime }p_{YX}^{0^\prime }p_{YX}^{2^\prime }p_{YX}^{6^\prime }p_{YX}^{7^\prime }\rangle |YX\rangle ,\\ \qquad SC=2\\ |p_{YX}^{7-t} \cdots p_{YX}^0 \cdots p_{YX}^{7-t+1}\rangle |YX\rangle ,\\ \qquad SC=3\end{array}\right. } \\ {}&\quad +{\left\{ \begin{array}{ll}|p_{{Y_1}{X_1}}^3p_{{Y_1}{X_1}}^1p_{{Y_1}{X_1}}^2p_{{Y_1}{X_1}}^7p_{{Y_1}{X_1}}^0p_{{Y_1}{X_1}}^5p_{{Y_1}{X_1}}^6p_{{Y_1}{X_1}}^4\rangle |{Y_1}{X_1}\rangle ,\\ \qquad \!SC=1\\ |p_{{Y_1}{X_1}}^{3^\prime }p_{{Y_1}{X_1}}^{5^\prime }p_{{Y_1}{X_1}}^{1^\prime }p_{{Y_1}{X_1}}^{4^\prime }p_{{Y_1}{X_1}}^{0^\prime }p_{{Y_1}{X_1}}^{2^\prime }p_{{Y_1}{X_1}}^{6^\prime }p_{{Y_1}{X_1}}^{7^\prime }\rangle |{Y_1}{X_1}\rangle \\ \qquad \!SC=2\\ |p_{{Y_1}{X_1}}^{7-t} \cdots p_{{Y_1}{X_1}}^0 \cdots p_{{Y_1}{X_1}}^{7-t+1}\rangle |{Y_1}{X_1}\rangle ,\!SC=3\end{array}\right. }\!\!\!\!\!\!\!\!\!\Bigg ) \end{aligned} \end{aligned}$$
(25)

We change all the pixel values of the quantum plaintext image \(|I\rangle \) to obtain the quantum selective scrambled image \(|I_1\rangle \) as follows:

$$\begin{aligned} S|I\rangle{} & {} =\prod _{Y=0}^{2^n -1}\prod _{X=0}^{2^n -1}S_{YX}|I\rangle \nonumber \\ {}{} & {} =\prod _{Y=0}^{2^n -1}\prod _{X=0}^{2^n -1}S_{YX}\left( \frac{1}{2^n}\sum _{Y=0}^{2^n -1}\sum _{X=0}^{2^n -1}|P_{YX}\rangle |YX\rangle \right) \nonumber \\ {}{} & {} =\frac{1}{2^n}\sum _{Y=0}^{2^n -1}\sum _{X=0}^{2^n -1}S_{YX}(|P_{YX}\rangle |YX\rangle ) \nonumber \\ {}{} & {} =\frac{1}{2^n}\sum _{Y=0}^{2^n -1}\sum _{X=0}^{2^n -1}{\left\{ \begin{array}{ll}|p_{YX}^3p_{YX}^1p_{YX}^2p_{YX}^7p_{YX}^0p_{YX}^5\\ \quad p_{YX}^6p_{YX}^4\rangle |YX\rangle ,SC=1\\ |p_{YX}^{3^\prime }p_{YX}^{5^\prime }p_{YX}^{1^\prime }p_{YX}^{4^\prime }p_{YX}^{0^\prime }p_{YX}^{2^\prime }\\ \quad p_{YX}^{6^\prime }p_{YX}^{7^\prime }\rangle |YX\rangle , SC=2\\ |p_{YX}^{7-t} \cdots p_{YX}^0 \cdots p_{YX}^{7-t+1}\rangle |YX\rangle ,\\ \quad SC=3\end{array}\right. } \nonumber \\{} & {} =\frac{1}{2^n}\sum _{Y=0}^{2^n -1}\sum _{X=0}^{2^n -1}|P^\prime _{YX}\rangle |YX\rangle \nonumber \\ {}{} & {} =|I^\prime \rangle \end{aligned}$$
(26)

Step 8. The chaos-based row/column cyclic shift method is used to change the position of image pixels and reduce the correlation between adjacent pixels. Classic grayscale information is accurately extracted from quantum image models by quantum measurement, as shown in Algorithm 1.

figure a
Fig. 13
figure 13

Chaos-based row/column cyclic shift operation

In the case of the \(4 \times 4\) image shown in Fig. 13, it is clear that the pixel values at each location have changed to achieve confusion. Then, an index scrambling operation is performed on the scrambled image, and finally, a scrambled image Z with a size of \(M \times N\) is obtained.

Step 9. The scrambled image Z can be expressed as a quantum state through Eq. (9) of NEQR.

Step 10. The final ciphertext image \(|C\rangle \) is obtained using overlapping feedback diffusion. The diagram in Fig. 14 briefly describes the chaotic overlapping feedback diffusion process, which achieves the avalanche effect and greatly improves the algorithm’s security.

Fig. 14
figure 14

Chaotic overlapping feedback diffusion process

Since this algorithm is symmetric, the decryption process is the inverse of the encryption process.

7 Experimental simulation and performance analysis

To verify the security and effectiveness of the algorithm, three grayscale images of 512\(\times \)512 “Boat,” “Pepper” and “Baboon,” a color image “Lung” and two gray images “House” and “Butterfly” of 256\(\times \)256 are used as test images.

The experiment was carried out in the following environment: Windows 10 operating system, numerical simulation in MATLAB R2015b. The simulation results of encryption and decryption are shown in Fig. 15. No meaningful information can be observed at all anymore from the encrypted images Fig. 15b, e, h. The decrypted images Fig. 15c, f, i completely reconstruct the original content of the plaintext images.

Fig. 15
figure 15

The results of encryption and decryption: a boat; b encrypted (a); c decrypted (b); d peppers; e encrypted (d); f decrypted (e); g lung; h encrypted (g); i decrypted (h)

7.1 Key space analysis

It is noted that an encryption algorithm’s key space is sufficiently large (greater than \(2^{100}\)), it may successfully resist brute force attacks [44]. The encryption algorithm proposed in this paper has three keys \(x_0, y_0,\mu \), and the accuracy of the initial key is set to \(10^{-16}\), so the key space is \({(10^{16})}^3=10^{48}>2^{100} \approx 1.27 \times 10^{30}\). Therefore, this encryption scheme has a large key space, which enables it to resist brute force attacks.

7.2 Key sensitivity analysis

Key sensitivity refers to the small changes in the key during the image encryption process, which will have a great impact on the decrypted image [45]. Given initial key \(key={x_0,y_0}\). We change the initial keys \(x_0\) and \(y_0\) by \(10^{-15}\) to obtain the changed keys Ekey1, Ekey2:

$$\begin{aligned}{} & {} {\left\{ \begin{array}{ll}Ekey1=\left\{ x_0+10^{-15},y_0 \right\} \\ Ekey2=\left\{ x_0,y_0+10^{-15} \right\} \end{array}\right. } \end{aligned}$$
(27)
$$\begin{aligned}{} & {} {\left\{ \begin{array}{ll}C=encrypt(key,P)\\ C1=encrypt(Ekey1,P)\\ C2=encrypt(Ekey2,P) \end{array}\right. } \end{aligned}$$
(28)
$$\begin{aligned}{} & {} {\left\{ \begin{array}{ll}D=decrypt(key,C)\\ W1=decrypt(Ekey1,C)\\ W2=decrypt(Ekey2,C) \end{array}\right. } \end{aligned}$$
(29)

where encrypt() and decrypt() are the algorithm functions for encryption and decryption, respectively. P is a plaintext image, and C, C1 and C2 are images encrypted with keys keyEkey1andEkey2, respectively. D is the correctly decrypted image decrypted with the correct key. W1 and W2 are the wrong decrypted images obtained by performing decryption operations with wrong keys Ekey1, Ekey2.

Figure 16 shows the correctly decrypted image D of “Boat” and its corresponding incorrectly decrypted images W1 and W2. Figure 17 shows the “Boat” plaintext image and its corresponding encrypted images C, C1 and C2.

Fig. 16
figure 16

a Correctly decrypted image D; b incorrectly decrypted image W1; c incorrectly decrypted image W2

Fig. 17
figure 17

a Plaintext image; b encrypted image C; c encrypted image C1; d encrypted image C2

Table 3 Key sensitivity analysis result of the difference between decryption keys \(10^{-15}\)(NPCR/UACI) (unit:%)
Table 4 Key sensitivity analysis results of the difference between encryption keys \(10^{-15}\)(NPCR/UACI) (unit:%)

In this paper, key sensitivity analysis is carried out for the three images of “Boat,” “Peppers,” “Baboon” and “House,” respectively. To illustrate the algorithm’s key sensitivity during the decryption process, Table 3 compares the NPCR and UACI [46] values obtained after decrypting images using the correct and wrong decryption keys. The introduction of NPCI and UACI is detailed in Sect. 7.6. Moreover, the NPCR, UACI values are calculated between different encrypted images obtained using the same plaintext image but also with different encryption keys. The calculation results are listed in Table 4. The results show that the encryption scheme proposed in this paper is very sensitive to keys.

7.3 Histogram analysis

Histogram is a common tool that can be used to evaluate the uniformity of ciphertext images. Figure 18 shows the histograms for the plaintext and encrypted images of the three images tested in this paper. We can find that the histogram of the plaintext image is quite different from that of the encrypted image, which is rather uniform.

Fig. 18
figure 18

a, c, e Histograms of plaintext images “Boat,” “Peppers,” “Lung”; b, d, f histograms of encrypted images “Boat,” “Peppers,” “Lung”

The Chi-square test is an important method to quantitatively analyze the uniform distribution of pixels in the encrypted image [47]. The calculation formula of the \(x^2\) test is shown in Eq. (30):

$$\begin{aligned} x^2=\displaystyle \sum _{i = 0}^{255}\frac{(v_i-v_0)^2}{v_0},v_0=\frac{M \times N}{256} \end{aligned}$$
(30)

Table 5 shows the results of the \(x^2\) test. The test result of the encrypted image is lower than 293.24783, and the test is all passed. Through histogram analysis and the \(x^2\) test, it is proven that the algorithm can resist statistical attacks.

Table 5 \(x^2\) test
Fig. 19
figure 19

ac are the correlations between adjacent pixels in the horizontal, vertical and diagonal directions of the plaintext image “Boat,” respectively; df are the correlations of adjacent pixels in the horizontal, vertical and diagonal directions of the encrypted image “Boat,” respectively

7.4 Correlation of adjacent pixels

In general, images present information with specific and specific meanings, and the pixel contents are continuous, so the correlation between two neighboring pixels is very high. Attackers can crack encryption algorithms by analyzing the correlation between pixels in encrypted images. A good encryption algorithm should attempt to minimize the correlation between adjacent pixels in the encrypted image.

We randomly select 5000 pairs of adjacent pixels in horizontal, vertical and diagonal directions from the plaintext and encrypted images of the “Boat,” respectively, to calculate and compare the correlation and correlation coefficients of the plaintext/ciphertext, as shown in Fig. 19. The correlation coefficient is calculated as follows [48]:

$$\begin{aligned} \begin{array}{lcl} {\left\{ \begin{array}{ll} r_{xy}=\frac{\textrm{cov}(x,y)}{\sqrt{D(x)D(y)}}\\ \\ \textrm{cov}(x,y)=\frac{1}{N}\displaystyle \sum _{i=1}^N (x_i-E(x))(y_i-E(y))\\ \\ D(x)=\frac{1}{N}\displaystyle \sum _{i=1}^N(x_i-E(x))^2\\ \\ E(x)=\frac{1}{N}\displaystyle \sum _{i=1}^N x_i \end{array}\right. } \end{array} \end{aligned}$$
(31)

where x and y represent adjacent pixels in two grayscale images and N is the total number of pixels in the image.

Table 6 Correlation analysis

As seen in Fig. 19, the correlations in all directions of the encrypted images are very small and uniformly distributed in the figure. Table 6 lists the calculation results of the correlation coefficients of this algorithm. As shown, the correlation coefficients between adjacent pixels in the encrypted image are extremely close to 0, indicating that the encryption method is sufficiently secure.

7.5 Information entropy

The information entropy of an image may be used to determine the average amount of information contained within it, is another important factor in evaluating the resistance of a cryptographic system. Information entropy is defined as [50]:

$$\begin{aligned} H(s)=-\begin{matrix} \displaystyle \sum _{i=0}^{2^L-1} p(s_i)\log _2{p(s_i)} \end{matrix} \end{aligned}$$
(32)

where L is the total number of pixels in the encrypted image, and \(p(s_i)\) represents the probability of \(s_i\).

According to Eq. (32), the higher the randomness of the pixel is, the larger the image’s information entropy. The greater the entropy is, the higher the security. The ideal value of the information entropy of an 8-bit image is 8. Table 7 shows the information entropy of the encrypted images. Compared to other algorithms, our encryption algorithm’s entropy is quite near the ideal value and can effectively resist an entropy attack.

Table 7 Information entropy
Table 8 NPCR and UACI results
Fig. 20
figure 20

“Boat” cutting attack: a Cut loss 128\(\times \)128; b, c cut loss 256\(\times \)256 in different positions; d cut loss 512\(\times \)256; eh correspond to the decrypted images of (a)–(d), respectively

7.6 Differential attack

A good algorithm for image encryption should be sensitive to plaintext images; even if the pixels in the plaintext image are slightly changed, two completely different encrypted images can be obtained. Two important indicators to evaluate the effect of differential attack analysis are the number of pixel change rates (NPCR) and the unified average change intensity (UACI). NPCR and UACI are defined as follows:

$$\begin{aligned}{} & {} \begin{array}{lcl} NPCR=\frac{\sum _{i,j}D(i,j)}{M \times N} \times 100\% \\ \end{array} \end{aligned}$$
(33)
$$\begin{aligned}{} & {} \begin{array}{lcl} UACI=\frac{1}{M \times N}\left[ \sum _{i,j}\frac{|C_1(i,j)-C_2(i,j)|}{255}\right] \times 100\% \end{array}\nonumber \\ \end{aligned}$$
(34)

where \(C_1 (i,j)\) and \(C_2 (i,j)\) are, respectively, the encrypted images before and after changing one pixel of the plaintext image, and D(ij) is defined as Eq. (35).

$$\begin{aligned} D(i,j)={\left\{ \begin{array}{ll}0,\quad \quad C_1(i,j)=C_2(i,j)\\ 1,\quad \quad C_1(i,j)\ne C_2(i,j) \end{array}\right. } \end{aligned}$$
(35)

We randomly change a pixel value for the grayscale images “Boat,” “Peppers,” “Baboon,” “House,” “Butterfly” and color image “Lung” and perform NPCR and UACI tests. It can be seen in Table 8 that compared with the literature algorithm, the proposed algorithm’s NPCR and UACI values are quite near the theoretical values, and the scheme performs well against differential attacks.

7.7 Cutting attack

During image transmission and storage, it is necessary to consider the possibility that a portion of the data may be corrupted or intercepted. To evaluate the ability of the encryption scheme to recover the plaintext image after losing part of the ciphertext data, that is, the algorithm’s resistance to cutting attacks, the areas of size \(128 \times 128\), \(256 \times 256\) and \(512 \times 256\) are deleted from the encrypted image “Boat,” as shown in Fig. 20a–d.

In Fig. 20e–h, it can be seen that, even after the loss of 1/2 of the data, decrypted images recover information about plaintext images well. Experiments show that this algorithm can effectively resist cutting attacks.

Fig. 21
figure 21

“Boat” noise attack: ad cipher images with 0.01, 0.05, 0.1 and 0.3 salt and pepper noise; eh correspond to the decrypted images of (a)–(d), respectively

7.8 Noise attack

Interference noise from the transmission or storage process can have an impact on the decryption process of the algorithm. As a result, a secure encryption scheme should be resistant to noise attacks.

We use 0.01, 0.05, 0.1 and 0.3 salt and pepper noise to attack the encrypted image “Boat,” as shown in Fig. 21a–d. The corresponding decryption results after these noise attacks are shown in Fig. 21e–h. Experiments show that the algorithm can resist noise attacks well and has good robustness.

8 Conclusion

This paper proposes a qubit-level selective scrambling and overlapping feedback diffusion method based on a new 2D cross \(Sine^2-Logistic\) chaotic map. A new type of 2D cross \(Sine^2-Logistic\) hyperchaotic system is proposed, which greatly improves the key space and has higher chaotic behavior. Therefore, the chaotic map proposed in this paper is more suitable for the image encryption field. In the quantum encryption algorithm, the SHA-256 function is used to calculate the hash value of the plaintext image to obtain the key, which can effectively resist the chosen plaintext attack. A quantum selective scrambling method based on the NEQR model is proposed. Changing the position of the bit level can effectively change the pixel value and achieve the effect of confusion diffusion. In order to improve the security of the algorithm, a quantum overlapping feedback diffusion method is proposed to improve the avalanche effect of the encryption scheme. A chaos-based row/column cyclic shift method is designed to reduce the correlation between adjacent pixels. The simulation and performance analysis results indicate that the quantum image encryption scheme is both safe and reliable. In future work, we will conduct more in-depth research on asymmetric cryptography to improve and refine our algorithm. The key transmission problem in symmetric cryptography is better solved to achieve a more secure encryption algorithm. Additionally, we will conduct more in-depth research on new chaotic systems, quantum chaotic systems and more complex chaotic systems, expecting better results.