# Experimental realization of BB84 protocol with different phase gates and
SARG04 protocol

Sinchan Ghosh<EMAIL_ADDRESS>Department of Physics, Ramakrishna
Mission Vidyamandira (Affiliated to Calcutta University), Belur, Howrah,
711202, West Bengal, India  Harsh Mishra<EMAIL_ADDRESS>Department
of Physical Sciences, Indian Institute of Science Education and Research,
Berhampur, India  Bikash K. Behera<EMAIL_ADDRESS>Bikash’s Quantum
(OPC) Pvt. Ltd., Balindi, Mohanpur, 741246, Nadia, West Bengal, India
Prasanta K. Panigrahi<EMAIL_ADDRESS>Department of Physical
Sciences,
Indian Institute of Science Education and Research Kolkata, Mohanpur 741246,
West Bengal, India

###### Abstract

Cryptography in the modern era is very important to prevent a cyber attack, as
the world tends to be more and more digitalized. Classical cryptographic
protocols mainly depend on the mathematical complicacy of encoding functions
and the shared key, like RSA protocol in which security depends upon the fact
that factoring a big number is a hard problem to the current computers. This
means that high computing power can help you crack traditional encryption
methods. Quantum machines claim to have this kind of power in many instances.
Factorization of big numbers may be possible with Shor’s algorithm with
quantum machines in considerable time. Apart from this, the main problem is
key sharing i.e., how to securely share the key the first time to validate the
encryption. Here comes quantum key distribution. Two parties who are
interested in communication with each other, create a process, which claims
considerable security against an eavesdropper, by encoding and decoding
information in quantum states to construct and share a secret key. Quantum key
distribution may be done in a variety of ways. This paper begins with
experimental verification of the BB84 procedure utilizing four bases (using
phase gates) followed by the experimental realization of the SARG04 protocol
which was derived from BB84 Protocol to overcome PNS attack. The possibility
of a third-party attack and the effect of noise is considered and implemented.
The IBM Quantum Experience platform was used for all of the implementations.

Quantum Cryptography, IBM Quantum Experience, Quantum Information Theory

##  I Introduction

Quantum cryptography claims considerable attention by promising top-notch
security by allowing back-end operations that exploit the weirdness of quantum
physicsRQC2011Science2011 . Over time, this field has been developed
positively with specialization in the security of communication. The idea of
cryptography using quantum physics was initiated about 27 years ago. The first
quantum key distribution protocol was invented to develop a secure
construction of a secret key despite the presence of a third-party hacking
adversary i.e. Eve, withholding maximum access to technology. This is
naturally done to make sure that the developed protocol’s security is not
compromised qkd_PathakCRC2018 . This became a new emergence in quantum
information theory, and progress has continued to accelerate since then. This
first protocol was known as the BB84 protocol BBQCIEEE1984 ; BCBTCS2014
introduced by Bennett and Brassard in the year 1984. Furthermore, several
protocols have been developed, over the years, to make sure the key
distribution allows security from eavesdropping at the maximum possible level.
Quantum Key Distribution started developing over time, both in terms of
efficiency and experimentation HFPR2014 ; BFO2017 ; AFPRA2012 ; CHBJoC1992 ;
MMNP2019 ; DAMIEEE2013 . SARG04 protocol was built to make BB84 more secure by
decreasing PNS attacks. Experimenting with these protocols on IBM Quantum
Experience (IBM QX) using local simulators and actual quantum processors is
crucial because it helps to understand the importance of gate operations on
qubits in quantum computation. Also, the simulation of a circuit from the real
quantum device (up to a certain limit) gives an idea of real-time performance
and errors and helps to apply appropriate implementation techniques. A part of
reference DAMIEEE2013  implements BB84 protocol using 8 qubits on the IBM QX
platform with and without the presence of Eavesdropper, using two bases and
also a part of the reference ERQKD2020  implements BB84 protocol on the IBM QX
platform using 8 qubits with and without the presence of Eavesdropper using
three bases. To emphasize the relevance of phase gates in quantum computation,
we have investigated implementing the BB84 protocol utilizing four bases
(using Phase gates) as well as the SARG04 protocol on the IBM QX platform.

##  II BB84 PROTOCOL WITH FOUR BASES

BB84 protocol was designed such that every bit of randomly chosen string would
be encoded into the two polarization states of a single photon (which can be
represented by qubits). As photon is a quantum particle, without destroying
the photon, its polarization state cannot be measured, which implies that the
encoded information in the photon is frangible QKDL12 . Considering this fact,
we assume that this is the reason why an eavesdropping attack does not allow
the information to be available to the eavesdropper. The BB84 protocol can be
briefly understood by considering the following points NCCUP2000 .
Implementation of BB84 protocol on IBM QX using four bases has been performed
in the first part of this paper.

  * •

Alice produces a bit-string, randomly choosing a set of 2n (say) data bits

  * •

She then encodes her data bit using four states (two basis X and Z)
$\Ket{0}$,$\Ket{1}$,$\Ket{+}$ and $\ket{-}$ and sends it to Bob.

  * •

Bob receives the qubits and announces that fact. He then measures the received
qubits on the X or Z basis at random.

  * •

Then both announce publicly the basis on which they have measured. After that,
they find n (say) bits are encoded and decoded using the same basis. Those are
left for the preparation of the secret key.

  * •

An eavesdropper, Eve can attack while transmitting. She measures the qubits in
the X or Z basis at random, then encodes that qubit again on the same basis.
If Eve’s decoding base matches with Alice’s encoding base, then Eve gets the
right information.

  * •

Now they need to check whether or not eavesdropping took place. So, n/2 bits
serve as a check on the intervention and are shared with Bob through a
classical channel by Alice.

  * •

Now Bob compares his measurement of those n/2 qubits with Alice’s preparation.
If the comparison result does not show an acceptable number of consistent bits
despite having chosen the same basis, then the protocol fails. The existence
of an eavesdropper or noise in the quantum channel is certain. Now they leave
that channel and try for another channel.

  * •

Now, if that comparison result shows an acceptable number of consistent bits,
then they can continue and proceed for communication using the remaining n/2
bits as the secret key.

We aim to increase the efficiency of the protocol by decreasing the amount of
bit information revealed to the eavesdropper. If any accepted key bit is
measured by Eve with the same basis then the attack will remain untraced. So,
using four basis states instead of two decreases the probability of Eve
measuring the qubit with the same basis as used by Alice for encoding. So,
there is an enhance in security.

###  II.1 IMPLEMENTATION OF BB84 PROTOCOLS ON IBM QX

This section portrays the experimental implementation of the BB84 protocol
using four bases. Let’s say the two parties, Alice and Bob want to share a
secret key through a quantum protocol. Thus, let’s say Alice chooses 2n number
of random data bits and sends it to Bob. For the encoding procedure, she
randomly uses any one of the four basis and sends the resultant state to Bob
through a public quantum channel. X & Y basis are the two of the four bases.
Among the other two, one basis is formed applying hadamard & T gate
consecutively and the other is formed applying hadamard & Z gate
consecutively. We have discussed the operations of these gates later. After
Bob receives the 2n qubits, he measures each of those qubits on one of the
four basis at random. Alice and Bob henceforth crosscheck their basis
measurements. The classical post-processing part which has to be followed is
the same as done for the implementation of BB84 protocol using two bases.
Let’s take a look at the procedure of implementation.

Figure 1: Implementation of BB84 protocol using four bases. The left part of the first barrier portrays the initial bit-string. The part between the first & second barrier and the part between the second & third barrier portray Alice’s encoding and Bob’s decoding respectively. The distance between the second and third barrier can be considered as the quantum channel. The right part of the fourth barrier contains Bob’s measurements. Qubit Index | q[0] | q[1] | q[2] | q[3] | q[4]
---|---|---|---|---|---
Alice | 1 | 0 | 1 | 1 | 0
Alice’s Basis | Y | HT | Y | HZ | HT
Bob’s Basis | Y | HT | X | HZ | HZ
Result | A | A | D | A | D
Table 1: Initial value of all the qubits i.e. from q[0] to q[4] is $\Ket{0}$
as default. We have used not gate to get qubit value $\Ket{1}$. The qubits
which are measured with the same basis as used by Alice, are the ones that are
considered to be key bit. A stands for “Accepted” whereas D stands for
“Discarded”.

Table.1 shows the qubits which will be taken into consideration whereas
Table.2 shows gates that are required to measure along with different bases.
We use here phase gates of different angles. A phase gate applies a phase of
$e^{i\theta}$ to the $\Ket{1}$ state of the qubit. H is the hadamard gate
while S is the phase gate for angle $\pi/2$. T is the phase gate for angle
$\pi/4$. And the Z gate is the phase gate for angle $\pi$. The explicit matrix
forms of phase gates and hadamard gate are given below. S†, T†, Z are the
complex conjugate forms of S, T, and Z gates respectively. Expected results
based on the theory are shown in Table.3.

$S=\left(\begin{array}[]{cc}1&0\\\ 0&e^{-i\pi/2}\end{array}\right)\quad
H=\frac{1}{\sqrt{2}}\left(\begin{array}[]{cc}1&1\\\ 1&-1\end{array}\right)$

$T=\left(\begin{array}[]{cc}1&0\\\ 0&e^{i\pi/4}\end{array}\right)\quad
Z=\left(\begin{array}[]{cc}1&0\\\ 0&-1\end{array}\right)$

Qubit Index | q[0] | q[1] | q[2] | q[3] | q[4]
---|---|---|---|---|---
Alice’s gates for | X | - | X | X | -
string construction |  |  |  |  |
Alice’s gates for | HS | HT | HS | HZ | HT
string encoding |  |  |  |  |
Bob’s decoding |  $S^{†}$H |  $T^{†}$H | H | ZH | ZH
gates |  |  |  |  |
Table 2: Gate utilization for the example of 5-qubit model. Since S is a hermitian matrix, $SS^{†}=I$ which implies Bob needs to use $S^{†}H$ gates to invert the operation of HS gates (i.e., decoding information). This is similar for T gate. Qubit Index | Expected
---|---
| Result
q[0] | 1 (100%)
q[1] | 0 (100%)
q[2] | 0 (50%) & 1 (50%)
q[3] | 1 (50%)
q[4] | 0 (50%) & 1 (50%)
Table 3: These are the expected results based on the BB84 protocol using four
bases. Parentheses include the probability of getting that particular bit
after measurement.

####  II.1.1 Simulation using local simulator

The implementation for this 5-qubit example is given in Fig.1 and the results
of this implementation through local simulator are given in Fig.2. This local
simulator is a classical machine that approximates quantum calculation up to a
limit. So, this implementation result is similar to the theoretically expected
result in Table.3. The probability of q[0] through experimental results is
calculated as shown in the reference paper MKAAANICCAIS2019 . Table.4 shows
the experimental results after implementation.

Figure 2: Result of implementation of BB84 protocol using four bases acquired
through IBM QX (ibmq_qasm_simulator) using 8192 runs. In all of the outputs,
the value of q[0] is 1 which implies that the probability of acquiring 1 is
100% which is what we expected. Similarly, the probability of measuring other
qubits can be calculated like this and will be similar to the result in table
3.

####  II.1.2 Simulation using real quantum device(ibmq_manila)

This section portrays the experimental implementation of the BB84 protocol
using four bases in a real quantum device through IBM QX. The back-end device
used here is ibmq_manila, a five qubit processor. As simulated from real
quantum device, the output result (in the Fig.3) is a bit deviated from the
expected result (in the Fig.2) due to the various computational error. Result
for every qubit acquired from the real device is shown in Table.4.

Figure 3: Result of implementation of BB84 protocol using four bases acquired through IBM QX (ibmq_manila) using 8192 runs. In all of the outputs, the value of q[0] is not 1 which implies that the probability of acquiring 1 is less than expected 100%. The deviation is due to various computational error in real device. Similarly, the probability of measuring other qubits are calculated like this and tabulated in Table.4. Qubit Index | Experimental
---|---
| Result
q[0] | 0 (3.9%) & 1 (96.1%)
q[1] | 0 (99.1%) & 1 (0.9%)
q[2] | 0 (48.8%) & 1 (51.2%)
q[3] | 0 (3.0%) & 1 (97.0%)
q[4] | 0 (14.4%) & 1 (85.6%)
Table 4: These are the experimental results for every qubit obtained by
simulating BB84 protocol using four bases in IBM QX (ibmq_manila) using 8192
runs. Parentheses include the probability of getting that particular bit after
measurement.

####  II.1.3 Fidelity calculation of individual qubits

The fidelity of a quantum state is a measure of closeness. Here, we measure
fidelity between the state of qubit before encoding by Alice and the state
after decoding by Bob. If the fidelity value is close to 1, we can take the
bit as a key bit. We have calculated the fidelity separately for 5 qubits
using the equation belowJozsa1994 -

$\textrm{Fidelity
}=tr(\sqrt{\rho^{(\text{E})}\rho^{(\text{T})}\rho^{(\text{E})}})$ (1)

where theoretical density matrix $\rho^{(\text{T})}$ is simply the difference
of the probabilities of 0 and 1 while experimentally obtained density matrix
$\rho^{(\text{E})}$ is calculated asBKbehera -

$\rho^{(\text{E})}=\frac{1}{2}(I+\langle X\rangle X+\langle Y\rangle Y+\langle
Z\rangle Z)$ (2)

The fidelity value of each separate qubit of BB84 protocol is tabulated in
Table.5 below. Qubits with fidelity value very close to 1, are taken as key
bit to construct the key of encryption.

Qubit Index | Fidelity
---|---
q[0] | 0.9903666531616115
q[1] | 0.9998826058435594
q[2] | 0.5105520995810717
q[3] | 0.9988745629501058
q[4] | 0.21158200569024022
Table 5: Fidelity values for individual qubits of BB84 protocol circuit
calculated based on the result acquired from ibmq_manila on IBM QX.

####  II.1.4 Error mitigation in real quantum device

The effect of different types of noise, that occur throughout the computation
and make the output quite noisy, is very complex and needs to consider each
gate transformation. However, the noise occurring in the final measurement can
be reduced by the error mitigation technique. The idea behind the error
mitigation process is that the exact noiseless outcomes are assumed from the
noisy result of the real device. Then those results are used to mitigate the
errors for a more general form of state. Our BB84 circuit is processed by such
an error mitigation processGEM2020 . The histogram in Fig.4 indicates the
reduction of noise while computation.

Figure 4: Result of implementation of BB84 protocol using four bases acquired
through IBM QX (ibmq_manila) using 8192 runs after processing an error
mitigation. The result before and after mitigation is plotted simultaenously.
Clearly, mitigated result is more close to accurate result 3.

###  II.2 DIFFERENT ATTACKS ON THE QUANTUM CIRCUIT

####  II.2.1 Third party interpretation

We now move forward with implementing the circuit which portrays a third party
interpretation i.e., an eavesdropper trying to attack the circuit in the
quantum channel. The circuit is shown in Fig.5 whereas the results of the
implementation are in Fig.6. Table.4 shows the probability of occurrence of
each qubit for Bob when eavesdropping takes place.

Figure 5: Eve decodes in some assumed basis, measures, and then again encodes
the qubits while Alice’s encoded information is being sent to Bob through the
channel. The qubits cannot be copied as per the No-Cloning theorem
qkd_WoottersNature1982 . Let’s say Eve attacks on q[0], q[3], q[4]. Figure 6:
Results for implementation of an eavesdropper’s attack on BB84 protocol using
5 qubits on IBM QX (ibmq_manila). Eve measures q[1], q[3], q[4] out of which
she gets q[3] right. Once Bob reveals his measurements to Alice, they would
realize that eavesdropping has happened as the outputs do not tally with
Alice’s preparation. Calculating the probability outcomes for the three
attacked qubits, we get the results as given in the table 6.

After Error Mitigation:

Figure 7: Results for implementation of an eavesdropper’s attack on BB84
protocol using 5 qubits on IBM QX (ibmq_manila) with error mitigation. The
result of the Fig.6 is also plotted simultaneously here. The mitigated result
is more accurate.

The result of simulation for each attacked qubit is shown in Table.6. We
compare those result with the result for the normal case in the Table.4. For
q[0], the probability of getting the initial bit 1 decreases from 96.1% to
69.6% due to the attack. q[4] is not a part of key bit. Attack on q[4] doesn’t
affect our protocol. For q[3], though the eavesdropper decode in the same
basis as Alice uses to encode, the probability of getting the initial value 1
decreases from 97.0% to 88.6%. It is probably due to gate operational error in
the real quantum device as more gates operate in the circuit with attack
scenario.

Attacked qubit Index | q[0] | q[3] | q[4]
---|---|---|---
Alice’s qubit | 1 | 1 | 0
values |  |  |
P(0) | 30.4% | 11.4% | 16.4%
P(1) | 69.6% | 88.6% | 83.6%
Table 6: These are the experimental results based on the BB84 protocol using
four bases in an eavesdropping scenario. Probability of getting 0 & 1 i.e.
P(0) & P(1) are shown for the three attacked qubits q[0], q[3] & q[4] are
shown here.

We now calculate the fidelity ( as in section II.1.3) between Alice’s prepared
state and Bob’s revealed state while eavesdropping is taking place and then
compare that fidelity with the case when no eavesdropping is happening.
Comparison are shown in Table.7. Here only q[0], q[3], q[4] are subjected to
attack, so fidelity calculation is done for only these qubits.

Qubit Index | Fidelity without | Fidelity with
---|---|---
| eavesdropping | eavesdropping
q[0] | 0.9903666531616115 | 0.8727970305632149
q[3] | 0.9988745629501058 | 0.9890826260851061
q[4] | 0.21158200569024022 | 0.23464157714059153
Table 7: These are the Fidelity of the qubit states calculated based on the
experimental results from ibmq_manila of the BB84 protocol using four bases in
normal and an eavesdropping scenario.

q[0] and q[3] are accepted key bit. As the eavesdropper tries to measure q[0]
with different decoding gates, the quantum state gets disturbed. As a result,
fidelity decreases (as shown in Table:7). But as the eavesdropper measures
q[3] with the same decoding gates, the attack remains invisible to Bob. q[4]
is not a part of the accepted key bit so fidelity remains low.

####  II.2.2 Noise attack

We now can think of some noise occurrence in main information while data
transmitting through a quantum channel. We can implement this type of noise
with the help of some 2-qubit entangled gates like CX, CZ, and CY gates. If
the control bit is 0, then these gates will not show any effect. So, we have
shown the result taking the control bit as 1. The circuit is shown in Fig.8
whereas the results of the implementation are in Fig.9. Table.8 shows the
probability of occurrence of each qubit for the noise attack. Evidently,
probability of occurrence changes for those particular qubits due to attack.

Figure 8: Noise attacks are implemented.q[1],q[3],q[4] are subjected to CX, CZ & CY noise attack respectively as shown.The control qubit q[5] is set high to show the effect. Figure 9: Results for implementation of noise attack on BB84 protocol using 6 qubits on IBM QX (ibmq_qasm_simulator). Once Bob reveals his measurements to Alice, they would realize that some attack has happened as the outputs do not tally with what Alice had encoded. The probability outcomes for all three attacked qubits are shown in Table.6. Qubit Index | q[1] | q[3] | q[4]
---|---|---|---
Attack on Alice’s | 0 | 1 | 0
qubits (values) |  |  |
Type of Attack | CX | CZ | CY
P(0) | 53.3% | 97.7% | 87.2%
P(1) | 46.7% | 2.3% | 12.8%
Table 8: These are the experimental results based on the BB84 protocol using
four bases in a noise attack scenario. Parentheses include the probability of
that particular bit.

Also, we have calculated the fidelity of each qubit, subjected to noise
attack, to show the change of qubit state due to the attack. Fidelity of q[1],
q[3] and q[4] has been calculated (like in the section.II.1.3) and tabulated
in Table.9.

Qubit Index | Fidelity without | Fidelity with
---|---|---
(Attack-type) | eavesdropping | eavesdropping
q[1] (CX) | 0.9998826058435594 | 0.5771227257614313
q[3] (CZ) | 0.9988745629501058 | 0.07043737053093656
q[4] (CY) | 0.21158200569024022 | 0.8664884620665283
Table 9: These are the Fidelity of the qubit states calculated based on the
experimental results from ibmq_manila of the BB84 protocol using four bases in
normal and an noise attack scenario.

As evident from Table.9, accepted key bits (here q[1], q[3]) are affected by
the noise attack. The fidelity becomes very low for these qubits. So, in
practical implementation, Bob will not get the expected result as the quantum
state is changing considerably due to these noise attacks. Though there are
few exceptions where certain noise attack doesn’t affect the quantum state
encoded in certain basis. Exceptions are shown in Fig.10 and fidelity results
are shown in Table.10. As an explanation, for case (b), applying S gate after
H gate leaves the qubit state through the z-axis of blotch spherebloch  with a
phase of $\pi/2$ to the $\Ket{1}$ state. Applying Y gate rotates the state at
an angle of $\pi$ which leaves the qubit through the z-axis in the bloch
sphere as before. Similarly, in the case of (a) & (b), applying X gate doesn’t
change the qubit state through the z-axis in the bloch sphere.

Figure 10: Circuits for the three fault-tolerant cases encoded in a certain basis and subjected to certain noise attacks. The initial qubit value is taken as 0 in each case. Qubit | Fidelity without | Fidelity with
---|---|---
| noise attack | noise attack
q[0] in (a) | 0.9903666531616115 | 0.9944090977516634
q[0] in (b) | 0.9988745629501058 | 0.9937805250263796
q[0] in (c) | 0.9975738546501054 | 0.9976180022158906
Table 10: These are the Fidelity of the qubit states of the circuits of Fig:
10 calculated based on the experimental results from ibmq_manila. As evident,
quantum state doesn’t get changed much as fidelity remains very close to 1.

##  III SARG04 PROTOCOL

SARG04 protocol was built intending to create a more robust version of the
BB84 protocol. The same four states of BB84 were used in the case of SARG04
but with a different information encoding process. In BB84 protocol, when
laser pulse with lower-level attenuation is used to encode bit in a photon. If
any pulse contains more than one photon, the eavesdropper can transmit a
single photon to the receiver after splitting off the extra photon. This is a
photon number splitting attack 2000PhRvL..85.1330B . SARG04 was defined by
Scarani et al. in 2004 in Physical Review Letters as more efficient against
PNS attack but it is equivalent to BB84 when viewed at the level of quantum
processing 2004PhRvL..92e7901S . The basic working of SARG04 protocol is
described below:

  * •

Alice intends to communicate with Bob. She starts with two strings of bit, x &
y. Each string is n bits long.

  * •

Now she creates a state by encoding the two-bit string such that $y_{i}$(the
ith bit in y string) decides on which basis $x_{i}$ is encoded. Value of
$y_{i}$ 1 leads $x_{i}$ to be encoded in the hadamard basis. Otherwise,
$x_{i}$ is encoded in the computational basis.

  * •

Alice sends her quantum state through a quantum channel. Bob receives the
state. Eavesdropper, Eve also can have access to the state. But bit string y
is only known to Alice, so, neither Bob nor Eve can distinguish the state of
the qubit.

  * •

Bob creates a random bit-string $y^{\prime}$ which is also n bits long. He
decodes and measures the qubits such that $y^{\prime}_{i}$ decides on which
basis $x_{i}$ will be measured. For each qubit, Alice chooses one
computational basis state and one hadamard basis state. To get the secret
bits, Bob has to distinguish between the two states. For each qubit sent, Bob
can check if the result is consistent with either possible state. If the
measurement is consistent, then he cannot decide the exact encoding basis. But
if the measurement is inconsistent, Bob can then deduce the exact state as
well as the secret bit.

  * •

From the remaining deduced bits, Alice shares a small randomly chosen part
publicly with Bob and checks whether they agree to a certain number. If the
check pass, they proceed to continue otherwise they drop that channel and
start over.

In our experimental realization, the scenario is much more simpler. As we
typically run our circuit many times (8192 runs) and produce a histogram, we
don’t need that process• ‣ III to decide the exact state. We can decide the
exact state from the probability values of $\ket{0}\&\ket{1}$ in the produced
histogram. In simpler BB84 protocol, Alice announces the chosen basis for each
qubit. The advantage of SARG04 is that Alice doesn’t announce the basis of the
bits. So, to determine the state, Eve needs to store more copies of the qubit.
We have experimentally shown the scenario in this section with the help of IBM
QX.

###  III.1 IMPLEMENTATION OF SARG04 PROTOCOLS ON IBM QX

We have simulated a 9-qubit SARG04 circuit using a ibmq_qasm_simulator. The
first 3 qubits are the information bits, the next 3 qubits are Alice’s
reference bits and the last 3 qubits are Bob’s reference bits.

Figure 11: Implementation of SARG04 protocol with 3 information bits. The left part of the first barrier portraits the initial bit-strings. The part between first & second barrier and the part between second & third barrier portraits Alice’s encoding and Bob’s decoding respectively. The distance between the second and third barrier can be considered as the quantum channel. The right part of fourth barrier contains Bob’s measurements. qubit index | q[0] | q[1] | q[2]
---|---|---|---
Alice’s reference bit | 1 | 0 | 1
Bob’s reference bit | 1 | 0 | 0
Result | A | A | D
Table 11: These are the Alice and Bob’s reference bits for different information qubits. If reference bit is same for a qubit then the qubit is accepted for creating key bit, otherwise discarded. Qubit Index | Expected
---|---
| Result
q[0] | 1 (100%)
q[1] | 0 (100%)
q[2] | 0 (50%) & 1 (50%)
Table 12: These are the expected results based on the SARG04 protocol.
Parentheses include the probability of that particular bit.

####  III.1.1 Simulation using Local Simulator

Now firstly we simulate the implemented circuit in Fig.11 through a local
simulator. As the simulator is not a real device, the histogram obtained ,
shown in Fig.12, actually indicates the theoretically calculated result as in
Table..

Figure 12: Result of implementation of SARG04 protocol acquired through IBM QX
(ibmq_qasm_simulator) using 8192 runs. The three bits from the extreme right
are information bits that were measured. In all of the outputs, the value of
q[0] is 1 & q[1] is 0 which implies that the probability of acquiring 1 & 0 is
respectively 100% which is what we expected. Similarly, the probability of
measuring q[2] and acquiring 0 is 49.4% and that of 1 is 50.6%. The results
are calculated like this and tabulated in Table.13.

####  III.1.2 Simulation using Real Quantum device(ibmq_manila)

We couldn’t simulate the whole 9-qubit circuit of the Fig.11 due to our
unavailability of real quantum processor of such qubit-volume. However, we
simulated every qubit separately through ibmq_manila and shown the result in
Table.. The effect of noise in a real quantum device is evident from the
comparison of experimental results in Table. and theoretically calculated
result in Table..

Qubit Index | Experimental
---|---
| Result
q[0] | 0 (3.1%) & 1 (96.9%)
q[1] | 0 (99.1%) & 1 (0.9%)
q[2] | 0 (53.6%) & 1 (46.4%)
Table 13: These are the experimental results obtained by simulating each qubit
of SARG04 protocol in IBM QX (ibmq_manila) using 8192 runs. Parentheses
include the probability of that particular bit.

####  III.1.3 Fidelity Calculation

We now calculate the fidelity(as in section.II.1.3) between Alice’s prepared
state and Bob’s revealed state in the SARG04 circuit. The required circuit
simulations are done through IBM QX (ibmq_manila) and the results are
tabulated below.

Qubit Index | Fidelity
---|---
q[0] | 0.9973847010664143
q[1] | 0.9982795399056618
q[2] | 0.47984599999999983
Table 14: Fidelity values for individual qubits of SARG04 protocol. As
expected from Table.8, q[0] and q[1] have fidelity close to 1 as encoding and
decoding reference bit is same for these. q[2] has low fidelity so discarded.

###  III.2 DIFFERENT ATTACKS ON THE QUANTUM CIRCUIT

####  III.2.1 Third party interpretation

We now implement an eavesdropper attack on the SARG04 circuit. For that, we
consider only q[1] from the circuit of Fig.11. Eavesdropper decodes the state
in a basis depending on the reference bit, randomly chosen by her. So, the
eavesdropper has a probability of 0.5 of choosing the right basis for
measurement but she is never sure as Alice never shares her encoding basis. In
our case, we have shown an eavesdropper attack with wrong decoding basis
Fig.13 to show the change in the quantum state. It is obvious from Table.15,
as fidelity decreases considerably in the case of eavesdropping.

Figure 13: Eavesdropper tries to measure the state in hadamard basis as her reference bit is 1. Whereas reference bit of Alice and Bob are both 0.  Qubit Index | Fidelity without | Fidelity with
---|---|---
| eavesdropping | eavesdropping
q[1] | 0.9982795399056618 | 0.5998332266675055
Table 15: This is the comparison of fidelity of the qubit state in normal and
an eavesdropping case, calculated based on the experimental results from
ibmq_manila of q[1] of the SARG04 protocol.

####  III.2.2 Noise attack

Now we can show the effect of noise in the quantum channel with the help of
some 2-qubit entangled gates like CX, CZ, and CY gates as done before for the
BB84 protocol in this paper (section.II.2.2). We have already seen the effect
of these noise attacks when a qubit is encoded and decoded in hadamard basis.
The quantum state will change considerably for CY & CZ attack but there will
be no effect in the quantum state in case of CX attack(Fig.10, Table.10). For
the case of computational basis, CX & CY attack will change the state very
significantly as X & Y gates are responsible for bit-flip. CZ attack will not
have any effect on computational basis.

##  IV CONCLUSION

Here, implementation of BB84 protocol (with four bases) and SARG04 protocol
along with eavesdropping case on IBM Quantum Experience’s platform
(ibmq_manila and ibmq_qasm_simulator) was carried out. We then compared the
expected and acquired experimental values. The values were compared and the
overlap was found acceptable. The implementations help us visualize the
theoretical concept by employing gate operations, thus providing an insight
into the fundamentals of quantum computing.

##  V ACKNOWLEDGEMENTS

S.G. and H.M would like to thank IISER Kolkata for providing hospitality
during the course of this project. B.K.B. acknowledges the support of
Institute Fellowship provided by IISER Kolkata. The authors acknowledge the
support of IBM Quantum Experience for producing experimental results. The
views expressed are those of the authors and do not reflect the official
policy of IBM or IBM Quantum Experience team.

## References

  * (1) R. Hughes and J. Nordholt, Refining Quantum Cryptography, Science 333, 1584 (2011).
  * (2) A. Pathak, Elements of Quantum Computation and Quantum Communication, CRC Press (2018).
  * (3) C. H. Bennett and G. Brassard, Quantum cryptography: Public key distribution and coin tossing, IEEE International Conference on Computers, Systems and Signal Processing, 175, 8 (1984).
  * (4) C.H. Bennett, H. Charles, G. Brassard, Quantum cryptography: Public key distribution and coin tossing, Theoretical Computer Science, 560, Part 1: 7–11, (2014).
  * (5) D. Bouwmeester, A. Ekert, A. Zeilinger, Lecture 12: Quantum key distribution, The Physics of Quantum Information.
  * (6) M. Nielson, I. Chuang, Quantum Computing and Quantum Information, Cambridge University Press, (2000).
  * (7) W. K. Wootters and W. H. Zurek, A Single Quantum Cannot be Cloned, Nature 299, 802 (1982).
  * (8) D. AL-Mubayedh, M. AL-Khalis, G. AL-Azman, M. AL-Abdali, M. AlFosail, and N. Nagy, Quantum Cryptography on IBM QX, International Conference on Computer Applications & Information Security, (2019).
  * (9) H. Fan, Y. Wang, L. Jing, J. Yue, H. Shi, Y. Zhang, L. Mu, Quantum cloning machines and the applications, Phys. Rep. 544, 241-322 (2014)
  * (10) B. Fröhlich, M. Lucamarini, J. Dynes, L. Comandar, W. Tam, A. Plews, A. Sharpe, Z. Yuan, and A. Shields, Long-distance quantum key distribution secure against coherent attacks, Optica, 4 (1), 163-167 (2017)
  * (11) A. Ferenczi, V. Narasimhachar, and N. Lütkenhaus, Security proof of the unbalanced phase-encoded Bennett-Brassard 1984 protocol, Phys. Rev. A, 86 (2012)
  * (12) C. H Bennett et al., Experimental Quantum Cryptography, Journal of Cryptology, 5, 3–28 (1992)
  * (13) M. Minder et al., Experimental quantum key distribution beyond the repeaterless secret key capacity, Nature Photonics, 13, 334–338 (2019)
  * (14) Dhoha AL-Mubayedh et al., Quantum Cryptography on IBM QX, IEEE Xplore, 18851058 (2013)
  * (15) Valerio Scarani, Antonio Acín, Grégoire Ribordy, and Nicolas Gisin, Quantum Cryptography Protocols Robust against Photon Number Splitting Attacks for Weak Laser Pulse Implementations, Physical Review Letters,14995344 (2004)
  * (16) R. Jozsa, Fidelity for Mixed Quantum States, Journal of Modern Optics, 23152323 (1994)
  * (17) Behera B.K., Banerjee A., Panigrahi P.K., Experimental realization of quantum cheque using a five-qubit quantum computer. Quantum Inf Process 16, 312 (2017). https://doi.org/10.1007/s11128-017-1762-0
  * (18) A. Warke, B.K.Behera and P.K. Panigrahi, Experimental realization of three quantum key distribution protocols, Quantum Inf Process 19, 407 (2020). https://doi.org/10.1007/s11128-020-02914-z
  * (19) Single Qubit Gates. https://qiskit.org/textbook/ch-states/representing-qubit-states.html
  * (20) Brassard, Gilles, Lütkenhaus, Norbert, Mor, Tal, Sanders, Barry C., Limitations on Practical Quantum Cryptography, Physical Review Letters,(2000)
  * (21) Manpreet Singh Jattana, Fengping Jin, Hans De Raedt & Kristel Michielsen, General error mitigation for quantum circuits. Quantum Inf Process 19, 414 (2020). https://doi.org/10.1007/s11128-020-02913-0