Research Paper of Project
Research Paper of Project
https://doi.org/10.1007/s11082-022-03581-3
Received: 19 November 2021 / Accepted: 7 February 2022 / Published online: 21 March 2022
© The Author(s), under exclusive licence to Springer Science+Business Media, LLC, part of Springer Nature 2022
Abstract
In this research, we propose a new way to encrypt RGB color image using a key. In the pro-
posed method, the desired digital image is encoded using the BRQI quantum images. This
algorithm consists of two main phases. In the first phase, we interpolate the quantum image
using proposed operation which is based on changing the bit planes of the image. The out-
put is given as input of the second phase. In the second phase, the image is encrypted using
the defined key. We analyzed and compared the performance of the proposed algorithm
using evaluation of criteria’s including histogram analysis, correlation coefficient of pixels
adjacent to correlation diagram analysis and entropy with previous similar works. Accord-
ing to the results, the proposed algorithm has good performance than previous similar
works such as Heidari et al. protocol.
1 Introduction
In 1956, when the first microprocessor was built, Gordon Moore predicted that the num-
ber of transistors on a chip would be double every 18–24 months. This increasing in the
number of transistors increases the speed of the processors and reduces the size of them
(Moore 1965). Therefore, Moore’s prediction and the impossibility of unconditional secu-
rity in classical computers necessitated the introduction of quantum information theory and
the construction of quantum computers (Khorrampanah and Houshmand 2013; Hassan-
pour and Houshmand 2016; Zadeh et al. 2017; Sadeghi-Zadeh et al. 2019). The applica-
tion of quantum mechanics in computing and information has led to the emergence of two
new branches called computational computing and information. Quantum information is a
branch of science in which methods of information transfer are studied using the principles
of quantum mechanics (Bennett and Brassard 1984; Nielsen and Chuang 1997).
* Monireh Houshmand
[email protected]
1
Department of Electrical Engineering, Imam Reza International University, Mashhad, Iran
2
Department of Management, Science and Technology, Amirkabir University of Technology
(Tehran Polytechnic), Tehran, Iran
13
Vol.:(0123456789)
245 Page 2 of 16 M. Khorrampanah et al.
Digital images are mainly divided into three main parts: binary images, gray level
images and color images. Binary images are encoded in a two-dimensional array, using one
bit per pixel that represents zero black and one white. Gray level images in a two-dimen-
sional array of pixels are encoded by 8 bits per pixel, showing zero black and 255 white
so, the values between
them show different intensities of gray. With the advent of quantum
computing and the expansion of the use of quantum information theory, many researchers
have recently been trying to use the achievements of quantum information theory in image
processing. Therefore, quantum image processing means the use of quantum computing
and quantum circuits for better and faster processing of digital images that are encoded
using different quantum representations.
In recent years, many efforts have been made to provide methods for processing the
quantum images (Heidari et al. 2017a, b, 2019a, b; Naseri et al. 2017a, b; Heidari and
Farzadnia 2017). First, in 2003, the first method to display quantum images was proposed
(Venegas-Andraca and Bose 2003). Wengas-Andraka and his colleagues used a network of
qubits to represent the quantum image. By introduction of the idea of quantum
image rep-
resentation, other research was conducted to display images in various other ways. Exam-
ples include the interlaced image by Venegas-Andraca et al. (2010), the real coat by Le
et al. 2011), the flexible display for quantum images by Sun et al. (2013), the quantum dis-
play for RGB-based multichannel images by Zhang et al. (2013a) mentioned an advanced
method for displaying quantum images by Li et al. ( 2014) and a quantum representation
for multidimensional images by Abdolmaleky et al. (2016). Quantum image processing has
been extensively researched in areas such as quantum image watermarking, quantum image
preprocessing and quantum image cryptography (Zhang et al. 2013b). The algorithm in
Zhang et al. (2013b) is based on a key that only shifts the pixels. Heidari and Naseri (2016)
proposed a method to increase the security of the binary watermarked image. In Zhou et al.
(2015), the NEQR quantum model is used to display the image. Heidari et al. (2019c)
introduced a method to encrypt quantum images based on the location and color of pixels.
In this paper, we propose a new method for encryption RGB color image using quan-
tum computing. In this study, we will propose and introduce a new method for RGB color
image encryption using quantum computing. Image encryption means making the image
meaningless using a key so that only the recipient of the message is able to extract and use
the original image. The rest of the paper is organized as follows. Section 2 introduces the
methods encryption algorithm consists of two general phases. Afterwards, the final results
and analyzing of the proposed protocol are given. Finally, Sect. 4 shows the conclusion.
2 Proposed protocol
The encryption algorithm consists of two general phases. In the first step, the desired
colored image is scrambled using the bit planes without any key. In the second phase, the
scrambled image will be encrypted using a key. The diagram of this algorithm is shown in
Fig. 1.
At first, the main goal is to scramble the image without a key. In short, this phase of the
algorithm can be summarized in moving the bit planes. Recently, Li et al. (2018) pro-
posed a quantum representation called BRQI for bit-plane digital images. The proposed
13
New method to encrypt RGB images using quantum computing Page 3 of 16 245
algorithm is based on the study of Li et al. because this method requires n + 4 qubits to
display an image with size 2n−k × 2k , which saves a significant amount of qubit memory
compared to the previous models. For a RGB image, the BRQI quantum representation
will be as Eq. (1) that ch is the desired channel and can be one of the values 00, 01 and 10.
In detail, to display a color image using this method, it is enough to show the type of chan-
nel with two qubits. This means that the red channel is coded with 00, the green channel
with 01 and the blue channel with 10.
3 n−k
2 2 −1 2 −1 2 −1 k
� 8� 1 �� � �
�ψ = √
�
�g(x ⋅ y)⟩�x⟩�y⟩�l⟩�ch⟩ (1)
2n+3 ch=0 l=0 x=0 y=0
In Eq. (1), �x⟩ = ��xn−1 xn−2 … xk ⟩ and �y⟩ = ��yk−1 yk−2 … y0 ⟩ specifies the vertical and hor-
izontal axes of the image, respectively. These two sequences of the qubits show the loca-
tions of the desired pixel. Also �g(x ⋅ y)⟩ represents the color of the pixel, which is a single
qubit.
According to Eq. (1), �l⟩ specifies the bit plane, that it holds the values 0–7 in binary
form, which represents the desired bit plane. The string qubit �l⟩, which consists of three
qubits ��l0 l1 l2 ⟩, represents the bit planes. Therefore, only by changing these three qubits, can
the image be scrambled without considering the color channel. Our scrambling algorithm
is proposed as follows and shown in Fig. 2.
For all of the even pixels: (1) If ��l2 ⟩ = 0, so, g(x ⋅ y) must be NOT. (2) Exchanging of the
�l ⟩ and �l ⟩. (3) Exchanging of the �l ⟩ and �l ⟩. (4) If �l ⟩ = 0, so, �l ⟩ must be NOT. (5) All
�0 �1 �1 �2 �2 �0
of the ��l0 ⟩, ��l1 ⟩ and ��l2 ⟩ must be NOT.
For all of the odd pixels: (1) If ��l2 ⟩ = 0, so, g(x ⋅ y) must be NOT. (2) Exchanging of the
�l ⟩ and �l ⟩. (3) Exchanging of the �l ⟩ and �l ⟩. (4) If �l ⟩ = 0, so, �l ⟩ must be NOT. (5) All
�0 �2 �1 �2 �2 �1
of the ��l0 ⟩, ��l1 ⟩ and ��l2 ⟩ must be NOT.
13
245 Page 4 of 16 M. Khorrampanah et al.
Since this phase is divided into two parts of the pixels as odd and even, we consider the
locations of the pixels. Therefore, we consider the qubit string �x⟩�y⟩, which represents the
location of the image pixel. In the decimal displaying of the binary numbers, only the least
valuable bit specifies the binary string is even or odd. Therefore, the least valuable qubit in
the qubit string �x⟩�y⟩ specifies even or odd location of the desired pixel. If this qubit is 0,
the desired pixel will be even, and if it is one, the desired pixel will be odd. In the string
qubit �x⟩�y⟩, where �y⟩ = ��yk−1 yk−2 … y0 ⟩, we can only measure ��y0 ⟩ we specify the even or
odd location of the pixel in the image.
In the first phase, to run the algorithm, we only need C-NOT, CC-NOT and swap gates.
Figures 4 and 5 shows the quantum circuit designed for the first phase. According to the
proposed steps, this circuit must be designed in two parts for even and odd pixels sepa-
rately. By considering the qubit ��y0 ⟩, we understand the location of the pixel.
In quantum circuits, there are two types of control conditions that are represented by
symbols ∙ and ◦. If the control condition is a control qubit ◦, then the target circuit will only
be affected if the control qubit is zero, otherwise it will not change. Similarly, if the control
condition is a control qubit ∙ , then the target circuit will only be affected if the control qubit
is one, otherwise it will not change. We can put a one-bit binary tag on these symbols. That
is, zero for ◦ and also one for ∙.
Our proposed algorithm will be based on a key which the sender and receiver of the image
agreed. In the proposed algorithm, in order to increase security, the key is part of an image.
We labeled the key of the image as K. The definition of this key in BRQI will be as Eq. (2).
In BRQI, the ch for red, green and blue channels are 00, 01 and 10. In the proposed quan-
tum encryption method, we will consider the red channel of the K key as the main key.
13
New method to encrypt RGB images using quantum computing Page 5 of 16 245
3 n−k
2 2 −1 2 −1 2 −1 k
1 � � � �� � �� � � � �
�K⟩ √ �g x� ⋅ y� ��x� ��y� ��l� ��ch� (2)
�
2n+3 � � � �
ch =0 l =0 x =0 y =0
2.2.2 Synchronize the positions of the pixels in the main image and the key image
The proposed method is based on increasing the security to prevent the extraction of origi-
nal data by unauthorized persons. Now, to use the key image, all of the positions of the
pixels must be equal with the original image. Figure 3 shows the desired quantum circuit
13
245 Page 6 of 16 M. Khorrampanah et al.
which the auxiliary qubit value equal to 1 the positions of the key image and the main
image are equal.
The first C-NOT is applied to the two qubits X0 and X0. If the qubit X0 is equal to one,
′
the qubit X0 is knotted, and if this qubit is equal to zero, the qubit X0 will not change. The
′ ′
values of X0 and X0 are equal when the output value of the C-NOT gate is zero. Therefore,
′
we define the auxiliary qubit by measuring the output of the C-NOT gate and applying the
zero condition. This means that when the auxiliary qubit is one, the two qubits X0 and X0
′
will be equal. The circuit in Fig. 2 extends the above description to all qubits and locations.
For this purpose, two qubit strings are equal when all the output of the C-NOT gates are
zero.
The input of this algorithm is the scrambled image obtained in the first phase. This stage
of the algorithm consists of three parts. Recommended for red, green and blue channels
separately. It is important to note that we only use the first four bit planes of the red key
image channel. As shown in Fig. 4, the inputs are the scrambled image obtained from the
first phase, the key image and the auxiliary qubit, respectively. In this circuit, filled circles
represent one and empty circles represent zero. More details of this circuit are as following:
�a⟩: This part of the circuit is defined as the auxiliary qubit, which is set in the spatial
position synchronization circuit.
Fig. 4 Designed of the quantum circuit of the second phase of the proposed algorithm
13
New method to encrypt RGB images using quantum computing Page 7 of 16 245
| ′⟩ | ⟩
|ch1 and |ch′2 : This part of the circuit is used to determine the channel of the key
| |
image. Using condition 00 to the qubit string ch, we ensure that we only use the red
channel of key image.
| ′⟩ | ′⟩ | ⟩
|l0 , |l1 and |l2′ : The number of bit plane is specified by the qubit string ��l2 l1 l0 ⟩ which
| | |
contains values between 0 and 7, i.e. 000 to 111. This part of the circuit according to the
proposed algorithm controls the applied condition of the first, second, third and forth bit
planes. ⟩
�G(X ⋅ Y)⟩ and ||G� (X ⋅ Y) : This part of the circuit performs the final XOR operation.
�ch ⟩ and �ch ⟩: This section is for applying the 00 condition to the red channel of the
� 0 � 2
input image.
�l ⟩, �l ⟩ and �l ⟩: This part of the circuit applies the page condition of bits 000 to 111 to
�0 �1 �2
the input image.
We compare our proposed algorithm with Heidari et al. (2019c) for quantum scrambling of
RGB image. These images have the size of 256 × 256 which are shown in Fig. 5a1–a6. The
result of applying the proposed cryptographic algorithm to the images shown in Fig. 5. The
first column is the main image and the second column shows the key image. The third col-
umn shows the final results obtained from the proposed algorithm which is the encrypted
image. Finally, decrypting the encrypted image produces the original medical image shown
in the fourth column.
In this section, we analyze the performance of the proposed algorithm using evaluation
of criteria’s including histogram analysis, correlation coefficient of pixels adjacent to cor-
relation diagram analysis and entropy by MATLAB software.
3.1 Histogram diagram
We consider the House image with a size of 256 × 256 as input image and Baboon as key
image. The main house histogram for the three red, green and blue channels is shown in
Fig. 6. As shown in Fig. 6, the intensity distribution of different colors of encrypted image
histogram using proposed algorithm is more flat and uniform, so is suitable than Heidari
et al. algorithm.
In detail, to get the histogram of the image in three states of red, green and blue, we give
the original image in the size of 256 × 256 as input to the codes which are written in MAT-
LAB software and pass through three channels of red, green and blue. Finally, using the
MATLAB library, we obtain the histogram of images as output of each channel (Fig. 7).
In process of scrambling of the image, the correlation between the pixels is lost. Correla-
tion coefficients are examined in three directions of horizontal, vertical and diagonal coor-
dinates which are calculated as Eq. (3). We compare the correlation coefficient of adjacent
pixels of the airplane, Lena, peppers and sailboat on lake images with size 256 × 256 of
the proposed method and protocol of Heidari et al. (2019c) on Lena image which shown in
Table 1.
13
245 Page 8 of 16 M. Khorrampanah et al.
Fig. 5 a1–a6 main images. b1–b6 key images. c1–c6 encrypted images. d1–d6 decrypted images
13
New method to encrypt RGB images using quantum computing Page 9 of 16 245
Fig. 6 Histogram of the house image for the three red, blue and green channels
13
245 Page 10 of 16 M. Khorrampanah et al.
Fig. 7 Histogram of the house image in Heidari et al. (2019c) and proposed protocols
�√
rxy = cov(x ⋅ y) D(x)D(y) (3)
m
1 ∑
E(x) = x
m i=1 i
13
New method to encrypt RGB images using quantum computing Page 11 of 16 245
m
1 ∑( )2
D(x) = xi − E(x)
m i=1
m
1 ∑( )( )
cov(x ⋅ y) = x − E(x) yi − E(y)
m i=1 i
The correlation between the pixels disappears after the irregularity process. The
correlation diagram between the pixels in three directions of horizontal, vertical and
diagonal coordinates has also been investigated in order to evaluate the performance of
the proposed algorithm. In the main images, which have a correlation between the pix-
els, the correlation diagram has a specific orientation in each direction. In encrypted
images where there is no correlation between the pixels, the correlation diagram is
completely visually scattered and has no definite orientation. Correlation diagram
analysis is desirable in our proposed algorithm and is completely dispersed after the
deregulation process. Figures 8 and 9 show examples for the correlation diagrams. In
these diagrams, the left column corresponds to the original image and the right column
corresponds to the encrypted image.
13
245 Page 12 of 16 M. Khorrampanah et al.
Fig. 8 Correlation diagrams of the airplane a1–a3 before and b1–b3 after encryption of the image with key
image of peppers
Fig. 9 Correlation diagrams of the sailboat on lake a1–a3 before and b1–b3 after encryption of the image
with key image of peppers
13
New method to encrypt RGB images using quantum computing Page 13 of 16 245
3.3 Entropy
Table 2 shows the comparison of entropy for the airplane, Lena, peppers and sailboat on
lake images with sizes of 256 × 256 which calculated using proposed method and protocol
of Heidari et al. (2019c) based on Lena image. The entropy information increases after the
scrambling process and, is as close as possible to 8 (8 bits describe each pixel) so, we have
a high performance compared to the Heidari et al. method.
The overall complexity of the proposed network for a BRQI image will be as: circuit com-
plexity of first phase + circuit complexity of second phase + (2 × complexity of the circuit
synchronizing positions). So, in the following, we compute the circuit complexity of the
two phases and temporal complexity of a quantum circuit synchronizing positions.
According to the three above steps, the overall complexity of the proposed network for
a BRQI image will be o (n + k). Also, to run the proposed algorithm in the classical com-
puter, it is necessary to run the proposed algorithm to the size of the entire image pixels.
The time complexity of the proposed algorithm for the image with size of 2n−k × 2k in a
classical computer, will be o (2n). Heidari et al. (2019c), the temporal complexity of the
colored image with the size of the 2n × 2n is o (n22n). To compare the temporal complex-
ity of this study with classical state and study of Heidari et al. (2019c), we compute the
temporal complexity of Heidari et al. (2019c) in image with size of 2n−k × 2k , which is o
((n − k)2n). The temporal complexity of Heidari et al. (2019c) is very high, because the
13
245 Page 14 of 16 M. Khorrampanah et al.
13
New method to encrypt RGB images using quantum computing Page 15 of 16 245
number of the C-NOT gates of the designed circuit is 2n and is very high. As a result, our
proposed method has a better temporal complexity than its classical equivalent and related
work. Table 3 shows the comparisons of the results.
4 Conclusion
In this study, a new method for quantum RGB image encryption was proposed. The pro-
posed algorithm consists of two phases. In the first phase, a simple scaling algorithm is
performed, which the input bit planes for all three red, green, and blue channels are moved
using the C-NOT control gates and displacement. Then, the output of the first phase is
given to the second phase. In the second phase, a key is used to increase image secu-
rity. Finally, the encrypted image is generated using the defined key. This image can be
decrypted by the virtual person that holds the key. To analyze this algorithm, we used cri-
teria such as histogram, entropy, correlation coefficient of adjacent pixels, and correlation
diagram. We found that the proposed algorithm has a temporal complexity of o (n + k)
(when the image size is 2n−k × 2k).
In future research, we intend to use confused functions, which are much scrambled,
instead of using the key image.
Declarations
Conflict of interest The authors have not disclosed any conflict of interest.
References
Abdolmaleky, M., Naseri, M., Batle, J., Farouk, A., Gong, L.H.: Red–green–blue multi-channel quantum
representation of digital images. Opt. Int. J. Light Electron Opt. 128, 121–132 (2016)
Bennett, C.H., Brassard, G.: Quantum cryptography: public key distribution and coin tossing. In: Comput-
ers, Systems, and Signal Processing, pp. 175–179 (1984)
Hassanpour, S., Houshmand, M.: Bidirectional teleportation of a pure EPR state by using GHZ states.
Quantum Inf. Process. 15(2), 905–912 (2016)
Heidari, S., Farzadnia, E.: A novel quantum LSB-based steganography method using the Gray code for
colored quantum images. Quantum Inf. Process. 16(10), 242 (2017)
Heidari, S., Naseri, M.: A novel LSB based quantum image watermarking. Int. J. Theor Phys. 55(10), 4205–
4218 (2016)
Heidari, S., Pourarian, M.R., Gheibi, R., Naseri, M., Houshmand, M.: Quantum red–green–blue image steg-
anography. Int. J. Quantum Inf. 15(05), 1750039 (2017a)
Heidari, S., Gheibi, R., Houshmand, M., Nagata, K.: A robust blind quantum copyright protection method
for colored images based on owner’s signature. Int. J. Theor. Phys. 56(8), 2562–2578 (2017b)
Heidari, S., Abutalib, M.M., Alkhambashi, M., Farouk, A., Naseri, M.: A new general model for quantum
image histogram (QIH). Quantum Inf. Process. 18(6), 175 (2019a)
Heidari, S., Naseri, M., Nagata, K.: Quantum selective encryption for medical images. Int. J. Theor. Phys.
58(11), 3908–3926 (2019b)
Heidari, S., Vafaei, M., Houshmand, M., Tabatabaey-Mashadi, N.: A dual quantum image scrambling
method. Quantum Inf. Process. 18(1), 1–23 (2019c)
Khorrampanah, M., Houshmand, M.: An efficient quantum secret sharing using secure direct communica-
tion. In: 2013 21st Iranian Conference on Electrical Engineering (ICEE), pp. 1–5. IEEE (2013)
13
245 Page 16 of 16 M. Khorrampanah et al.
Le, P.Q., Dong, F., Hirota, K.: A flexible representation of quantum images for polynomial preparation,
image compression, and processing operations. Quantum Inf. Process. 10(1), 63–84 (2011)
Li, H., Zhu, Q., Zhou, R., Song, L., Yang, X.: Multi-dimensional color image storage and retrieval for a nor-
mal arbitrary quantum superposition state. Quantum Inf. Process. 13(4), 991–1011 (2014)
Li, H.S., Chen, X., Xia, H.Y., Liang, Y., Zhou, Z.: A quantum image representation based on bitplanes.
IEEE Access 6, 62396–62404 (2018)
Lloyd, S.: Almost any quantum logic gate is universal. Phys. Rev. Lett. 75(2), 346349 (1995)
Moore, G.: Moore’s law. Electron. Mag. 38(8), 114 (1965)
Naseri, M., Heidari, S., Baghfalaki, M., Fatahi, N., Gheibi, R., Batle, J., Farouk, A., Habibi, A.: A new
secure quantum watermarking scheme. Optik 139, 77–86 (2017a)
Naseri, M., Heidari, S., Gheibi, R., Gong, L.-H., Ahmadzadeh Rajii, M., Sadri, A.: A novel quantum binary
images thinning algorithm: a quantum version of the Hilditch’s algorithm. Optik 131, 678–686 (2017b)
Nielsen, M.A., Chuang, I.L.: Programmable quantum gate arrays. Phys. Rev. Lett. 79, 321–324 (1997)
Sadeghi-Zadeh, M.S., Houshmand, M., Aghababa, H., Kochakzadeh, M.H., Zarmehi, F.: Bidirectional
quantum teleportation of an arbitrary number of qubits over noisy channel. Quantum Inf. Process.
18(11), 353 (2019)
Sun, B., Iliyasu, A., Yan, F., Dong, F., Hirota, K.: An RGB multi-channel representation for images on
quantum computers. J. Adv. Comput. Intell. Intell. Inform. 17(3), 404–417 (2013)
Venegas-Andraca, S.E., Bose, S.: Storing, processing and retrieving an image using quantum mechanics. In:
Proceeding of the SPIE Conference Quantum Information and Computation, pp. 137–147 (2003)
Venegas-Andraca, S.E., Ball, J.L., Burnett, K., Bose, S.: Processing images in entangled quantum systems.
Quantum Inf. Process. 9, 1–11 (2010)
Zadeh, M.S.S., Houshmand, M., Aghababa, H.: Bidirectional teleportation of a two-qubit state by using
eight-qubit entangled state as a quantum channel. Int. J. Theor. Phys. 56(7), 2101–2112 (2017)
Zhang, Y., Lu, K., Gao, Y., Wang, M.: NEQR: a novel enhanced quantum representation of digital images.
Quantum Inf. Process. 12(8), 2833–2860 (2013a)
Zhang, W.-W., et al.: A watermark strategy for quantum images based on quantum Fourier transform. Quan-
tum Inf. Process. 12(4), 793–803 (2013b)
Zhou, R.G., Sun, Y.J., Fan, P.: Quantum image gray-code and bit-plane scrambling. Quantum Inf. Process.
14, 1717–1734 (2015)
Publisher’s Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and
institutional affiliations.
13