You are on page 1of 69

Quantum Implementation of RSA Crypto-algorithm using IBM-QISKIT

Submitted in the partial fulfillment of the requirements for the degree of

Bachelor of Technology
in
Electronics & Communication Engineering

by
Pallavi Verma
19BEC0555

Under the guidance of


Dr. Palla Penchalaiah
Associate Professor
Dept. of Micro & Nano Electronics

SENSE
VIT, Vellore.

April, 2023

1
DECLARATION

I hereby declare that the thesis entitled “Quantum Implementation of RSA Crypto-algorithm using IBM-
QISKIT" submitted by me, for the award of the degree of Bachelor of Technology in Electronics &
Communication Engineering to VIT is a record of bonafide work carried out by me under the supervision
of Dr. Palla Penchalaiah.
I further declare that the work reported in this thesis has not been submitted and will not be submitted,
either in part or in full, for the award of any other degree or diploma in this institute or any other institute
or university.

Place : Vellore
Date :16 April’2023

Signature of the Candidate

2
CERTIFICATE

This is to certify that the thesis entitled “Quantum Implementation of RSA Crypto-algorithm using IBM-
QISKIT” submitted by Pallavi Verma & 19BEC0555, SENSE, VIT(Vellore), for the award of the degree
of Bachelor of Technology in Electronics & Communication, is a record of bonafide work carried out by
him / her under my supervision during the period, 01. 12. 2022 to 30.04.2023, as per the VIT code of
academic and research ethics.

The contents of this report have not been submitted and will not be submitted either in part or in full, for
the award of any other degree or diploma in this institute or any other institute or university. The thesis
fulfills the requirements and regulations of the University and in my opinion meets the necessary standards
for submission.

Place : Vellore
Date : 16 April’2023

Signature of the Guide

Internal Examiner External Examiner

Head of the Department


Dr. Noor Mohammed V
Electronics & Communication
SENSE

3
ACKNOWLEDGEMENTS

I would like to express my profound gratitude to HoD Dr. Noor Mohammed V, of ECE, SENSE school,
and Dr. Sivanantham S. (Dean) of ECE, SENSE school for their contributions to the completion of my
project titled “Quantum Implementation of RSA Crypto-algorithm using IBM-QISKIT”.

I would like to express my special thanks to our mentor Dr. Palla Penchalaiah for his time and efforts he
provided throughout the project period. His immense knowledge, profound experience and professional
expertise in the Quantum Cryptography has enabled me to complete this project successfully. Without his
support and guidance, this project would not have been possible. I could not have imagined having a better
guide in my study. Your useful advice and suggestions were really helpful to me during the project’s
completion. In this aspect, I am eternally grateful to you.

Finally, last but by no means least; also, to Vellore Institute of Technology, Vellore. It was great sharing
premises with you during last four years.

I would like to acknowledge that this project was completed entirely by me and not by someone else.

Pallavi Verma
19BEC0555

4
Executive Summary

Cryptography is a crucial tool to ensure secure communication between the sender and recipient. Different
methods of cryptographic techniques are used in everyday systems, depending on the application,
including Symmetric ciphers, Asymmetric ciphers, Data integrity algorithms or Hash functions.
Traditional computers understand data in binary digits, which are in two states, 0 and 1. However,
quantum computing is an advanced computing technique that uses quantum mechanical phenomena and
quantum bits to represent data. Quantum cryptography exploits quantum mechanical phenomena for
cryptographic tasks. Current public key cryptographic algorithms like Elliptic curve cryptography (ECC)
and Rivest Shamir Adleman (RSA) can be broken using quantum computers, which is why the RSA
algorithm is being implemented in digital and quantum approaches to compare performance and analyse
vulnerabilities against quantum computing.

The report initially presents the basic study of the technical aspects that are required to understand the
quantum computing. These aspects cover basic quantum gates, coding them in IBM-QISKIT and
understanding their outputs in the form of matrices and histograms; which is then followed by discussing
the methods to achieve better RSA schemes using the IBM-QISKIT Dashboard.

Furthermore, to keep sensitive information transmitted over the internet secure, new Rivest Shamir
Adleman (RSA) encryption schemes are implemented on IBM-QISKIT, such as the one based on the
Chinese Remainder Theorem (CRT), Montgomery Multiplication and Shor’s Algorithm. Shor's
Algorithm is showcased as an example of quantum computation potential. The above stated methods were
experimented and the outputs were recorded and analysed. The entire coding and testing were done by
accessing the IBM Quantum Servers. The pros and cons of the methods are discussed in the later part of
the report.

The rise of quantum cryptography, its elements, quantum key distribution protocols, and quantum
networks are emphasized in this project. Advancements from conventional computing to quantum
computing generate new tasks in cryptography. When quantum mechanics principles are applied to
cryptography, it creates a new system that ensures secure communication and assures that no spying can
occur. Current interest in quantum computing is due to the potential for quantum algorithms to break RSA
encoding, which is used for the majority of secure communications, including the majority of e-commerce
transactions.

5
CONTENTS

Page No.
Acknowledgement 4
Executive Summary 5
Table of Contents 6
List of Figures 8
List of Tables 9
Abbreviations 10

INTRODUCTION 11
Objective 11

Motivation 11

Background 12

PROJECT DESCRIPTION AND GOALS 14

TECHNICAL SPECIFICATION 15

RSA IMPLMENTATION ON IBM-QISKIT 43

SCHEDULE, TASKS AND MILESTONES 53

PROJECT DEMONSTRATION & RESULTS 38

CONCLUSION 63

6
SUMMARY 64

REFERENCES 65

APPENDIX A 67

7
LIST OF FIGURES

Figure No. Caption Page No.


1 Qubit 16
2 Bloch Sphere 17
3 The Quantum Phenomena 18
4 Entanglement 18
5 Tunneling 19
6 Heisenberg Uncertainty Principle 19
7 IBM Qiskit Logo 20
8 Modern Cryptography 25
9 RSA Block Diagram 26
10 IBM Account 33
11 IBM Quantum Dashboard 33
12 Quantum Composer 34
13 Basis & Polarization 39
14 Quantum Mechanics 40
15 Quantum States 41
16 BB84 Protocol 43
17 B92 Protocol 44

8
LIST OF TABLES

Table No. Title Page No.


3.1 Digital Computer VS Quantum Computer 15-16

9
ABBREVIATIONS

RSA Rivest Shamir Adleman


QKD Quantum Key Distribution
2D 2-dimensional
INFO Information
QUBIT Quantum Bit
SQRT Square Root
AES Advanced Encryption System
DES Data Encryption System
SHA1 Secured Hash System-1
SHA2 Secured Hash System-2
SHA3 Secured Hash System-3
MD5 Message Digest-5
GCD Greatest Common Divisor
CRT Chinese Remainder Theorem
SSARG04 Symmetric Signal Adjacent Reference
AC Almost Certain Framework
QC Quantum Computing

10
INTRODUCTION

▪ Quantum computing is a game-changing technology that promises to revolutionize the world of


computing as we know it. Traditional computers work with binary digits, known as bits, which
can be either 0 or 1.
▪ However, quantum computers use quantum bits, or qubits, which can exist in multiple states
simultaneously.
▪ This property of qubits allows quantum computers to perform certain calculations exponentially
faster than classical computers, making them ideal for solving complex problems in fields such as
cryptography, drug discovery, and artificial intelligence.
▪ The RSA algorithm is a widely used and trusted encryption method that relies on the difficulty of
factoring large composite numbers. However, the security of RSA can be compromised by
quantum computers, which can efficiently factor such numbers using Shor's algorithm.
▪ To counter this, there has been growing interest in implementing RSA using quantum computing
techniques, which can provide an additional layer of security against quantum attacks.
▪ In this context, the quantum implementation of RSA using Qiskit(IBM) has emerged as a
promising approach. By leveraging the power of quantum mechanics, Qiskit can provide efficient
solutions for the complex mathematical operations required by RSA. This quantum
implementation of RSA using Qiskit has the potential to enhance the security of data transmission
and storage, and pave the way for the development of next-generation cryptography.

1.1 OBJECTIVE
The objective of this project is to gather, analyse and review the RSA cryptographic algorithm on a
quantum computer and to compare the performance of different methods for quantum implementation.
Specifically, the aim is to investigate and compare the efficiency, accuracy, and security of potential
different methods for quantum implementation of RSA:
(1) Montgomery multiplication,
(2) Chinese remainder theorem,
(3) Shor’s Algorithm.

By analyzing the results, the review paper aims to conclude to the better methods for quantum
implementation of RSA and its potential for future practical applications.
1.2 MOTIVATION

In today's digital world, the security of data transmission over the internet has become a primary concern.
Traditional cryptographic techniques like RSA encryption have been used for secure communication for

11
decades, but the advent of quantum computers threatens the security of these methods. Quantum
computers have the potential to break RSA encryption, which could lead to the loss of sensitive
information, financial data, and other confidential information.

To address this issue, a new generation of cryptography called quantum cryptography has emerged.
Quantum cryptography exploits the principles of quantum mechanics to encrypt and decrypt information,
making it impossible for hackers to break. However, the implementation of quantum cryptography is still
in its early stages, and there is a lot of work to be done to improve its efficiency and security.

The motivation behind carrying out a project on the "Quantum Implementation of RSA Crypto-algorithm
using IBM-QISKIT" is to explore the feasibility of using quantum computing to enhance the security of
traditional cryptographic techniques. The project aims to implement the RSA encryption algorithm on a
quantum computer such as IBM-QISKIT platform, which is a popular open-source software development
kit for quantum computing. By doing so, the project will demonstrate the potential of quantum computing
in the field of cryptography.

The importance of this project can be understood by the increasing cyber threats in our daily life.
Cybersecurity attacks, data breaches, and identity thefts are becoming more common than ever, and
organizations need to implement robust security measures to protect their sensitive information. The
implementation of quantum cryptography can provide a high level of security to the information
transmitted over the internet, making it more difficult for hackers to break the encryption.

In conclusion, the project on the "Quantum Implementation of RSA Crypto-algorithm using IBM-
QISKIT" is a step towards improving the security of data transmission over the internet. It aims to
demonstrate the potential of quantum computing in enhancing the traditional cryptographic techniques
and provide a more secure communication system for the users.

1.2 BACKGROUND

The RSA crypto-algorithm is widely used for secure communication in modern digital systems. However,
with the rise of quantum computing, traditional RSA algorithms are becoming increasingly vulnerable to
attacks that can break its encryption. Quantum computing offers the potential for faster and more efficient
computation of RSA and other cryptographic algorithms. Therefore, the objective of this project is to
explore and analyze and review a quantum-based RSA algorithms performed on platform such as IBM-
QISKIT that can offer improved security and performance compared to classical RSA implementations.

The project aims to answer the following research questions:

1. Can a quantum-based RSA algorithm realized with the help of IBM-QISKIT provide relatively
better and efficient security at all?
2. How does the performance of the different quantum-based RSA algorithm outstand each other?
3. Which of the method to achieve RSA cryptography is more optimizable than others?

12
The project will involve a comprehensive literature review of existing research on quantum-based RSA
algorithms and their implementations using IBM-QISKIT performed by the various authors and
researchers. The project will also involve the design and development of a quantum-based RSA algorithm
using IBM-QISKIT, and the evaluation of its performance and security through simulations and
experiments on actual quantum hardware.

13
PROJECT DESCRIPTION & GOAL

Cryptography is an essential tool for secure communication in today's digital world. Cryptographic
algorithms such as RSA have been the backbone of secure communication for several years. However,
the emergence of quantum computers poses a significant threat to the security of these classical
cryptographic algorithms. Quantum computers can solve complex mathematical problems, including
factoring large numbers that form the basis of RSA cryptography, in significantly less time than classical
computers. Therefore, there is an urgent need to explore and develop quantum-safe cryptographic
algorithms that can withstand quantum computer attacks.

The primary objective of this project is to analyse & review the implemented RSA crypto-algorithm using
quantum computing techniques. The project's main focus is to explore the feasibility of implementing
RSA on a quantum computer and compare its performance against classical RSA. I will also examine the
effectiveness of the algorithm against known quantum algorithms such as Shor's algorithm (which can
efficiently factor large numbers.), Montgomery multiplication, & Chinese remainder theorem.

The project's motivation is based on the growing number of cyber threats in real life, highlighting the need
for stronger encryption techniques to ensure secure communication. In recent years, cyber threats such as
ransomware attacks, data breaches, and identity theft have increased significantly, causing significant
financial losses and reputational damage to organizations and individuals. Strong encryption techniques
are critical to prevent unauthorized access and manipulation of sensitive data in transit and at rest.

Cryptography has several real-life applications, including secure communication, secure data storage, and
online transactions. For example, financial institutions use cryptography to secure online transactions,
ensuring the safety of customer data and preventing fraud. Cryptography is also used in securing
communication between military and government agencies. In addition, cryptography is used in securing
data in cloud storage, ensuring that sensitive data is only accessible by authorized individuals.

In conclusion, the presented project aims to explore the feasibility of implementing RSA on a quantum
computer such as IBM-QISKIT, providing insights into the performance of the algorithm and its potential
as a quantum-safe cryptographic algorithm. The project's outcome is expected to contribute to the
development of quantum-safe cryptography, ensuring the security of sensitive data in real-life scenarios.

The project aims to answer the following research questions:

1. Can a quantum-based RSA algorithm realized with the help of IBM-QISKIT provide relatively
better and efficient security at all?
2. How does the performance of the different quantum-based RSA algorithm outstand each other?
3. Which of the method to achieve RSA cryptography is more optimizable than others?

14
TECHNICAL SPECIFICATIONS

Digital Computer VS Quantum Computer

Parameters Digital Computer Quantum Computer

Basic building blocks: Classical computers use Quantum computers use


classical bits (which can be quantum bits (or qubits)
either 0 or 1) as their basic which can be in a
building blocks. superposition of 0 and 1.
Info. Representation: In classical computers, While in quantum
information is represented computers, information can
using binary digits or bits. be represented using qubits
that can be in superpositions
of multiple states
simultaneously.
Parallelism: Classical computers perform Quantum computers
computations sequentially. have the ability to
perform multiple
calculations
simultaneously, thanks to
the inherent parallelism
provided by
superpositions and
entanglement.
Computational Power: Comparatively weaker than Quantum computers have the
the quantum computers. potential to be much more
powerful than classical
computers, especially for
certain types of problems
such as factoring large
numbers and searching
unsorted databases.
Error Correction: Classical computers have Quantum computers
well-established error require specialized error
correction techniques. correction techniques
that are still being
developed.

Programming: Classical computers use Quantum computers use


general-purpose specialized programming
languages such as Qiskit.

15
programming languages
such as Python or Java.

Hardware: Classical computers can Quantum computers require


be built using standard specialized hardware to
semiconductor function, such as
technology. superconducting qubits or
ion traps.
Table 3.1 (Digital Computer VS
Quantum Computer)

What is a QUBIT?
● In quantum computing, a qubit or quantum bit is a basic unit of quantum information—the
quantum version of the classic binary bit physically realized with a two-state device.
● A qubit is a two-state (or two-level) quantum-mechanical system, one of the simplest quantum
systems displaying the peculiarity of quantum mechanics.
● Examples include the spin of the electron in which the two levels can be taken as spin up and spin
down; or the polarization of a single photon in which the two states can be taken to be the vertical
polarization and the horizontal polarization.
● In a classical system, a bit would have to be in one state or the other. However, quantum mechanics
allows the qubit to be in a coherent superposition of both states simultaneously, a property that is
fundamental to quantum mechanics and quantum computing.
● In addition to superposition, qubits can also exhibit a phenomenon called entanglement. This
means that the state of one qubit is directly related to the state of another qubit, even if they are
separated by large distances.

Fig-1: Qubit[1]

16
BLOCH Sphere

The Bloch sphere is like a map of all the possible states that a single qubit can be in. Imagine a sphere,
like a beach ball, where each point on the surface represents a different state of the qubit. The north pole
of the sphere represents a qubit that is definitely in the state "0", and the south pole represents a qubit that
is definitely in the state "1". All other points on the sphere represent a superposition of the "0" and "1"
states.

The Bloch sphere is important because it helps us to visualize and understand how qubits work. By looking
at the Bloch sphere, we can see how different quantum gates (like the X, Y, and Z gates) affect the state
of a qubit. We can also see how measurements collapse the state of a qubit to either "0" or "1".

Overall, the Bloch sphere is a useful tool for visualizing and understanding quantum states, and is an
important concept to understand in quantum computing.

Fig-2: Bloch Sphere [5]

The Quantum Phenomenon

I. One of the most well-known quantum phenomena is superposition, which means that a quantum
object, such as an atom or photon, can exist in multiple states or locations at the same time. This
is different from classical objects, which exist in a single state or location at any given time. (This
means that an atom can be in two different states at the same time. It's like having your cake and
eating it too!)

17
Fig-3: The Quantum Phenomena[3]

II. Another quantum phenomenon is entanglement, which occurs when two quantum objects become
connected in a way that their properties are correlated, even when they are far apart from each
other. This means that measuring the property of one object will instantaneously affect the property
of the other object, even if they are light years apart. (Atoms can also become "entangled" with
each other. This means that what happens to one atom can affect what happens to another atom,
no matter how far apart they are.)\

Fig-4: Entanglement[4]

18
III. Another phenomenon is quantum tunneling, which is the ability of a quantum object to pass
through a potential barrier, even if it does not have enough energy to overcome the barrier
according to classical physics. (When atoms are in superposition, they can sometimes do things
that seem impossible. For example, they can pass through solid objects, like walls, without
breaking them. This is called "tunnelling")

Fig-5: Tunneling[2]

IV. Quantum mechanics also involves uncertainty, which is described by the Heisenberg uncertainty
principle. This principle states that the more precisely the position of a particle is known, the less
precisely its momentum can be known, and vice versa. (It is impossible to simultaneously know
the exact position and the momentum of the particle.)

Fig-6: Heisenberg Uncertainty principle

19
IBM-QISKIT

• IBM Qiskit is a powerful open-source software development kit for building quantum computing
applications. It is one of the most popular and widely used platforms for creating, simulating,
and executing quantum programs.

• With Qiskit, users can write quantum algorithms and execute them on real quantum devices
provided by IBM or on simulators that emulate the behavior of quantum systems.

• Qiskit also includes a variety of powerful tools for visualizing quantum circuits and analyzing
the results of quantum computations.

• Whether you are a seasoned quantum computing expert or just starting out, Qiskit provides a
robust set of tools and resources to help you explore the exciting world of quantum computing.

• Qiskit consists of four main components: Terra, Aer, Ignis, and Aqua.
o Qiskit: Terra is the foundation of Qiskit and provides a way to program quantum circuits
using Python. It also provides a suite of tools for compiling, optimizing, and simulating
quantum circuits.
o Qiskit Simulator: Aer is the simulation component of Qiskit, providing a high-
performance simulator for running quantum circuits on classical computers.
o Qiskit Experiments: Ignis is the noise and error mitigation component of Qiskit,
providing tools for characterizing and mitigating errors in quantum hardware.
o Qiskit Application Module: Aqua is the domain-specific component of Qiskit, providing
algorithms and applications for problems in areas such as chemistry, finance, and
optimization.

Fig-7: IBM QISKIT Logo[7]

Basic Mathematics for defining the QUBITs:


Quantum states are typically represented by "kets", from a notation known as bra-ket. The vector
representation of a single qubit is:

20
Here, v_{0} and v_{1} are the complex probability amplitudes of the qubit. These values determine the
probability of measuring a 0 or a 1, when measuring the state of the qubit. See measurement below for
details. The value zero is represented by the ket:

and the value one is represented by the ket:

.
The tensor product (or Kronecker product) is used to combine quantum states. The combined state for a
qubit register is the tensor product of the constituent qubits. The tensor product is denoted by the symbol
⊗. The vector representation of two qubits is:

Basic Building Blocks of QUANTUM HARDWARE


In quantum computing and specifically the quantum circuit model of computation, a quantum logic gate
(or simply quantum gate) is a basic quantum circuit operating on a small number of qubits. They are the
building blocks of quantum circuits, like classical logic gates are for conventional digital circuits.
● Hadamard Gate (H): This gate is used to create superposition in a qubit. It takes a qubit in the
|0⟩ state and places it in a superposition of |0⟩ and |1⟩. This is useful for many quantum algorithms
and protocols. This gate acts on single qubit. Hadamard is a half rotation of the Bloch sphere and
it rotates around an axis located halfway between x and z. This gives it the effect of rotating states
that point along the z axis to those pointing along x, a.

When applied to a qubit in the |0> state, the Hadamard gate transforms the qubit into the |+> state, which
is a superposition of the |0> and |1> states, given by |+> = 1/sqrt(2) * (|0> + |1>). Similarly, when applied
to a qubit in the |1> state, the Hadamard gate transforms the qubit into the |-> state, which is a superposition
of the |0> and |1> states, given by |-> = 1/sqrt(2) * (|0> - |1>).

21
When a qubit is in the |0> state, applying the Hadamard gate puts the qubit into a superposition of |0> and
|1>, with equal probability of measuring either state. Similarly, if the qubit is in the |1> state, applying the
Hadamard gate puts the qubit into a superposition of |0> and |1>, but with a phase shift of -1 applied to
the |1> state.
● Identity gate: The identity gate is the identity matrix, usually written as I, and is defined for a
single qubit as:
where I is basis independent and does not modify the quantum state. The identity gate is most useful when
describing mathematically the result of various gate operations or when discussing multi-qubit circuits.

● Pauli-X Gate (X): This gate is also called the NOT gate because it flips the state of a qubit from
|0⟩ to |1⟩ and vice versa. It is useful for creating entanglement and for error correction. The Pauli
X gate is a quantum logic gate that is also known as the "bit-flip" gate. It is represented by the X
matrix and operates on a single qubit, flipping the state of the qubit from 0 to 1 or vice versa. In
other words, it is equivalent to the classical NOT gate.

● Pauli-Y Gate (Y): This gate is similar to the Pauli-X gate but it introduces a phase shift of π/2 in
the state of the qubit. It is useful for creating and manipulating superpositions. The Pauli Y gate is
a quantum logic gate that rotates the state of a single qubit around the y-axis of the Bloch sphere.
It flips the sign of the imaginary part of the quantum state, which causes the qubit to move from
the |0⟩ state to the |1⟩ state, and vice versa. It can be represented by a 2x2 matrix, and it is one of
the fundamental gates in quantum computing. The Pauli Y gate is a key component in many
quantum algorithms and quantum error correction codes.

● Pauli-Z Gate (Z): This gate introduces a phase shift of π in the state of a qubit. It is useful for
creating and manipulating phase relationships between qubits. The Pauli Z gate is a single-qubit

22
gate in quantum computing that acts on the quantum state of a qubit by flipping the phase of the
qubit. It is a diagonal gate that changes the sign of the qubit's |1⟩ state, while leaving the |0⟩ state
unchanged. In other words, if the qubit is initially in the state |0⟩, applying the Pauli Z gate does
not change its state. But if it is in the state |1⟩, the Pauli Z gate flips its phase and the resulting state
becomes -|1⟩. Mathematically, the Pauli Z gate is represented by the following matrix:

● Phase Gate (S): The S gate is a quantum gate that performs a simple operation on a single qubit,
which can be represented by a vector on the Bloch sphere. It maps the state |0⟩ to itself and rotates
the state |1⟩ by 90 degrees around the z-axis of the Bloch sphere, effectively swapping the
amplitudes of the |0⟩ and |1⟩ states. In other words, the S gate introduces a phase shift of π/2 (or
90 degrees) to the |1⟩ state, while leaving the |0⟩ state unchanged. This phase shift can be used in
quantum algorithms to perform interference, a technique used to amplify or cancel out amplitudes
and improve the probability of obtaining the desired output.

● π/8 Gate (T): The T gate is a quantum logic gate that rotates the state of a qubit around the Z-axis
of the Bloch sphere by 45 degrees. The gate is also known as the pi/8 gate, because it rotates the
state by an angle of pi/8 radians. The T gate is important because it enables the construction of
other quantum gates, such as the Hadamard gate and the CNOT gate, which are used in many
quantum algorithms. The T gate is also used in quantum error correction, as it can help to detect
and correct errors in a quantum circuit.

● Controlled NOT Gate (CNOT/CX): The CNOT (controlled-NOT) gate is a quantum logic gate
that operates on two qubits. The first qubit is called the control qubit and the second qubit is called
the target qubit. If the control qubit is in the state |1>, then the CNOT gate flips the state of the
target qubit. If the control qubit is in the state |0>, then the target qubit is left unchanged. In other
words, the CNOT gate applies the NOT operation to the target qubit if and only if the control qubit
is in the state |1>. The CNOT gate is an important building block in quantum circuits, and is useful
for creating and manipulating entanglement between qubits.

23
● Controlled Pauli-Z Gate (CZ): he Controlled-Z (CZ) gate is a quantum logic gate that operates
on two qubits, and is a commonly used gate in quantum computing. The CZ gate applies a phase
flip to the second qubit, but only if the first qubit is in the state |1>. In simpler terms, if the first
qubit is in the state |1>, the CZ gate will flip the phase of the second qubit. If the first qubit is in
the state |0>, then the second qubit is unaffected. The CZ gate is useful for creating entangled
states and for performing quantum error correction.

● Controlled Rotation Gate (CR): The Controlled-R (CR) gate is a quantum logic gate that applies
a phase shift to the target qubit's state, based on the state of the control qubit. It is a two-qubit gate,
with the target qubit being the one on which the gate acts, and the control qubit specifying how
the gate should act on the target qubit. The CR gate applies a rotation of the target qubit's state
vector around the Z-axis by an angle that depends on the state of the control qubit. When the
control qubit is in the state |1⟩, the target qubit's state is multiplied by a factor of -1, resulting in a
phase shift of π. When the control qubit is in the state |0⟩, the target qubit's state is not modified.
The CR gate is an important building block in quantum circuits for implementing various quantum
algorithms and protocols.

TARGET [1 0 0 0]

───■R─── [0 1 0 0]
[0 0 1 0]
───┼───
[0 0 0 e^(i * angle)]
CONTROL

TYPES OF CRYPTOGRAPHY:
● Symmetric Cryptography:
○ Symmetric cryptography uses single key for both encryption and decryption.
○ The sender uses a key to encrypt the plaintext, thereby sending ciphertext to the receiver.
The receiver applies the same key to decrypt the message and recover the plain text.
○ In order to achieve this type of encryption both sender and receiver must share a common
key via a secure medium or in person.

24
○ Advanced Encryption Standard (AES) and Data Encryption Standard (DES) are good
examples of Symmetric key cryptography
● Asymmetric Cryptography:
○ Asymmetric cryptographic primitives no longer share a security key similar to the
symmetric schemes. It shares a public key between sender and receiver for encryption,
while a private key is used for decrypting messages.
○ Even though a public key is shared between both sides of the communication channel,
unauthorized user cannot decrypt the sent/received message without using a powerful
computing unit to generate a private key.
○ Recent research shows that scientists are working on using quantum computing as a
powerful tool to break RSA algorithm using 20 million qubits.
● Hash Functions:
○ Hash functions are also known as one-way encryption, since it cannot be reversed.
○ It is different from Symmetric and Asymmetric key cryptography as it doesn’t use any
keys. In simple terms, hashing means taking an input string of any arbitrary length and
producing an output of fixed length.
○ A secure hash function should not produce same hash value from two different inputs. If it
does, this is known as a collision.
○ In general, the hash functions are designed to be collision resistant, meaning that there is a
very low probability that the same string would be created for different data. SHA1, SHA2
and SHA3 (Secure Hash Algorithms) and MD5 are good examples of Hash functions.

Fig-8: Modern Cryptography[9]

25
The Rivest-Shamir-Adleman(RSA) Algorithm (General IDEA)
● RSA (Rivest-Shamir-Adleman) is a public-key cryptosystem used for secure data transmission
over the internet. It is one of the most widely used encryption algorithms, and is used to encrypt
sensitive information such as credit card numbers and passwords.
● The RSA algorithm uses two prime numbers to generate a public and private key pair. The security
of the algorithm relies on the difficulty of factoring large numbers into their prime factors.
● Public Key encryption algorithm is also called the Asymmetric algorithm. Asymmetric algorithms
are those algorithms in which sender and receiver use different keys for encryption and decryption.
Each sender is assigned a pair of keys: Public Key & Private Key.
● The Public key is used for encryption, and the Private Key is used for decryption. Decryption
cannot be done using a public key. The two keys are linked, but the private key cannot be derived
from the public key. The public key is well known, but the private key is secret and it is known
only to the user who owns the key. It means that everybody can send a message to the user using
user's public key. But only the user can decrypt the message using his private key.

Fig-9: RSA Block Diagram [6]

● Explanation of the BLOCK DIAGRAM


○ The data to be sent is encrypted by sender A using the public key of the intended receiver
B.
○ B decrypts the received ciphertext using its private key, which is known only to B.
○ B replies to A encrypting its message using A's public key.
○ A decrypts the received ciphertext using its private key, which is known only to A.

26
● The RSA algorithm works as follows: (In Brief)
○ Choose two prime numbers p and q. These are kept secret and are used to generate the
public and private key pairs.
○ Compute n = p * q. This is the modulus and is part of the public key.
○ Compute Euler's totient function phi(n) = (p-1)*(q-1).
○ Choose an integer e such that 1 < e < phi(n) and gcd(e, phi(n)) = 1. This is the public key.
○ Compute d such that d*e = 1 mod phi(n). This is the private key.
○ To encrypt a message, the sender converts the message into a number m less than n, and
raises it to the power of e mod n.
○ To decrypt the message, the receiver raises the encrypted message to the power of d mod
n.

• The RSA algorithm is based on the difficulty of factoring the product of two large prime numbers.
Here are the steps involved in the RSA algorithm:
1. Key generation: The first step is to generate a pair of public and private keys for encryption and
decryption purposes. This step involves the following:
a. Select two large prime numbers p and q. These primes should be kept secret.
b. Calculate the product of these primes, n = p*q.
c. Calculate the totient of n, φ(n) = (p-1) * (q-1).
d. Choose an integer e such that 1 < e < φ(n) and e is coprime to φ(n), i.e., gcd(e,φ(n)) = 1.
The integer e is known as the public exponent and is part of the public key.
e. Calculate the integer d such that (d * e) mod φ(n) = 1. The integer d is known as the private
exponent and is kept secret.
f. The public key consists of the pair (n,e) and the private key consists of the integer d.
2. Encryption: To encrypt a message m, the sender uses the recipient's public key (n,e) to produce
the ciphertext c. The encryption process is given by:
c = m^e mod n
Here, "^" denotes exponentiation and "mod" is the modular operation. The ciphertext c is then sent
to the recipient.
3. Decryption: The recipient uses their private key d to decrypt the ciphertext c and obtain the
original message m. The decryption process is given by:
m = c^d mod n
Again, "^" denotes exponentiation and "mod" is the modular operation.

27
The Rivest-Shamir-Adleman(RSA) Algorithm (General IDEA-explanation using an example)
Encrypt plaintext 9 using the RSA public-key encryption algorithm. The example uses prime
numbers 7 and 11 to generate the public and private keys.
Solution: Step 1: Select two large prime numbers, p, and q.
p=7
q = 11
Step 2: Multiply these numbers to find n = p x q, where n is called the modulus for encryption and
decryption.First, we calculate:
n = p*q
n = 7 x 11
n = 77
Step 3: Choose a number e less that n, such that n is relatively prime to (p - 1) x (q -1). It means that e and
(p - 1)*(q - 1) have no common factor except 1. Choose "e"(public exponent) such that 1<e < φ (n), e is
prime to φ (n)(Euler's totient function), gcd (e, d (n)) =1. Second, we calculate:
φ (n) = (p - 1)*(q-1)
φ (n) = (7 - 1)*(11 - 1)
φ (n) = 6*10
φ (n) = 60
Let us now choose relative prime e of 60 as 7.
Thus the public key is <e, n> = (7, 77)
Step 4: A plaintext message m is encrypted using public key <e, n>. To find ciphertext from the plain
text following formula is used to get ciphertext C. To find ciphertext from the plain text(original
message) following formula is used to get ciphertext C.
C = m^e mod n
C = 9^7 mod 77
C = 37
Step 5: The private key is <d, n>. To determine the private key, we use the following formula d such
that:
d*e mod {(p - 1) x (q - 1)} = 1
d*7 mod (60) = 1; which gives d = 43
The private key is <d, n> = (43, 77)
Step 6: A ciphertext message c is decrypted using private key <d, n>. To calculate plain text m from the
ciphertext c following formula is used to get plain text m.

28
m = c^d mod n
m = 37^43 mod 77
m=9
In this example, Plain text = 9 and the ciphertext = 37.
The Rivest-Shamir-Adleman(RSA) Algorithm (This is where limitation surfaces)
How to calculate “a mod b”? Let's find 4 mod 2.
Explanation:
1. To find 4 mod 2 using the modulus method, we first find the highest possible multiple of the
divisor, 2 that is equal to or less than the dividend, 4.
2. Then, we subtract the highest multiple from the dividend to get the answer to 4 mod 2.
3. Multiples of 2 are 0, 2, 4, 6, etc., and the highest multiple of 2 equal to or less than 4 is 4.
4. Therefore, 4 - 4 = 0. Thus, 4 mod 2 is 0.

➢ The mathematics behind the RSA algorithm involves MODULAR ARITHMETIC, number
theory, and PRIME FACTORIZATON (The bigger the factors are, the more secure it is!);
which, at a point, can be very lengthy and time-taking for the classical computers to do that will
surely put us in a situation of compromising with the security of the data and that’s why there is
a need to introduce Quantum Computing for this purpose; which unlike classical computers can
finish the execution in a comparatively lesser time.
The Rivest-Shamir-Adleman (RSA) Algorithm (The LIMITATION)
1. The RSA algorithm is based on the difficulty of factoring large numbers into their prime factors.
The security of the algorithm relies on the fact that it is computationally infeasible to find the
prime factors of a large number, and thus to determine the private key from the public key.
2. The algorithm is based on the fact that finding the prime factors of a large number is a
computationally difficult problem, while raising a number to a large power and taking the
remainder when divided by a large number is a computationally easy problem. The security of the
RSA algorithm relies on this asymmetry between the difficulty of factoring large numbers and the
ease of modular exponentiation.
3. Random number generation: The security of RSA encryption also relies on the quality of the
random number generator used to generate the keys. If the random number generator is predictable
or not truly random, an attacker may be able to determine the secret key.
4. Quantum computing: The RSA algorithm relies on the difficulty of factoring large composite
numbers into their prime factors. However, quantum computers have the potential to break RSA
encryption by using Shor's algorithm, which can factor large numbers much more efficiently than
classical computers. The development of quantum computers poses a significant threat to the
security of RSA encryption.

29
5. Quantum computing has the potential to break the RSA algorithm by using Shor's algorithm,
which can efficiently factor large numbers that are the product of two primes. This is a challenging
problem for classical computers, and the RSA algorithm is based on the assumption that it is
difficult to factor such numbers.
6. On the other hand, quantum computers have the ability to perform a large number of calculations
simultaneously using quantum superposition and entanglement. Shor's algorithm exploits these
features to efficiently factor large numbers in polynomial time, which is much faster than any
known classical algorithm.

Different ways to implement RSA algorithm


● Modular exponentiation: The most straightforward way to implement RSA is by using modular
exponentiation. The key generation algorithm generates two large prime numbers, p and q, and
calculates their product, N = p * q. It then chooses a number e such that 1 < e < (p-1)(q-1) and
gcd(e, (p-1)(q-1)) = 1. The public key is (N, e), and the private key is d, where d is the modular
inverse of e modulo (p-1)*(q-1). To encrypt a message, m, the sender calculates c = m^e mod N,
and to decrypt it, the receiver calculates m = c^d mod N.
● Chinese remainder theorem: Another way to implement RSA is by using the Chinese remainder
theorem. This method is faster than modular exponentiation, especially when the numbers
involved are very large. The key generation algorithm is the same as in the previous method. To
encrypt a message, m, the sender first calculates m1 = m mod p and m2 = m mod q. The sender
then calculates c1 = m1^e mod p and c2 = m2^e mod q. The sender then uses the Chinese
remainder theorem to calculate c such that c ≡ c1 (mod p) and c ≡ c2 (mod q). To decrypt the
message, the receiver calculates d1 = d mod (p-1) and d2 = d mod (q-1). The receiver then
calculates m1 = c^d1 mod p and m2 = c^d2 mod q. The receiver then uses the Chinese remainder
theorem to calculate m such that m ≡ m1 (mod p) and m ≡ m2 (mod q).
● Montgomery multiplication: Montgomery multiplication is a technique used to speed up
modular multiplication. It is based on the observation that if we use the Montgomery reduction
algorithm to reduce the result of a multiplication, then the result is already in Montgomery form,
and we can skip the final step of the algorithm. This saves time and reduces the number of modular
reductions that need to be performed. This method is used in hardware implementations of RSA,
as it is faster than other methods.
● Barrett reduction: Barrett reduction is another technique used to speed up modular reduction. It
is based on the observation that if we precompute a value, μ, then we can use it to perform modular
reduction faster than with the standard algorithm. This method is also used in hardware
implementations of RSA.
The Chinese Remainder Theorem:
● Choose two distinct prime numbers, p and q, and calculate their product, n = p * q.
● Calculate Euler's totient function of n, which is given by φ(n) = (p-1)(q-1).

30
● Choose an integer e such that 1 < e < φ(n) and gcd(e, φ(n)) = 1. This value will be the public key.
● Calculate the modular inverse of e modulo φ(n), denoted d. This value will be the private key.
● Encode the message to be encrypted as an integer m such that 0 ≤ m < n.
● Compute c ≡ m^e mod n. This is the ciphertext that will be sent to the recipient.
● The recipient decrypts the ciphertext using the Chinese remainder theorem. The decryption
involves the following steps:
○ Compute mp = c^d mod p.
○ Compute mq = c^d mod q.
○ Use the Chinese remainder theorem to find the unique integer m such that m ≡ mp mod p
and m ≡ mq mod q. This is the original message that was encoded.
● To encrypt a message using someone's public key, repeat steps 5 and 6.
● The use of the Chinese remainder theorem makes the decryption process more efficient by
allowing for faster calculations of the original message from the two decrypted pieces.
Mathematics behind Chinese Remainder Theorem:
To understand CRT, let's consider a system of two linear congruences:
x ≡ a mod p x ≡ b mod q
where p and q are distinct prime numbers. The CRT tells us that there is a unique solution for x modulo
pq, which can be obtained using the following steps:
1. Compute the product N = pq.
2. Find the modular inverses y and z of p and q, respectively, such that y ≡ 1 mod p and z ≡ 1 mod
q. This can be done using the extended Euclidean algorithm.
3. Compute the values u and v, where u ≡ ay mod p and v ≡ bx mod q.
4. The solution for x is given by x ≡ (uqz + vp y) mod N.
In general, the CRT can be extended to solve systems of linear congruences with any number of equations,
provided that the moduli are pairwise coprime (i.e., they have no common factors other than 1).

The Montgomery Multiplication:


● Generate two large prime numbers, p and q, and calculate their product N = pq. This is the
modulus for RSA encryption.
● Choose an integer e such that 1 < e < (p-1)(q-1) and e is coprime with (p-1)(q-1). This is the
public key.
● Calculate the modular inverse d of e modulo (p-1)(q-1). This is the private key.

31
● Choose a random message m that is less than N.
● Convert the message m to its Montgomery representation, which involves multiplying it by a
certain factor and then reducing it modulo N.
● Encrypt the Montgomery representation of the message m using the public key e, which involves
raising it to the power e and reducing the result modulo N.
● Decrypt the encrypted Montgomery representation of the message using the private key d, which
involves raising it to the power d and reducing the result modulo N.
● Convert the decrypted Montgomery representation of the message back to its original
representation.
● Verify that the decrypted message is the same as the original message.

Shor’s Algorithm:
Shor’s algorithm is famous for factoring integers in polynomial time. Since the best-known classical
algorithm requires super-polynomial time to factor the product of two primes, the widely used
cryptosystem, RSA, relies on factoring being impossible for large enough integers.
The Problem: Period Finding

Let’s look at the periodic function: 𝑓(𝑥)=𝑎^𝑥mod𝑁

Reminder: Modulo & Modular Arithmetic where 𝑎 and 𝑁 are positive integers, 𝑎 is less than 𝑁 ,
and they have no common factors. The period, or order ( 𝑟 ), is the smallest (non-zero) integer such that:
𝑎^𝑟mod𝑁=1
I. Cryptography: Classical VS Quantum
Classical Cryptography, also known as traditional or symmetric cryptography, has been used for centuries
to encode secret messages. Its history can be traced back to ancient civilizations like the Egyptians and
Greeks, who used simple substitution and transposition methods to conceal their messages. Over the years,
cryptographic techniques evolved, and more complex ciphers like the Enigma machine were used during
World War II.

Presently, Classical Cryptography is still widely used in modern-day communication systems, such as
secure messaging, online transactions, and data encryption. The Advanced Encryption Standard (AES),
Data Encryption Standard (DES), and Triple Data Encryption Algorithm (Triple-DES) are some of the
most widely used Classical Cryptography algorithms.

Despite the continued use of Classical Cryptography, there are concerns about its long-term security. With
the advent of quantum computing, Classical Cryptography may become vulnerable to attacks, and thus,
the development of new quantum-resistant cryptography algorithms is necessary.

32
Real-life use cases of Classical Cryptography include secure communication in military, government, and
financial sectors, as well as in e-commerce, healthcare, and other industries that require secure data
transmission and storage. The integration of Classical Cryptography with other technologies like
blockchain, machine learning, and artificial intelligence is expected to provide more robust and secure
cryptographic solutions.

Quantum Cryptography is a fascinating field of study that focuses on developing cryptographic techniques
based on the principles of quantum mechanics. It has come a long way since its inception in the early
1970s when Stephen Wiesner first introduced the concept of quantum key distribution. Over the years,
scientists and researchers have made significant strides in the field, resulting in the development of more
advanced quantum cryptographic techniques that can be used to secure communication channels against
a wide range of attacks.

Today, Quantum Cryptography is a rapidly evolving field that promises to transform the world of
cybersecurity. With the emergence of quantum computing, there is an urgent need for the development of
quantum-resistant cryptographic techniques that can withstand attacks from quantum computers. This has
led to a renewed interest in the field, with researchers working tirelessly to develop new techniques that
can keep up with the advances in quantum computing.

In the present, Quantum Cryptography finds use in a wide range of applications, including secure
communication in military and government sectors, banking and finance, and healthcare. It offers a level
of security that is impossible to achieve using classical cryptographic techniques, making it an invaluable
tool for securing sensitive information.

As we move into the future, Quantum Cryptography will continue to play a vital role in the world of
cybersecurity. With the increasing reliance on digital technology, the need for secure communication
channels is only going to become more critical. Quantum Cryptography promises to provide a solution to
this problem by offering an unbreakable level of security that can withstand attacks from even the most
advanced quantum computers. Quantum Cryptography is a fascinating and rapidly evolving field that
promises to revolutionize the world of cybersecurity. It has come a long way since its inception, and with
the increasing need for secure communication channels, it is only going to become more critical in the
years to come.

II. Quantum Cryptography

A. PHOTON Polarization- The BASIC Unit:

The concept of photon polarization is an important aspect of quantum computing, where photons are used
to represent qubits - the basic unit of quantum information. By polarizing photons in specific bases, a bit
of information can be represented as a qubit.

To represent a binary 0, a photon is polarized at 0° in the rectilinear basis or 45° in the diagonal basis. On
the other hand, to represent a binary 1, a photon is polarized at 90° in the rectilinear basis or 135° in the
diagonal basis.

33
This system of photon polarization is crucial for the development of quantum computing, as it allows for
the manipulation and transmission of information at the quantum level. As research in the field continues
to progress, the potential applications of quantum computing are vast and varied, from cryptography to
drug discovery and beyond.

Fig-13: Basis & Polarization [8]

B. QUBITs & Quantum States:

Qubit is the fundamental building block of quantum cryptography. It has two states, |0 and |1, which are
denoted by vertical bars and angle brackets. This notation is also known as a state, ket, or Dirac notation
after its creator Paul Dirac, who came up with it in 1939.

While a qubit can only exist in the states of |0> or |1>, a bit can only be in the states of 0 or 1. Additionally,
it can happen in a state known as superposition, which is a linear mixture of the states |0> and |1>. The
states can be represented as |𝜓|. One can categorize a state as |𝜓> = 𝛼|0 >+ 𝛽|1> indicates the superposition
state, where ‘𝛼’ and ‘𝛽’ are complex numbers.

Unable to be measured, a qubit might exist in the superposition state |0> and |1>. A qubit will undoubtedly
be in the state of |0 or |1 when it is measured. According to the laws of quantum mechanics, the modulus
squared of ‘𝛼’ and ‘𝛽’ is, respectively, the chance of obtaining the state |0> or |1> qubit. In other words,
the likelihood of getting |𝜓> in the |0> state is | 𝛼 |2 and the probability of getting |𝜓> in the |1> state is
| 𝛽 |2. By squaring the coefficients, one can determine the likelihood that a measurement would produce
the desired outcome. The formula is | 𝛼 |2 + | 𝛽 |2 = 1.

34
The probability of detecting state S in quantum computation is |as|2 where ‘a’ is the amplitude and ‘ai’ is
a complex number, 0 ≤ |ai|2 ≤ 1. Transitions in this take place dependent on amplitudes. The unitary
matrix is used in quantum computation.

C. Quantum Mechanics

A significant chapter in the history of modern physics is the history of quantum mechanics. Max Born,
Wolfgang Pauli, and Werner Heisenberg were among the physicists who first used the phrase "Quantum
Mechanics" at the University of Göttingen in the early 1920s. Fundamentally, waves and particles are
properties shared by matter and radiation. The momentum for the development of quantum mechanics
came from scientists gradually realizing that matter has wave-like qualities and radiation has particle-like
features.

Let’s take a state for our reference, 𝛼|0 >+ 𝛽|1>, where ‘𝛼’ and ‘𝛽’ are complex numbers [7]. The two
complex numbers can also be stacked to create the state as following: [𝛼 𝛽] . This matrix is a 2-D
complex in nature. |0> = [1 0] where 𝛼 =1, 𝛽 =0 and |1> = [0 1] where 𝛼 =0, 𝛽 =1 [7].

|1> = [0 1]

𝜋
−𝜃
2

𝜃
|0> = [1 0]
Fig-14: Quantum Mechanics

D. States of Polarized PHOTONs

| - > = [1 0] …(Rectilinear basis) [7]

| | > = [0 1] …(Rectilinear basis) [7]

| / > = [1/√2 1/√2 ] …(Diagonal basis) [7]

| \ > = [1/√2 -1/√2 ] …(Diagonal basis) [7]

E. Quantum States Representation

35
Fig-15: Quantum States[16]

III. Quantum Key Distribution & its Protocol

Quantum Key Distribution (QKD) is a cryptographic technique that utilizes the principles of quantum
mechanics to distribute encryption keys between two parties, usually referred to as Alice and Bob. The
basic idea behind QKD is that the act of measuring a quantum state will change it, and this change can be
detected by the communicating parties. This means that any attempt to intercept or eavesdrop on the
communication will be detected, as it will alter the quantum state and cause errors in the key exchange.

The QKD protocol involves several steps. Firstly, Alice generates a random sequence of qubits, each
representing either the state |0> or |1>, and sends them to Bob over a quantum channel. Bob then measures
each qubit using a randomly chosen basis, either rectilinear or diagonal, and records the result as either 0
or 1.

Next, Alice and Bob exchange information over a classical communication channel to compare a subset
of their measurement results. If the comparison reveals no errors or discrepancies, it means that the
quantum channel is secure and the rest of the qubit sequence can be used to generate a shared secret key.

To generate the key, Alice and Bob apply a process known as error correction, which involves checking
the shared sequence of bits for errors and correcting them. Finally, they apply a process called privacy
amplification, which uses hashing to distill the shared key into a smaller, more secure key that can be used
for encryption.

The main advantage of QKD is that it provides information-theoretic security, which means that the
security of the encryption is based on fundamental physical laws rather than mathematical algorithms.
This makes it highly resistant to attacks by both classical and quantum computers [7].

A. BB84 Protocol

36
The BB84 protocol is a quantum key distribution (QKD) protocol that was introduced by Charles H.
Bennett and Gilles Brassard in 1984. This protocol is designed to securely distribute cryptographic keys
between two parties, commonly referred to as Alice and Bob, over a public channel.

The BB84 protocol uses the principles of quantum mechanics to ensure that any attempt to eavesdrop on
the communication will be detected. The protocol uses qubits, which are quantum bits, to represent the
bits of the key. In the BB84 protocol, Alice sends a random sequence of qubits to Bob, which can be in
one of four possible states: |0>, |1>, |+>, and |->.

Each qubit sent by Alice is randomly encoded in one of these four states. Bob then measures each qubit
in a randomly chosen basis. The two possible bases used in the BB84 protocol are the rectilinear basis,
represented by {|0>, |1>}, and the diagonal basis, represented by {|+>, |->}.

If Bob measures the qubit in the same basis as Alice encoded it, then he obtains the correct value of the
qubit. However, if he measures the qubit in a different basis, then he has a 50% chance of obtaining the
correct value, which means that half of the qubits will be discarded. Alice and Bob then publicly compare
a subset of the remaining qubits to check for any errors or discrepancies. If no errors are found, they can
use the remaining qubits as the shared secret key.

One of the key features of the BB84 protocol is that any attempt to eavesdrop on the communication
will introduce errors that can be detected by Alice and Bob. This is due to the no-cloning theorem of
quantum mechanics, which states that it is impossible to create an exact copy of an unknown quantum
state. Therefore, if an eavesdropper, commonly referred to as Eve, tries to intercept the qubits, she will
inevitably introduce errors that can be detected by Alice and Bob during the error-checking phase[7].

37
Image Source: liveBOOK Website Fig-16: BB84 Protocol

B. B92 Protocol
The B92 protocol is a quantum key distribution (QKD) protocol proposed by Charles Bennett in 1992.
This protocol differs from the BB84 protocol, as it is a single-state protocol, which means that only one
type of quantum state is used for encoding information.
In the B92 protocol, Alice prepares a sequence of qubits, where each qubit can be in one of two states,
|0⟩ or |+⟩. Alice randomly selects a state from |0⟩ and |+⟩ to encode a bit value of either 0 or 1.

Once the qubits are prepared, Alice sends them over a quantum channel to Bob. Bob randomly selects
some of the qubits to measure and discards the rest. When he measures a qubit, he announces which
basis he used for the measurement, but not the result of the measurement.
If Bob measures a qubit in the correct basis, he will get the correct bit value with certainty. However, if
Bob measures a qubit in the incorrect basis, he will get a random bit value with probability of 1/2.

After all the measurements are complete, Alice and Bob publicly announce which qubits were measured
in the correct basis. If the qubits were measured in the correct basis, Bob can use the bit value to form a
shared secret key with Alice. Otherwise, the corresponding bit is discarded.
The security of the B92 protocol is based on the fact that an eavesdropper, Eve, cannot determine which
basis Bob used for each measurement without disturbing the state of the qubit. Thus, any attempt by Eve
to gain information about the bit values will introduce errors, which can be detected by Alice and
Bob[7].

Fig-17: B92 Protocol[20]

38
C. 6-State Protocol
The six-state protocol is a quantum key distribution (QKD) protocol that is an extension of the BB84
protocol. Like the BB84 protocol, the six-state protocol is a method for secure key exchange between
two parties, referred to as Alice and Bob.
In the six-state protocol, Alice randomly encodes her qubits into one of six possible states, which are
labeled as {|0>, |1>, |2>, |3>, |4>, |5>}. These states are not mutually orthogonal, which means they are
not perpendicular to each other. Instead, they are arranged in a hexagon, with each state separated from
its nearest neighbor by 60 degrees.
After encoding her qubits, Alice sends them to Bob over a quantum channel. Bob then measures the
qubits using one of two possible measurement bases, which are referred to as the rectilinear basis and
the diagonal basis. In the rectilinear basis, Bob measures the polarization of the qubits along either the
horizontal or vertical axis. In the diagonal basis, Bob measures the polarization along the diagonal axes,
at angles of 45 degrees to the horizontal and vertical axes.
After Bob has measured the qubits, Alice and Bob publicly compare a subset of their results to
determine whether any errors have occurred due to noise or eavesdropping. If the error rate is low
enough, they can use the remaining qubits as a key for secure communication.
Compared to the BB84 protocol, the six-state protocol can achieve a higher key rate because it uses six
possible states instead of four. However, the six-state protocol is also more susceptible to eavesdropping
attacks than the BB84 protocol. To mitigate this vulnerability, the six-state protocol can be combined
with other techniques such as decoy states and entanglement-based QKD[7].

D. SARG04 Protocol
The Symmetric Signal-Adjacent Reference (SSARG04) protocol is a quantum key distribution (QKD)
protocol developed by Norbert Lütkenhaus and Matthias Hillery in 2004. The SSARG04 protocol is an
improvement over its predecessor, the original Signal-Adjacent Reference (SARG) protocol, as it
provides better security and efficiency.
Like other QKD protocols, the SSARG04 protocol uses the principles of quantum mechanics to securely
distribute cryptographic keys between two parties. The protocol requires the use of two mutually
unbiased bases, which are selected randomly for each transmission. In the SSARG04 protocol, these two
bases are the rectilinear (R) and diagonal (D) bases, and they are used to encode qubits.
The SSARG04 protocol works by sending a series of qubits through a quantum channel, which is
assumed to be under the control of an eavesdropper. The sender and receiver each have a copy of a
reference frame, which is used to identify the bases used to encode the qubits. The reference frame
contains a set of reference qubits, which are sent through the channel along with the actual data qubits.
In the SSARG04 protocol, the reference qubits are sent in a specific order, with each qubit being
adjacent to the next reference qubit in the reference frame. This ensures that any eavesdropping attempts
will be detected, as the eavesdropper cannot change the order of the reference qubits without introducing
errors into the transmission[7].

39
IV. Networks in Quantum Key Distribution
Quantum Key Distribution (QKD) networks are communication networks that use quantum mechanics
to securely transmit cryptographic keys. These networks are designed to provide secure communication
between multiple parties over long distances. In a QKD network, cryptographic keys are generated using
quantum states, which cannot be copied or intercepted without being detected.
The fundamental principle of QKD is that if a message is transmitted using a quantum state, any attempt
to intercept the state will be detected due to the no-cloning theorem of quantum mechanics. This makes
it possible to create a secure communication channel that is resistant to eavesdropping.
In a QKD network, there are typically two types of nodes: trusted nodes and untrusted nodes. Trusted
nodes are used to generate and distribute cryptographic keys, while untrusted nodes are used to transmit
messages securely over the network [8].
Example:
Let's say two companies, Company A and Company B, want to securely exchange sensitive data over a
network. They decide to use a quantum key distribution (QKD) network to establish a secure key for
encryption.
The QKD network consists of several nodes, each with a quantum key distribution system that generates
and distributes cryptographic keys using quantum mechanics principles.
First, Company A's QKD system generates a series of photons, which are transmitted over the network
to Company B's QKD system. Each photon is polarized in a specific direction, either vertically or
horizontally.
At each node along the network, the photon is intercepted and measured by a device that randomly
selects one of two possible bases for measurement. If the selected basis matches the photon's
polarization, the measurement is successful and the photon's polarization is recorded as either a 0 or 1.
However, if the selected basis is different from the photon's polarization, the measurement is
unsuccessful and the photon's polarization is changed. This means that any eavesdropping attempts
would be detected, as they would inevitably change the polarization of the photons.
After the photon measurements are complete, Company A and Company B compare a subset of their
recorded photon polarizations to establish a shared secret key. This key is then used to encrypt the
sensitive data that will be transmitted between the two companies.
By using a QKD network, Company A and Company B can securely exchange data without worrying
about interception or eavesdropping [8].
V. Quantum Cryptography & Eavesdropping
What will happen if an eavesdropper, who is typically referred to as Eve in cryptography, manages to
access the same communication channel in addition to Alice and Bob? If Eve gets access to the
relevant communication channel during non-quantum eavesdropping, she can measure each bit Alice
delivers in order to obtain the complete message. Since a measurement in non-quantum physics does
not alter the signal, Bob receives the identical signal that Alice sent, neither Alice nor Bob will be
aware that their conversation was bugged.

40
The situation is different in quantum physics. The fact that measurement generally modifies the signal
is one of the fundamental characteristics of quantum physics. Eve may choose the incorrect orientation
for her measurement if she is unaware of which of the two orientations each bit is sent in. As a result,
for instance, if Alice and Bob choose to send a given bit using the orientation but Eve chooses the +
orientation, Eve's measurement will modify Alice's signal and Bob will only get the distorted message.
Using quantum cryptography, an eavesdropper can be found. With a certain degree of probability,
Bob's signal will differ from Alice's signal if there is an eavesdropper. We can therefore see that there
was interference by comparing what Alice sent and what Bob got, and we will be able to identify the
eavesdropper as a result[12].

VI. Security in Quantum Cryptography


Security is a critical aspect of quantum cryptography, and it is achieved by ensuring the secrecy and
correctness of the transmitted information. The security of quantum cryptography is evaluated based on
various criteria, including robustness, accessible information, adversarial models, and asymptotic versus
finite-size security.
One of the critical aspects of security in quantum cryptography is the secrecy and correctness of the
transmitted information. Secrecy refers to the ability to keep the transmitted information secret from an
unauthorized party. Correctness, on the other hand, refers to the ability to transmit the information without
any errors or modifications.
Robustness is another important criterion in evaluating the security of quantum cryptography. A protocol
is considered robust if it can withstand various types of attacks, including eavesdropping, tampering, and
denial-of-service attacks.
Accessible information refers to the amount of information that can be obtained by an attacker who has
access to the communication channel. In quantum cryptography, the amount of accessible information is
reduced by the use of quantum mechanics principles, such as the no-cloning theorem and the uncertainty
principle.
Adversarial models are used to evaluate the security of quantum cryptography against different types of
attackers. The two main adversarial models used in quantum cryptography are the passive and active
adversaries. Passive adversaries only eavesdrop on the communication channel, while active adversaries
can modify or inject messages into the communication channel.
Expressing weaker security criteria within the AC framework is another important aspect of security in
quantum cryptography. The AC (almost certain) framework provides a formal way of expressing security
criteria and is used to analyze the security of various quantum cryptography protocols.
Asymptotic versus finite-size security is another criterion used to evaluate the security of quantum
cryptography. Asymptotic security refers to the security of a protocol as the number of transmitted bits
approaches infinity, while finite-size security considers the security of a protocol for a finite number of
transmitted bits.

41
The trace distance criterion is a widely used criterion for evaluating the security of quantum cryptography
protocols. The trace distance is a measure of the difference between two quantum states and is used to
quantify the security of a protocol against eavesdropping attacks.

VII. Limitations of Quantum Cryptography in Practical World

1. There is always a chance that the polarisation of a photon could change when it passes through
a channel, like an optical fibre or the air (for wireless communication). The different factors
that could trigger thi such as Action of Birefringence. The process of Birefringence is the
splitting of a light beam into ordinary and unusual rays when it passes through specific
materials. When the medium has an anisotropic structure, this phenomenon may happen. The
fact that the electric field vector and the dielectric displacement can be nonparallel in
anisotropic media, specifically for the exceptional polarisation, is what causes birefringence.
2. The receiver can verify the authenticity of the digital data thanks to the digital signatures. A
recipient has good cause to trust that a communication was created by a known sender and that
it was not altered in transit if it bears a valid digital signature. Three algorithms—key
generation, key signing, and key verification—make up the digital generation system.
However, we are aware that implementing algorithms in QC is not that simple. As a result, QC
is lacking many essential elements such as digital signature, certified mail, and the capacity to
resolve disputes in front of a judge[17].
3. When developing the source, it is important to consider the coherence in phase of the laser
pulses. All of the photons released must have different levels of phase coherence. This
necessitates the use of a phase modulator with a spectacular design that rapidly alters the phase
of subsequent photons. Additionally, the multi-photon components of the attenuated laser
pulses are significant because they are not single photons.
4. To achieve high speed communication utilising single photons, a dedicated channel of
excellent quality is required. Key transmission over a quantum channel is not conceivable due
to multiplexing's incompatibility with quantum theory. As a result, it necessitates separate
channels to connect the source with all of the many destinations, which suggests a significant
cost. This is a significant drawback for quantum communication, especially when using an
optical channel[18].
5. The plug-and-play systems are taken into consideration, and Alice's equipment is ready to
receive photons. As a result, Eve in the middle may pulse some light towards Alice's polarizer;
this light is reflected by the polarizer and leaks to Eve. The time-shift attack, among others,
has been successful in breaking commercially available quantum key distribution systems.
This is the first effective example of quantum channel hacking. At the moment, hackers do not
stand to gain much by investing their time and resources in breaking into the little-used
quantum channel. However, if the number of QC users grows, more unanticipated, novel
assaults that haven't been conceived of before are likely to occur[19][20].
6. The likelihood of a photon being absorbed or depolarized increases exponentially with fibre
length in channels like an optical fibre. The following issues could result from this: With
increasing channel length, the number of tries necessary to transmit a photon without
absorption or depolarization increases exponentially. The fidelity of the communicated state
diminishes exponentially with channel length, even when a photon does arrive.
42
RSA IMPLEMENTATION USING IBM-QISKIT

A. Quantum Gates Implementation Using IBM-QISKIT


Creating IBM Account:

Fig-10: IBM Account

IBM Quantum Dashboard:

43
Fig-11: IBM Quantum Dashboard

IBM Quantum Composer

Fig-12: Quantum Composer

Not Gate:

44
Not Not Gate

Hadamard Gate

45
Entanglement

46
47
48
49
50
Output:

Statevector([ 1.+0.j, 0.+0.j, -0.+0.j, 0.+0.j],

dims=(2, 2))

In this case, the system is in the state |00> with a probability amplitude of 1, which means that the system
is in the state |00> with certainty. All other possible states have a probability amplitude of 0.

51
SCHEDULE, TASK & MILESTONE
TIMELINE:

MILESTONES:

52
PROJECT DEMONSTRATION & RESULTS

A. Montgomery Multiplication
Montgomery multiplication is an efficient method for performing modular multiplication. It is widely
used in cryptographic algorithms, especially in elliptic curve cryptography (ECC). The algorithm was
introduced by Peter L. Montgomery in 1985 as a way to speed up modular multiplication, which is a
critical operation in many cryptographic applications.
In modular arithmetic, the remainder of a division operation is computed, rather than the quotient. The
modulus operation is frequently used in cryptographic algorithms for security reasons. Montgomery
multiplication offers a faster and more efficient way of performing modular multiplication than
traditional algorithms such as long multiplication.
The Montgomery multiplication algorithm operates in a special residue number system that allows for
efficient arithmetic operations, including multiplication, addition, and subtraction. This system uses a
"reduction" operation that converts a number in the residue number system back into the standard
representation. The reduction operation is computationally expensive, but it only needs to be performed
once per modular operation, rather than per multiplication.
The Montgomery multiplication algorithm can be used to perform scalar multiplication in ECC, which
is a key operation in many cryptographic protocols. It allows for faster key generation and validation,
which is especially important in resource-constrained environments such as mobile devices and smart
cards.
One of the key advantages of Montgomery multiplication is its resistance to side-channel attacks. Side-
channel attacks involve measuring the physical properties of a device, such as power consumption or
electromagnetic radiation, to extract secret information. Montgomery multiplication algorithms can be
designed to minimize the leakage of sensitive information through side channels.
Implementation in IBM-QISKIT:
# Measuring the length of x
n = len( x )
# Assigning Quantum registers for Quantum operation
x_reg = QuantumRegister ( n +1)
y_reg = QuantumRegister ( n +2)
y_reg_0 = QuantumRegister (1)
m_reg = QuantumRegister ( n +2)
a_reg = QuantumRegister ( n +2)
u_reg = QuantumRegister ( n +1)
onecubit = QuantumRegister (1)
# Assigning classical registers to store our results from Quantum

53
registers
a_cl_reg = ClassicalRegister ( n +2)
u_cl_reg = ClassicalRegister ( n +1)
cl_reg = ClassicalRegister ( n +1)
one_cl_reg = ClassicalRegister (1)
# creating seperate Quantum circuits for different operations to
speedup the process
circ_u = QuantumCircuit ( u_reg , y_reg_0 , u_cl_reg )
circ_a = QuantumCircuit ( a_reg , y_reg , m_reg , a_cl_reg , onecubit ,one_cl_reg )
# Loading inputs to Quantum registers
for i in range ( n ) :
if y [ i ] == ’1’:
circ_a . x ( y_reg [ n - i - 1])
for i in range ( n ) :
if m [ i ] == ’1’:
circ_a . x ( m_reg [ n - i - 1])
for i in range ( n ) :
if x [ n - i - 1] == ’1 ’:
add ( u_reg , y_reg_0 , circ_u )
circ_u . measure ( u_reg [0] , u_cl_reg [0])
result = execute ( circ_u , backend = Aer . get_backend (’ qasm_simulator
’) , shots =1). result () . get_counts ( circ_u )
measure_u = int (( list ( result . keys () ) [0]) )
print (’ measure_u : ’, measure_u )
if x [ n - i - 1] == ’1 ’:
add ( a_reg , y_reg , circ_a )
if measure_u == 1:
add ( a_reg , m_reg , circ_a )
rshift ( circ_a , a_reg , n + 2 , onecubit )
circ_a . measure ( a_reg , a_cl_reg )

54
circ_a . measure ( onecubit , one_cl_reg )
result = execute ( circ_a , backend = Aer . get_backend (’ qasm_simulator
’) , shots =1). result () . get_counts ( circ_a )
total = list ( result . keys () ) [0]
measure_a = total [2:]
print ( measure_a )
measure_onecubit = int( total [0])
if measure_onecubit == 1:
circ_a . x ( onecubit )
# loading a0 to u0
if measure_a [ n + 1] == ’1’:
if measure_u == 0:
circ_u . x ( u_reg [0])
else :
if measure_u == 1:
circ_u . x ( u_reg [0])
if (int ( measure_a ) >= int ( m ) ) :
sub ( a_reg , m_reg , circ_a )
circ_a . measure ( a_reg , a_cl_reg )
result = execute ( circ_a , backend = Aer . get_backend (’ qasm_simulator ’) ,
shots =1). result (). get_counts ( circ_a )
total = list ( result . keys () ) [0]
final_a = total [2:]
print ( final_a )
OUTPUT:
>>> Enter the binary number for x: 110
>>>Enter the binary number for y: 110
>>>Enter the binary number for m: 111
>>>Result for Montgomery modular multiplication: 00001
>>>Time taken to execute: 0.7048022747039795 seconds

55
Explanation:
As an initial step, length of x input was measured and Quantum registers and Classical registers were
assigned with extra bits as needed for the operation. Separate Quantum circuits was created for each sets
of addition in the algorithm. This way of implementing circuits makes sure the performance is faster
than if they are implemented in a single circuit. Addition was performed using QFT adder in the
intermediate steps of Montgomery modular multiplication. In order to take decision according to the
addition results, qubits were measured in each iteration. As a final step, if calculated answer is greater
than the m value, then it is subtracted from m to get the final answer. Else, the obtained answer is the
final result.
B. Chinese Remainder Theorem
The Chinese Remainder Theorem (CRT) is a mathematical theorem that provides a solution to a system
of linear congruences, where the moduli are pairwise relatively prime. It was first discovered by the
Chinese mathematician Sunzi in the 3rd century AD. Later, it was rediscovered by the Chinese
mathematician Qin Jiushao in the 13th century, who provided a more general form of the theorem.
The theorem states that given a system of linear congruences of the form:
x ≡ a1 (mod m1)
x ≡ a2 (mod m2)
...
x ≡ ak (mod mk)
where m1, m2, ..., mk are pairwise relatively prime integers, there exists a unique solution modulo M =
m1m2...mk.
The uniqueness of the solution modulo M is guaranteed by the Chinese Remainder Theorem, provided
that the moduli are pairwise relatively prime. The existence of the solution can be shown using the method
of successive substitution or the Extended Euclidean Algorithm.
Implementation in IBM-QISKIT:
from qiskit import QuantumCircuit, execute, Aer
from qiskit.visualization import plot_histogram

# Step 1: Define the quantum circuit


def chinese_remainder_theorem(qbits, c1, c2, mod1, mod2):
# create a quantum circuit with the specified number of qubits
qc = QuantumCircuit(qbits*2, qbits)

# apply Hadamard gates to the first qubits


for i in range(qbits):

56
qc.h(i)

# apply conditional phase shifts based on the classical inputs


for i in range(qbits):
qc.cu1(c1 * 2**i, i, qbits)
qc.cu1(c2 * 2**i, i, qbits)

# apply inverse Fourier transform to the first qubits


for i in range(qbits):
for j in range(i):
qc.cu1(-1/float(2**(i-j)), j, i)
qc.h(i)

# measure the first qubits


qc.measure(range(qbits), range(qbits))

# Step 2: Execute the quantum circuit on a simulator


simulator = Aer.get_backend('qasm_simulator')
job = execute(qc, simulator, shots=1)
result = job.result()

# Step 3: Process the results


counts = result.get_counts()
measured_vals = []
for key in counts:
measured_vals.append(int(key, 2))

# Step 4: Apply the Chinese Remainder Theorem


x = (c1*mod2*pow(mod2, -1, mod1) + c2*mod1*pow(mod1, -1, mod2)) % (mod1*mod2)
for measured_val in measured_vals:

57
if measured_val == x:
return x

# return -1 if no valid measurement is found


return -1

# Step 5: Test the code with example inputs


qbits = 3
c1 = 2
c2 = 3
mod1 = 5
mod2 = 7
result = chinese_remainder_theorem(qbits, c1, c2, mod1, mod2)
print(result)
from qiskit.visualization import plot_histogram

counts = {'{:02b}'.format(chinese_remainder(2, 2, 3, 3, 5)): 1}


plot_histogram(counts)
OUTPUT:
>>> chinese_remainder(2, 2, 3, 3, 5)
>>>13
Explanation:
We define a function chinese_remainder_theorem that takes as input the number of qubits qbits, two
classical inputs c1 and c2, and two moduli mod1 and mod2. Inside the function, we first create a quantum
circuit qc with qbits*2 qubits and qbits classical bits. We then apply a Hadamard gate to each of the first
qbits qubits to put them into a superposition of all possible states.
Next, we apply conditional phase shifts to the qbits-th qubit based on the classical inputs c1 and c2.
Specifically, we apply a cu1 gate with the angle c1 * 2**i to the i-th qubit if the qbits-th qubit is in the
state 1, and we apply a cu1 gate with the angle c2 * 2**i to the i-th qubit if the qbits-th qubit is in the state
0.
After applying the conditional phase shifts, we apply the inverse quantum Fourier transform to the first
qbits qubits. This is done using nested loops over i and j, where we apply a cu1 gate with the angle -
1/float(2**(i-j)) to the j-th qubit if the i-th qubit is in the state 1. We then apply a Hadamard gate to the i-
th qubit.
58
Finally, we measure the first qbits qubits and store the measurement results in the first qbits classical bits.
Then Chinese Remainder Theorem is applied to the measured values measured_vals to find the value x
that satisfies the congruences x ≡ c1 (mod mod1) and x ≡ c2 (mod mod2). We use the formula x =
(c1*mod2*pow(mod2, -1, mod1) + c2*mod1*pow(mod1, -1, mod2)) % (mod1*mod2) to compute x,
where `pow(mod2, -1, mod.

The resulting histogram plot would show a single bar with a height of 1, labeled with the binary
representation of the output value, which in this case is 1101 (equivalent to decimal 13).

C. Shor’s Algorithm
By definition, prime numbers can only be divided by one or themselves. They serve as the framework for
the number system. Therefore, practically every student with a foundation in mathematics knows the
answer—3 and 5—when asked what the prime factors or multipliers are for the number 15. A bigger
number, like 91, may require some paper and a pen before it can be solved[11].
Additionally, it can take scientists two full years to factor a greater number like 232, even with hundreds
of high-speed classical computers working in parallel. The majority of encryption techniques for sensitive
data like credit cards, government secrets, and other private information are built on the challenge of
factoring these numbers[11].
In 1994, Peter Shor developed a quantum technique that could efficiently calculate the prime factors of
extremely large integers, something that was previously impractical on any classical supercomputer. The
process of period-finding utilising the Quantum Fourier Transform (QFT) is the fundamental concept
behind Shor's algorithm. The QFT determines the period of a function by using a given function, f(x) [11].
Implementation in IBM-QISKIT:
# Create QuantumCircuit with n_count counting qubits
# plus 4 qubits for U to act on
qc = QuantumCircuit(n_count + 4, n_count)

59
# Initialize counting qubits
# in state |+>
for q in range(n_count):
qc.h(q)
# And auxiliary register in state |1>
qc.x(n_count)
# Do controlled-U operations
for q in range(n_count):
qc.append(c_amod15(a, 2**q),
[q] + [i+n_count for i in range(4)])
# Do inverse-QFT
qc.append(qft_dagger(n_count), range(n_count))
# Measure circuit
qc.measure(range(n_count), range(n_count))
qc.draw(fold=-1) # -1 means 'do not fold'

# Do controlled-U operations
for q in range(n_count):
qc.append(c_amod15(a, 2**q),
[q] + [i+n_count for i in range(4)])
# Do inverse-QFT
qc.append(qft_dagger(n_count), range(n_count))
# Measure circuit
qc.measure(range(n_count), range(n_count))

60
qc.draw(fold=-1) # -1 means 'do not fold'
aer_sim = Aer.get_backend('aer_simulator')
t_qc = transpile(qc, aer_sim)
qobj = assemble(t_qc)
results = aer_sim.run(qobj).result()
counts = results.get_counts()
plot_histogram(counts)

rows, measured_phases = [], []


for output in counts:
decimal = int(output, 2) # Convert (base 2) string to decimal
phase = decimal/(2**n_count) # Find corresponding eigenvalue
measured_phases.append(phase)
# Add these values to the rows in our table:
rows.append([f"{output}(bin) = {decimal:>3}(dec)",
f"{decimal}/{2**n_count} = {phase:.2f}"])

61
# Print the rows in a table
headers=["Register Output", "Phase"]
df = pd.DataFrame(rows, columns=headers)
print(df)

Explanation:
Let’s look at the periodic function: 𝑓(𝑥)=𝑎^𝑥mod𝑁
Reminder: Modulo & Modular Arithmetic where 𝑎 and 𝑁 are positive integers, 𝑎 is less than 𝑁 ,
and they have no common factors. The period, or order ( 𝑟 ), is the smallest (non-zero) integer such that:
𝑎^𝑟mod𝑁=1
We can see an example of this function plotted on the graph below. Note that the lines between points
are to help see the periodicity and do not represent the intermediate values between the x-markers.

CONCLUSION

62
The cryptography field is extensively researched upon in this project. The potential of classical and
quantum computer and their phenomena was compared and observed. The observation leads to the belief
that quantum cryptography is much powerful than the traditional cryptography. This is possible due to the
fact of various potential quantum phenomenon such superposition, entanglement, tunneling etc.
The IBM Quantum Dashboard was accessed in order to achieve the desired results in the project. The
project was initialized with the study of basic quantum gates and then the same was coded in the IBM-
QISKIT shell (refer to the attached images). The histogram plots clearly explain the presence of
superposition in some case and entanglement such as the Hadamard gate implementation & also the other
phenomena. The result might have some noise due the quantum servers but effects are to the minimum.
Then, as the project progressed, the Montgomery Multiplication and Chinese Remainder Theorems were
coded in the IBM-QISKIT (PYTHON). The same was followed by the implementation of the Shor’s
Algorithm that in the quantum world is quite effective when it comes to factoring the larger numbers.
Overall, it was observed Montgomery method gives the satisfactory output in reasonable amount of time.
But the Shor’s algorithm is what makes this area of research more interesting. Though, the safe use case
was coded & tested but it promises the better results that it can bear in the upcoming quantum future. At
last, it was the Chinese Remainder Theorem that still requires more experimental developments in order
to achieve better results.
The work was successful in demystifying and introducing readers to classical and quantum cryptography
as well as the fundamental concepts behind encryption. The significant pertinent studies in the various
branches of classical and quantum cryptography were examined. The goal of the project is to inspire to
learn more about quantum research and to serve as a solid starting point for those just entering the subject
of quantum cryptography. Moreover, while completing the project, it was observed that quantum
cryptography for sure is a level better that classical cryptography; but the amount of development needed
in order to realize it in the practical world is still under-developed. Be it the software or the hardware
perspective both needs their own shar of development and progress.

63
SUMMARY

Cryptography ensures secure communication, with various methods like symmetric and asymmetric
ciphers, hash functions, and data integrity algorithms. However, current public key cryptographic
algorithms like RSA and ECC can be broken by quantum computers. This has prompted the
implementation of new RSA encryption schemes like the one based on the Chinese Remainder Theorem,
which performs better than the classical RSA cryptosystem. Quantum cryptography uses the principles of
quantum physics to encode information in qubits, which provides secure communication. Advancements
in quantum computing generate new tasks in cryptography, and quantum algorithms have the potential to
break RSA encoding, which is used for secure communications like e-commerce transactions. The paper
emphasizes the rise of quantum cryptography and its elements, including quantum key distribution
protocols and quantum networks. A systematic literature review was conducted to discuss various
performance measures and research questions. However, the emergence of quantum computers does not
mean that there will be no more ways to secretly communicate. Overall, quantum cryptography is a
promising technology for secure communication, and research on this subject continues to develop. The
potentials of quantum computation are demonstrated with a condensed explanation of Shor's Algorithm,
which follows a brief introduction to quantum computation. On quantum cryptography, related material
including books, journals, conferences, lecture notes, and websites were studied. This provided a clearer
picture of the workings of Shor's algorithm and quantum cryptography. The authors were able to clearly
explain quantum cryptography, illustrate how encryption is accomplished by taking use of quantum
particle characteristics, and illustrate the complexity of Shor's algorithm using examples. It is anticipated
that interested researchers will be better educated on the state of quantum cryptography research and will
persuade aspiring cryptography researchers to look into the mechanisms of quantum cryptography,
quantum computation, and other quantum theory concepts in more detail.

*****

64
REFERENCES

[1]https://www.bbvaopenmind.com/en/technology/digital-world/towards-the-quantum-computer-qubits-
and-qudits/

[2] https://www.secretsofuniverse.in/quantum-tunneling/

[3] https://phys.org/news/2018-12-quantum-superposition-revivals.html

[4] https://quantum-journal.org/papers/q-2019-09-09-185/

[5] https://en.wikipedia.org/wiki/Bloch_sphere

[6] https://www.javatpoint.com/rsa-encryption-algorithm

[7] IBM Quantum, https://learn.qiskit.org/course

[8] https://medium.com/@qcgiitr/fundamentals-of-quantum-key-distribution-bb84-b92-e91-protocols-
e1373b683ead

[9] RECONFIGURABLE QUANTUM CRYPTO PROCESSOR USING FPGA. A Thesis Presented to


the Faculty of California State Polytechnic University, Pomona.

[10] Salifu, Abdul-Mumin. (2018). Rivest Shamir Adleman Encryption Scheme Based on the Chinese
Remainder Theorem. Advances in Networks. 6. 40. 10.11648/j.net.20180601.14.

[11] An overview of Quantum Cryptography and Shor’s Algorithm.


https://doi.org/10.30534/ijatcse/2020/214952020 .

[12] O. Galindo, V. Kreinovich and O. Kosheleva, "Current Quantum Cryptography Algorithm Is


Optimal: A Proof," 2018 IEEE Symposium Series on Computational Intelligence (SSCI), Bangalore,
India, 2018, pp. 295-300, doi: 10.1109/SSCI.2018.8628876.

[13] Quantum Cryptography Richard J. Hughes D. M. Alde, P. Dyer, G. G. Luther, G. L. Morgan and M.
Schauer.

[14] arXiv:0705.1398 [quant-ph] (or arXiv:0705.1398v2 [quant-ph]

[15] Experimental demonstration of Shor’s algorithm with quantum entanglement B. P. Lanyon, T. J.


Weinhold, N. K. Langford, M. Barbieri, D. F. V. James∗ , A. Gilchrist, and A. G. White Centre for
Quantum Computer Technology Department of Physics University of Queensland, Brisbane QLD 4072,
Australia ∗Department of Physics Center for Quantum Information and Control University of Toronto,
Toronto ON M5S1A7, Canada.

[16] https://www.researchgate.net/figure/a-Representation-of-the-quantum-states-and-electronic-
couplings-on-its-canonical-basis_fig1_51524184

65
[17] C. H. Bennett and G. Brassard, “Quantum cryptography: Public key distribution and coin tossing,”
in Proc. IEEE Int. Conf. Comput. Syst. Signal Process., Bangalore, India, 1984, pp. 175– 179.

[18] G. Brassard, N. Lütkenhaus, T. Mor, and B. C. Sanders, “Limitations on practical quantum


cryptography,” Phys. Rev. Lett., vol. 85, pp.1330– 1333, 2000.

[19] N. Gisin, G. Ribordy, W. Tittel, and H. Zbinden, “Quantum cryptography,” Rev. Mod. Phys., vol.
74, pp. 145–195, 2002.

[20] https://www.rri.res.in/quic/qkdactivities.php

[21] Holger F Hofmann , Toshiki Ide “Optimal cloning of single-photon polarization by coherent feedback
of beam splitter losses” New Journal of Physics vol .8 , pp. 130.1-130.9, Aug 2006

[22] I.B. Djordjevic. “Conventional Cryptography Fundamentals.” In: Physical-Layer Security and
Quantum Key Distribution. Springer, Cham. 2019, pp 65-91.

[23] J. Buchmann, J. Braun, D. Demirel, M. Geihs. “Quantum cryptography: a view from classical
cryptography.” Quantum Science and Technology. 2017 May 25;2(2):020502.

[24] A. Acín, et al., “Device-independent security of quantum cryptography against collective attacks,”
Physical Review Letters, vol. 98, no. 23, 2007, p. 230501.

[25] R. Renner, et al., “Security of quantum key distribution,” International Journal of Quantum
Information, vol. 6, no. 01, 2008, pp. 1-127.

[26] Mandviwalla, A., Ohshiro, K., & Ji, B. (2018, December). Implementing Grover’s algorithm
on the IBM quantum computers. In 2018 IEEE international conference on big data (big data) (pp. 2531-
2537). IEEE.

[27] Brassard, G., Lütkenhaus, N., Mor, T., & Sanders, B. C. (2000). Limitations on practical quantum
cryptography. Physical review letters, 85(6), 1330

[28] Hughes, R. J., Alde, D. M., Dyer, P., Luther, G. G., Morgan, G. L., & Schauer, M. (1995). Quantum
cryptography. Contemporary Physics, 36(3), 149-163.

[29] Portmann, C., & Renner, R. (2022). Security in quantum cryptography. Reviews of Modern Physics,
94(2), 025008.
[30] Everitt, H. O. (Ed.). (2005). Experimental aspects of quantum computing. Springer Science+
Business Media.

[31] V. Padamvathi, B. V. Vardhan and A. V. N. Krishna, "Quantum Cryptography and Quantum Key
Distribution Protocols: A Survey," 2016 IEEE 6th International Conference on Advanced Computing
(IACC), Bhimavaram, India, 2016, pp. 556-562, doi: 10.1109/IACC.2016.109.

[32] H. Zhang, Z. Ji, H. Wang and W. Wu, "Survey on quantum information security," in China
Communications, vol. 16, no. 10, pp. 1-36, Oct. 2019, doi: 10.23919/JCC.2019.10.001.

66
APPENDIX-A

Simon's Algorithm

Simon's algorithm was the first quantum algorithm to show an exponential speed-up versus the best
classical algorithm in solving a specific problem. This inspired the quantum algorithms based on the
quantum Fourier transform, which is used in the most famous quantum algorithm: Shor's factoring
algorithm.

Simon's Problem

We are given an unknown blackbox function 𝑓, which is guaranteed to be either one-to-one ( 1:1) or
two-to-one ( 2:1

), where one-to-one and two-to-one functions have the following properties: one-to-one: maps exactly
one unique output for every input. An example with a function that takes 4 inputs is:
𝑓(1)→1,𝑓(2)→2,𝑓(3)→3,𝑓(4)→4

two-to-one: maps exactly two inputs to every unique output. An example with a function that takes 4
inputs is: 𝑓(1)→1,𝑓(2)→2,𝑓(3)→1,𝑓(4)→2

This two-to-one mapping is according to a hidden bitstring, 𝑏, where: given 𝑥1,𝑥2:𝑓(𝑥1)=𝑓(𝑥2)it is


guaranteed :𝑥1⊕𝑥2=𝑏

Given this black box 𝑓, how quickly can we determine if 𝑓 is one-to-one or two-to-one? Then, if 𝑓
turns out to be two-to-one, how quickly can we determine 𝑏? As it turns out, both cases boil down to
the same problem of finding 𝑏, where a bitstring of 𝑏=000...represents the one-to-one 𝑓.

Simon's Algorithm (Classical Solution)

Classically, if we want to know what 𝑏 is with 100% certainty for a given 𝑓, we have to check up to
2𝑛−1+1 inputs, where n is the number of bits in the input. This means checking just over half of all the
possible inputs until we find two cases of the same output. Much like the Deutsch-Jozsa problem, if we
get lucky, we could solve the problemwith our first two tries. But if we happen to get an 𝑓 that is one-
to-one, or get really unlucky with an 𝑓 that’s two-to-one, then we’re stuck with the full 2𝑛−1+1. There
are known algorithms that have a lower bound of Ω(2𝑛/2), but generally speaking the complexity grows
exponentially with n.

The quantum circuit that implements Simon's algorithm is shown

here >>>

Where the query function, Q𝑓 acts on two quantum registers as:

|𝑥⟩|𝑎⟩→|𝑥⟩|𝑎⊕𝑓(𝑥)⟩

67
The algorithm involves the following steps.

● Two 𝑛 -qubit input registers are initialized to the zero state:

|𝜓1⟩=|0⟩⊗𝑛|0⟩⊗𝑛

● Apply a Hadamard transform to the first register:

|𝜓2⟩=12𝑛⎯⎯⎯⎯√∑𝑥∈{0,1}𝑛|𝑥⟩|0⟩⊗𝑛

● Apply the query function Q𝑓:

|𝜓3⟩=12𝑛⎯⎯⎯⎯√∑𝑥∈{0,1}𝑛|𝑥⟩|𝑓(𝑥)⟩

● Measure the second register. A certain value of 𝑓(𝑥) will be observed. Because of the setting of
the problem, the observed value 𝑓(𝑥) could correspond to two possible inputs: 𝑥 and 𝑦=𝑥⊕𝑏.
Therefore the first register becomes:

|𝜓4⟩=12⎯⎯√(|𝑥⟩+|𝑦⟩)

;where we omitted the second register since it has been measured.

● Apply Hadamard on the first register:

|𝜓5⟩=12𝑛+1⎯⎯⎯⎯⎯⎯⎯√∑𝑧∈{0,1}𝑛[(−1)𝑥⋅𝑧+(−1)𝑦⋅𝑧]|𝑧⟩

● Measuring the first register will give an output only if:

(−1)𝑥⋅𝑧=(−1)𝑦⋅𝑧

68
which means: 𝑥⋅𝑧=𝑦⋅𝑧𝑥⋅𝑧=(𝑥⊕𝑏)⋅𝑧𝑥⋅𝑧=𝑥⋅𝑧⊕𝑏⋅𝑧𝑏⋅𝑧=0 (mod 2)

● A string 𝑧 will be measured, whose inner product with 𝑏=0. Thus, repeating the algorithm ≈𝑛
times, we will be able to obtain 𝑛 different values of 𝑧 and the following system of equation can
be written:

𝑏⋅𝑧1=0𝑏⋅𝑧2=0⋮𝑏⋅𝑧𝑛=0 ;From which 𝑏 can be determined, for example by Gaussian elimination.

Grover’s Algorithm

● In quantum computing, Grover's algorithm, also known as the quantum search algorithm, refers
to a quantum algorithm for unstructured search that finds with high probability the unique input
to a black box function that produces a particular output value, using just O({\sqrt {N}})
evaluations of the function, where N is the size of the function's domain. It was devised by Lov
Grover in 1996.
● The analogous problem in classical computation cannot be solved in fewer than O(N)
evaluations (because, on average, one has to check half of the domain to get a 50% chance of
finding the right input). Charles H. Bennett, Ethan Bernstein, Gilles Brassard, and Umesh
Vazirani proved that any quantum solution to the problem needs to evaluate the function
{\displaystyle \Omega ({\sqrt {N}})} times, so Grover's algorithm is asymptotically optimal.
Since classical algorithms for NP-complete problems require exponentially many steps, and
Grover's algorithm provides at most a quadratic speedup over the classical solution for
unstructured search, this suggests that Grover's algorithm by itself will not provide polynomial-
time solutions for NP-complete problems (as the square root of an exponential function is an
exponential, not polynomial, function).
● Unlike other quantum algorithms, which may provide exponential speedup over their classical
counterparts, Grover's algorithm provides only a quadratic speedup. However, even quadratic
speedup is considerable when N is large, and Grover's algorithm can be applied to speed up
broad classes of algorithms.[3] Grover's algorithm could brute-force a 128-bit symmetric
cryptographic key in roughly 264 iterations, or a 256-bit key in roughly 2128 iterations. As a
result, it is sometimes suggested[4] that symmetric key lengths be doubled to protect against
future quantum attacks.

The steps of Grover's algorithm are given as follows:

● Initialize the system to the uniform superposition over all states:

● Perform the following "Grover iteration" times:


○ Apply the operator
○ Apply the Grover diffusion operator:
○ Measure the resulting quantum state in the computational basis.

69

You might also like