1 Introduction

Steganography is a technology that hides information in a carrier. It has a very promising application and can improve the security of information delivery. For example, digital steganography technology can be used instead of encryption technology to transmit business contracts. Steganography focuses more on hiding the transmission of information compared to digital watermarking techniques. In contrast, digital watermarking techniques focus on protecting the copyright of the image. Meanwhile, digital watermarking techniques are more concerned with robustness.

The quantum computer was first proposed in 1982 by Richard Feynman, winner of the Nobel Prize in Physics. Based on the superposition state principle of quantum mechanics, the computation speed of the quantum computer is much faster than that of the classical computer. In the development of quantum image processing, classical images first need to be represented on the quantum computer. The main methods of representation are as follows: qubit lattice [1], real ket [2], entangled image [3], flexible representation of quantum images (FRQI) [4], a novel enhanced quantum representation (NEQR) [5], normal arbitrary quantum superposition state (NAQSS) [6], improved neqr (INEQR) [7] and generalized quantum image representation (GQIR) [8]. On the basis of these quantum image representation methods, researchers have investigated many aspects of quantum image processing. Such as quantum image scaling [9, 10], quantum image scrambling [11, 12], quantum image watermarking [13,14,15], quantum image steganography [16, 17], and quantum image matching [18].

In this paper, quantum image steganography is mainly studied. The least significant bit (LSB) steganography algorithm is the most basic one among the commonly used algorithms. Based on the LSB algorithm, Nan Jiang et al. proposed block LSB algorithm [19] has a good visual effect but the embedding capacity is poor. The algorithm proposed by Luo et al. [20] has larger embedding capacity but poor visualization. The algorithm proposed by Zhou et al. [21] uses more auxiliary graphics to enhance the visual effect, but the embedding capacity and robustness need to be improved. The algorithm proposed by Luo et al. [22] has a very good visual effect, but the poor robustness is one of its disadvantages. The algorithm proposed by Zhou et al. [23] has a considerable visual effect, but the security is flawed. The algorithm proposed by Qu et al. [24] has higher embedding efficiency and embedding rate. The proposed algorithm by Zeng et al. [25] has better security and embedding capacity. Chen and Chang proposed a steganography algorithm combining Gray code and LSB algorithm [26], this steganography algorithm has a better visual effect compared to the classical LSB algorithm without reducing the embedding capacity. This paper presents an improved algorithm based on the algorithm proposed by Chen and Chang [26]. The algorithm proposed in this paper has a significant improvement in visual effect without changing the embedding capacity.

The next parts of this paper is rough as follows. The second part will list the preparation and related knowledge. The third part will give a detailed description of the proposed algorithm as well as an analysis of the complexity of the quantum circuit. In the fourth part, the experimental results are analyzed. Finally, conclusions are drawn based on the previous sections.

2 Background

2.1 Novel Enhanced Quantum Representation for Quantum Images

The NEQR model was first proposed in 2013 [15]. Compared to the previous representation, the NEQR model represents the quantum image position well along with its grayscale value. This advantage substantially improves the scope of application of the NEQR model. The quantum image can be represented in the NEQR model as:

$$ \vert I\rangle = \frac{1}{2^{n}} \sum\limits_{Y = 0}^{{2^{n}} - 1} {\sum\limits_{X = 0}^{{2^{n}} - 1} | C_{YX}\rangle | YX\rangle} $$
(1)

In this equation, \(| C_{YX}\rangle =| c_{YX}^{q-1}{\cdots } c_{YX}^{1}c_{YX}^{0}\rangle \) denotes the grayscale value of the quantum image, the range of which can be expressed as [0,2q − 1]. |Yand|X〉 denote the position information of the quantum image in the vertical and horizontal directions, respectively. As shown in Fig. 1, a 2 × 2 quantum image can be represented in NEQR as follow.

Fig. 1
figure 1

NEQR representatio

2.2 The Least Significant Bit (LSB)

LSB steganographic algorithm [27] is a very basic algorithm nowadays. Numerous algorithms are derived on the basis of the LSB algorithm. The LSB algorithm has a very important position in the steganography field. The LSB algorithm is to replace the LSB of the carrier pixel with the information bit. The LSB of the pixel is shown in Fig. 2. For example, if the information bit to be embedded is “1” and the carrier pixel is 236, then the carrier pixel becomes 237 after the replacement. Since only the LSB of the carrier pixel is changed, it is almost imperceptible to the human eye. This advantage makes the LSB algorithm widely used.

Fig. 2
figure 2

Example of the LSB

2.3 Gray Code and its use in Steganography

Gray code is a kind of binary code, proposed by Frank Gray in 1953. Gray code was first used in communications. The characteristic of the Gray code is that only one bit is different between two adjacent numbers. At the same time, the minimum and maximum numbers of Gray code are also different by only one bit. Based on this feature, Gray code is also called ”cyclic code” or ”reflection code”. The Gray code is created as follows: The first step is to change the rightmost bit. The second step is to select the first bit from the right that is 1, then change the left bit of this bit. Then repeat the previous two steps until the Gray code is generated. The generated Gray codes G1 to G4 are shown in Fig. 3.

Fig. 3
figure 3

Gray code

In 2008, Chen and Chang [26] designed a new steganography method, which combines Gray code and LSB algorithm. In the following, this paper will use the 3 bits Gray code G3 as an example.

In the embedding process, a function Gray(g) is defined to represent the Gray code value of the corresponding three bits g. For the value of the information bit is 1, when the last three bits of the carrier pixel correspond to an even Gray code, then the last three bits of the carrier pixel are modified to the odd Gray code with less variation in the neighboring Gray codes. When the last three bits of the carrier pixel correspond to an odd Gray code, then it remains unchanged. Similarly, for the value of the information bit is 0, when the last three bits of the carrier pixel correspond to an odd Gray code, then the last three bits of the carrier pixel are modified to the even Gray code of the neighboring Gray codes with less variation. When the last three bits of the carrier pixel correspond to an even Gray code, then it remains unchanged. For example, suppose the carrier pixel is 23510 = 111010112. If the information bit is 1, Gray(0112) = 2. Since 2 is an even number, modify 0112 to a neighboring odd Gray code. Since modifying 0112 to 0102 is a smaller color change compared to modifying it to 0012, modify 0112 to 0102. The modified carrier pixel is 23410 = 111010102. If the information bit is 0, then no modification is needed at this point.

In the extracting process, only the last three bits of the carrier pixel corresponding to the even or odd number of the Gray code need to be concerned. If the Gray code corresponding to the last three bits of the carrier pixel is an even number, then the extracted information bit is 0. If the Gray code corresponding to the last three bits of the carrier pixel is an odd number, then the extracted information bit is 1. As an example, suppose the carrier pixel is 23410 = 111010102. Since Gray(0102) = 3, which is an odd number, therefore the extracted information bit is 1. The quantum circuits of the conversion of binary code to Gray code and Gray code to binary code are shown in Figs. 4 and 5, respectively.

Fig. 4
figure 4

Conversion of binary code to Gray code

Fig. 5
figure 5

Conversion of Gray code to binary code

2.4 Arnold Scrambling

Image scrambling is the process of operating on the horizontal and vertical coordinates of an image to destroy the correlation of the image matrix. This makes the image more different from the original image. In this way, other people cannot read the image information without knowing the scrambling rules. In this paper, the scrambling method is Arnold scrambling [28], a scrambling method first used in image scrambling in 1992. The concrete steps are: First multiply a scrambling matrix with the coordinates, and then take the modulus of the result. Assuming that the coordinate information before the scrambling is (x,y) and after the scrambling is (xA,yA). Then the two-dimensional Arnold scrambling can be expressed as follows:

$$ \left( \begin{array}{l} x_{A} \\ y_{A} \end{array}\right) = \left( \begin{array}{ll} 1 & 1 \\ 1 & 2 \end{array}\right) \left( \begin{array}{l} x \\ y \end{array}\right) (\text{mod N}) $$
(2)
$$ x_{A}=(x+y) \ \text{mod \ N} $$
(3)
$$ y_{A}=(x+2y) \ \text{mod \ N} $$
(4)

where \(\begin {pmatrix}1&1 \\ 1&2\end {pmatrix}\) is the scrambling matrix. The inverse operation of the two-dimensional Arnold scrambling is:

$$ \left( \begin{array}{l} x \\ y \end{array}\right) = \left( \begin{array}{ll} 1&1 \\ 1&2 \end{array}\right)^{-1} \left( \begin{array}{ll} x_{A} \\ y_{A} \end{array}\right) (\text{mod \ N}) $$
(5)
$$ x=(2x_{A}-y_{A}) \ \text{mod \ N} $$
(6)
$$ y=(-x_{A}+y_{A}) \ \text{mod \ N} $$
(7)

where \(\left (\begin {array}{ll} 1&1 \\ 1&2 \end {array}\right )^{-1}\) is the inverse scrambling matrix. The Arnold scrambling quantum circuit is shown in [29].

2.5 Quantum Comparator

In the embedding and extraction steps, it is first necessary to ensure that the positions of the individual images are the same. Therefore, the comparison circuit [30] is introduced in this paper. The comparison circuit compares the position information of two images. When the output |c〉 is |1〉, it means that the position coordinate of the two images is equal; when the output |c〉 is |0〉, it means that the position coordinate of the two images is unequal at this time. The concrete quantum comparison circuit is shown in Fig. 6.

Fig. 6
figure 6

Quantum comparator (QE) [30]

2.6 Judgment Circuit

The judgment circuit is used to judge whether the value of the 3 bits Gray code is in the [0,3] interval or in the [4,7] interval. The judgment circuit is shown in Fig. 7. When the output |r〉 is |0〉, the value of the input 3 bits Gray code is in the [4,7] interval. When the output |r〉 is |1〉, it means that the value of the input three-digit Gray code is in the [0,3] interval.

Fig. 7
figure 7

Judgment circuit

3 The Proposed Quantum Image Steganography Scheme

In this paper, the proposed quantum steganography scheme is to embed a n × 2n grayscale image into a 4n × 4n grayscale image. Before embedding, a 4n × 4n one-bit key image needs to be prepared. The NEQR representations of the information image, key image, and carrier image are respectively as follows:

$$ |I\rangle = \frac{1}{2^{n}} \sum\limits_{Y = 0}^{{2^{n-2}} - 1} {\sum\limits_{X = 0}^{{2^{n-1}} - 1} |I_{YX}\rangle |YX\rangle}, $$
(8)

where \(|I_{YX}\rangle =|i_{YX}^{q-1}{\cdots } i_{YX}^{1}i_{YX}^{0}\rangle \).

$$ |K\rangle = \frac{1}{2^{n}} \sum\limits_{Y = 0}^{{2^{n}} - 1} {\sum\limits_{X = 0}^{{2^{n}} - 1} |K_{YX}\rangle |YX\rangle}, $$
(9)

where KY X ∈{0,1}.

$$ |C\rangle = \frac{1}{2^{n}} \sum\limits_{Y = 0}^{{2^{n}} - 1} {\sum\limits_{X = 0}^{{2^{n}} - 1} |C_{YX}\rangle |YX\rangle}, $$
(10)

where \(|C_{YX}\rangle =|c_{YX}^{q-1}{\cdots } c_{YX}^{1}c_{YX}^{0}\rangle \).

The process of embedding and extracting are shown in Figs. 8 and 9.

Fig. 8
figure 8

Embedding process

Fig. 9
figure 9

Extracting process

3.1 Embedding Procedure

Based on the classical Gray code algorithm and the law of Gray code itself, this paper improves the classical Gray code algorithm. The concrete ideas of the improved Gray code algorithm are described in the following. In this paper, two layers of Gray code are set for the last three bits of the carrier pixels. The first layer of Gray code is \(|c_{YX}^{2}c_{YX}^{1}c_{YX}^{0}\rangle \). The rule of the first layer of Gray code uses the rule of classical Gray codes described in Part 2, i.e., the judgment is based on the parity of Gray code. The second layer of Gray code is \(| c_{YX}^{0}c_{YX}^{1}c_{YX}^{2}\rangle \). The rule for the second layer of Gray code is based on whether the value of the Gray code is within [0,3] or within [4,7], and the rule is as follows: If the information bit is 0 and the value of the second layer Gray code is in the interval [0,3], then the LSB of the carrier pixel remains unchanged. In this case, the bit at the corresponding position of the key image is set to 1. If the information bit is 1 and the value of the second layer Gray code is in the interval [4,7], then the LSB of the carrier pixel remains unchanged. In this case, the bit at the corresponding position of the key image is set to 1. The concrete embedding steps are as follows:

Step 1: :

The Arnold scrambling is applied to the n × 2n information image |I〉. The scrambled information image is |AI〉. Then the information image |AI〉 is expanded to a 4n × 4n information image \(|I^{\prime }\rangle \). The quantum circuit of the expansion step is shown in Fig. 10.

Step 2: :

The first layer of the Gray code rule is applied to the \(|c_{YX}^{2}c_{YX}^{1}c_{YX}^{0}\rangle \) of carrier pixel. If the LSB of the carrier pixel does not need to be changed, the operation on this pixel is ended. If the LSB of the carrier pixel needs to be changed, then go to step 3.

Step 3: :

It can be seen from step 2 that according to the rule of the first layer of Gray code, the LSB of the carrier pixel needs to be changed at this time. At this moment, the second layer of the Gray code rule is applied to the carrier pixel. If the LSB of the carrier pixel does not need to be changed according to the second layer of the Gray code rule, then its LSB is not changed and the corresponding position bit of the key image is set to 1. If the LSB of the carrier pixel still needs to be changed according to the second layer of the Gray code rule, then its LSB is changed according to the first layer of the Gray code rule. The embedding algorithm is shown in (11) and (12). The embedding circuit is shown in Figs. 11 and 12.

$$ \begin{array}{ll} ~\qquad\qquad\qquad\quad\qquad|c_{YX}^{2}c_{YX}^{1}c_{YX}^{0} \rangle = \vert c_{YX}^{2}c_{YX}^{1}\overline{c_{YX}^{0}} \rangle ,\\ While \ Gray\left( c_{YX}^{2}c_{YX}^{1}c_{YX}^{0}\right)\ mod\ 2 = 1\bigcap Gray(c_{YX}^{0}c_{YX}&^{1}c_{YX}^{2}) \in [4,7]\bigcap I^{\prime}_{YX} = 0. \end{array} $$
(11)
$$ \begin{array}{ll} ~\qquad\qquad\qquad\quad\qquad |c_{YX}^{2}c_{YX}^{1}c_{YX}^{0} \rangle = \vert c_{YX}^{2}c_{YX}^{1}\overline{c_{YX}^{0}} \rangle ,\\ While\ Gray\left( c_{YX}^{2}c_{YX}^{1}c_{YX}^{0}\right)\ mod\ 2 = 0\bigcap Gray(c_{YX}^{0}c_{YX}&^{1}c_{YX}^{2}) \in [0,3]\bigcap I^{\prime}_{YX} = 1. \end{array} $$
(12)
Fig. 10
figure 10

Expansion circuit

Fig. 11
figure 11

Embedding module

Fig. 12
figure 12

Embedding circuit

For example, in Fig. 13, the 1 × 2 information image is first expanded into a 4 × 4 image. Assume that the carrier image is shown in Fig. 14. Take the first pixel |10110100〉 in the upper left corner as an example. At this time, the information bit in the corresponding position in the information image is 0. The first layer of the Gray code of |10110100〉 is |100〉. The value of the Gray code is 7, which is an odd number. The LSB needs to be changed according to the rule of the first layer of the Gray code, so the second layer of the Gray code rule is applied to it. The second layer of its Gray code is |001〉. The value of the Gray code is 1, which belongs to the range of [0,3], so no change is needed. At this time, the corresponding position of the key image is set to 1.

Fig. 13
figure 13

Information image and its extension

Fig. 14
figure 14

Carrier image

Figure 15 summarizes the change of \(|c_{YX}^{2}c_{YX}^{1}c_{YX}^{0}\rangle \) of the carrier pixel in different cases. It can be seen that the LSB of the carrier pixel needs to be changed only in a quarter of the cases, and the rest of the cases do not need to be changed. Therefore, the visual effect of the algorithm proposed in this paper will be better.

Fig. 15
figure 15

Changes in carrier pixels

3.2 Extracting Procedure

The extracting idea of the proposed Gray code algorithm in this paper is based on the key image and the last three bits of the carrier pixel. The quantum circuit of the extracting step is shown in Figs. 16 and 17. The concrete steps are as follows:

Step 1::

Observe the value of the corresponding position of the key image and determine what extracting method to use according to its value.

Step 2::

If the value of the corresponding position of the key image is 1, then the extracting is according to the value of the second layer of Gray code: If the value of the Gray code of the \(|ci_{YX}^{0}ci_{YX}^{1}ci_{YX}^{2}\rangle \) of the carrier pixel belongs to the interval [0,3], then the information bit is 0. If the value of the Gray code of the \(|ci_{YX}^{0}ci_{YX}^{1}ci_{YX}^{2}\rangle \) of the carrier pixel belongs to the interval [4,7], then the information bit is 1. If the value of the corresponding position of the key image is 0, then go to step 3.

Step 3::

At this point, the extraction is performed according to the extraction rule of the classical Gray code. That is, If the value of the Gray code of the \(|ci_{YX}^{2}ci_{YX}^{1}ci_{YX}^{0}\rangle \) of the carrier pixel is even, then the information bit is 0. If the value of the Gray code of the \(|ci_{YX}^{2}ci_{YX}^{1}ci_{YX}^{0}\rangle \) of the carrier pixel is odd, then the information bit is 1.

Fig. 16
figure 16

Extracting module

Fig. 17
figure 17

Extracting circuit

Algorithm 1
figure a

Double-level Gray code embedding algorithm.

4 Computational Complexity

Circuit complexity is a metric to evaluate the quantum circuit of an algorithm. The circuit complexity of an algorithm depends on the number of various logic gates in the circuit diagram. The circuit complexity calculation method adopted in this paper is: The circuit complexity of a one-bit controlled-NOT gate is 1. The circuit complexity of a two-bit controlled-NOT gate is 6, and the circuit complexity of a multi-bit controlled-NOT gate \((n\geqslant 3)\) is 12n − 9. The circuit complexity of the swap gate is 3. According to the embedding and extracting ideas mentioned before, the size of the information image and the carrier image are 2n− 2 × 2n− 1 and 2n × 2n, respectively. The circuit complexity is calculated in two parts: embedding and extracting.

Embedding section: The embedding part consists of Arnold scrambling, image expansion, and embedding. The circuit complexity of Arnold scrambling is 56n [29]. Figures 4 and 5 conversion circuits have a circuit complexity of 2 each. The circuit complexity of the comparison circuit in Fig. 6 is 28n − 9. The judgment circuit of Fig. 7 has a circuit complexity of 1. In Fig. 10, the circuit complexity of the expansion circuit is (24n + 3) ⋅ 22n. The embedding module of Fig. 11 has a circuit complexity of 131. The circuit complexity of the embedding circuit in Fig. 12 is 56n + 113. Therefore, the overall circuit complexity of the embedding part is O(24n ⋅ 22n).

Extracting section: The extracting section consists of extracting circuit, reducing circuit, and Arnold inverse scrambling. The circuit complexity of the extracting module in Fig. 16 is 88. In Fig. 17, the circuit complexity of the extracting circuit is 56n + 70. The circuit complexity of the reducing circuit is the same as that of the expansion circuit. The circuit complexity of Arnold inverse scrambling is 112n [29]. Therefore, the overall circuit complexity of the extracting section is O(24n ⋅ 22n).

If the image scaling is not considered, the circuit complexity of the embedding circuit of the quantum image steganography algorithm proposed in this paper is O(n). Similarly, the circuit complexity of the extracted circuit is O(n). Therefore, the overall circuit complexity is O(n). In classical image processing, the complexity is related to the size of the image that needs to be processed. Taking the image used in the algorithm of this paper as an example, the complexity in classical image processing is O(22n). Therefore, for the proposed algorithm in this paper, quantum image processing has significant advantages in speed compared to classical image processing.

5 Experiments and Analysis

In this section, the algorithm proposed in this paper will be experimented from two aspects: visual effect and robustness. The experimental results are compared with other algorithms. The embedding capacity of different algorthims and the auxiliary images used in different algorithms are different. In this paper, some algorithms suitable for comparison are selected in the visual effect experiment and robustness experiment, respectively. Then the advantages and disadvantages of the algorithm proposed in this paper are derived. The size of the carrier image used in the experiment is 512 × 512, and the information image uses 2 images of 128 × 128 stitched together to form a 128 × 256 image.

5.1 Visual Quality

The visual effect is a key element to judge the merits of a steganography algorithm. Calculating PSNR is a common way to verify the visual effect of a steganography algorithm. By comparing the carrier image after embedding the information image with the original carrier image, the similarity of the two is derived. Thus, the actual effectiveness of a steganographic algorithm is illustrated. The formula of PSNR is as follows:

$$ PSNR = 10\log_{10}\frac{MAX_{I}^{2}}{MSE} = 20\log\frac{MAX_{I}}{\sqrt{MSE}} $$
(13)

where MSE is the mean squared error with the following formula:

$$ MSE = \frac{1}{mn} \sum\limits_{i = 0}^{m - 1} {\sum\limits_{j = 0}^{n - 1}[I(i,j)-J(i,j)]^{2}} $$
(14)

The pixel histogram provides a visual representation of the number of pixels of various colors in an image. By comparing the histograms of the two images it is clear how similar they are. Figure 18 shows the comparison of the visual effect between the carrier image after embedding the information image by the algorithm proposed in this paper and the original image. The images used in the experiment are shown in Fig. 19. Figure 20 shows the visual effect of the carrier image embedded by the classical Gray code algorithm compared with the original image. The histogram shows that the algorithm proposed in this paper has a significantly smaller change on the carrier image.

Fig. 18
figure 18

Each row of images from left to right is the original carrier image, the histogram of the original carrier image, the carrier image after embedding information (the algorithm proposed in this paper) , and the histogram of the carrier image after embedding information (the algorithm proposed in this paper)

Fig. 19
figure 19

Images used in the visual experiment

Fig. 20
figure 20

Each row of images from left to right is the original carrier image, the histogram of the original carrier image, the carrier image after embedding information (the classical Gray code algorithm) , and the histogram of the carrier image after embedding information (the classical Gray code algorithm)

Table 1 shows the PSNR values of the carrier images after embedding the information images in each group of experiments. It can be seen that the PSNR values of each group of experiments have reached around 54dB. Table 2 shows the comparison of the visual effect of the algorithm proposed in this paper with other algorithms. Among them, the algorithm of Zhou et al. [30] is better than the algorithm proposed in this paper in terms of embedding capacity but uses more key images. Meanwhile, the visual effect is slightly lower than the algorithm proposed in this paper. The algorithm of Chen and Chang [26] is the classical Gray code algorithm, which is less visually effective than the algorithm proposed in this paper. Chatterjee et al. [31] have done multiple sets of experiments with different embedding capacities. Here the experimental data with the same embedding capacity as in this paper is selected for comparison. It can be seen that the algorithm proposed in this paper is superior to its algorithm in terms of visual effect. Compared with the algorithm of Zhou et al. [21], the algorithm proposed in this paper performs better in all aspects. The algorithm of Luo et al. [22] has a higher embedding capacity than the algorithm proposed in this paper. However, the algorithm proposed in this paper has a clear advantage in visual effects.

Table 1 The PSNR values of the carrier images after embedding the information images in each group of experiments
Table 2 Comparison with other algorithms

Tables 3 and 4 show the comparison between the algorithm proposed in this paper and the classical Gray code algorithm in terms of the number of specific changed bits. It can be seen that the proportion of LSB changed by the proposed algorithm is about 25%, which is greatly improved compared with the 50% change of the classical Gray code algorithm.

Table 3 The number of bits specifically changed using the algorithm proposed in this paper
Table 4 The number of bits specifically changed using the classical Gray code algorithm

5.2 Robustness

Robustness is an important index to judge the stability of a steganography algorithm. By performing a noise attack on the image, the similarity between the information image extracted from the attacked carrier image and the original information image is calculated. Thus, it is judged whether a steganographic algorithm has good stability or not. Researchers usually choose salt-and-pepper noise as an attack tool in robustness experiments within the space domain. Salt-and-pepper noise is a type of noise caused by the intensity of the signal pulse. Salt-and-pepper noise is represented as discrete distributions of pure white pixels or pure black pixels. Salt represents white and pepper represents black. Since it is unlikely that the maximum/minimum value of grayscale pixels will appear in the image under normal circumstances. Therefore such pixels can be treated as noise. The noise density of the salt-and-pepper noise represents the percentage of image pixels that are attacked in the image. The experiments in this paper were conducted using salt-and-pepper noise with noise densities of 0.02, 0.05, 0.1, and 0.15, i.e., attacking 2%, 5%, 10%, and 15% of the carrier pixels. In this paper, by performing four different parameters of salt-and-pepper noise attack on the embedded image, then extracting the information image from the attacked carrier image and calculating its PSNR with the original information image. Take the fifth group of experiments as an example. The carrier images after the salt-and-pepper noise attack with noise densities of 0.02, 0.05, 0.1, and 0.15 and the information images extracted from them are shown in Fig. 21. It can be seen that the extracted image has a high similarity to the original information image. Table 5 shows the PSNR values of the extracted information image and the original information image.

Fig. 21
figure 21

Images at noise densities of 0.02, 0.05, 0.1, and 0.15 in the noise experiment, respectively

Table 5 Salt-and-pepper noise attack experiment (PSNR dB)

Since Chen and Chang [26] did not do robustness experiments, the algorithm proposed in this paper is compared with other algorithms. Table 6 shows the robustness of the algorithm proposed in this paper compared with other algorithms. Taking the salt and pepper noise of 0.05 as an example, the PSNR value of the algorithm proposed in this paper is 0.26 higher than that of Luo et al. [20], 6.92 higher than that of Luo et al. [32], and 10.22 higher than that of Zhou et al. [33]. Thus, it can be concluded that the algorithm proposed in this paper has good resistance in the face of attacks.

Table 6 The robustness of the algorithm proposed in this paper (PSNR dB)

5.2.1 Security Analysis

The algorithm proposed in this paper uses the Gray code, therefore the information image cannot be extracted without knowing the Gray code rules. The extraction step of the algorithm proposed in this paper requires the key image, which has two roles in the algorithm proposed in this paper. One role is that others cannot accurately read the information embedded in this algorithm without access to the key image. The other role is that even if the carrier image after embedding information image is attacked, the key image changed during embedding can help us extract as much information as possible. In conclusion, the steganography algorithm proposed in this paper has relatively good security.

5.3 Conclusions

In this paper, a novel quantum image steganography algorithm based on double-layer Gray code is proposed based on the classical Gray code algorithm. The main advantage of the steganography algorithm proposed in this paper is the drastic reduction in the number of bits that need to be changed in the carrier image during embedding. The classical LSB algorithm needs to replace 100% bits of the LSB of the carrier pixels in the embedding step. The classical Gray code algorithm needs to change 50% bits of the LSB of the carrier pixels when embedding. The proposed algorithm in this paper only needs to change 25% bits of the LSB of the carrier pixels when embedding. Therefore, the algorithm proposed in this paper has a better visual effect. In addition, the proposed algorithm also has good performance in robustness and security.