0% found this document useful (0 votes)
8 views5 pages

Irjet V10i4191

Uploaded by

Matheus Victor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views5 pages

Irjet V10i4191

Uploaded by

Matheus Victor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 10 Issue: 04 | Apr 2023 www.irjet.net p-ISSN: 2395-0072

Quantum Implementation of RSA Crypto-algorithm using IBM-QISKIT


Pallavi Verma1, Dr. Palla Penchalaiah 2

1Student, VIII Semester, B.Tech(ECE), VIT University, Vellore, Tamil Nadu, India
(E-mail: pallavi.verma2019@vitstudent.ac.in)
2Associate Professor, Dept. of Micro & Nano Electronics, VIT University, Vellore, Tamil Nadu, India

---------------------------------------------------------------------***---------------------------------------------------------------------
Abstract - Quantum computers have the potential to break In this context, the quantum implementation of RSA using
classical RSA encryption, which could lead to the loss of Qiskit(IBM) has emerged as a promising approach. By
sensitive information, financial data, and other confidential leveraging the power of quantum mechanics, Qiskit can
information. To address this issue, a new generation of provide efficient solutions for the complex mathematical
cryptography called quantum cryptography has emerged. operations required by RSA. This quantum implementation
Quantum cryptography exploits the principles of quantum of RSA using Qiskit has the potential to enhance the security
mechanics for encryption & decryption, making it impossible of data transmission and storage, and pave the way for the
for hackers to break. However, the implementation of development of next-generation cryptography.[1]
quantum cryptography is still in its early stages. The
motivation behind this project is to explore the feasibility of 1.1 What is a QUBIT?
using quantum computing to enhance the security of
traditional cryptographic techniques. The project aims to In quantum computing, a qubit or quantum bit is a basic unit
implement the RSA encryption algorithm on a quantum of quantum information—the quantum version of the classic
computer such as IBM-QISKIT platform. This will evince the binary bit physically realized with a two-state device. A qubit
potential of quantum computing in the field of cryptography. is a two-state (or two-level) quantum-mechanical system, one
Specifically, the aim is to investigate and compare the of the simplest quantum systems displaying the peculiarity of
efficiency, accuracy, and security of potential different quantum mechanics. Examples include the spin of the
methods for quantum implementation of RSA: (1) Montgomery electron in which the two levels can be taken as spin up and
multiplication, (2) Chinese remainder theorem, (3) Shor’s spin down; or the polarization of a single photon in which the
Algorithm. two states can be taken to be the vertical polarization and the
horizontal polarization.[2]
Key Words: Quantum Computing, IBM-QISKIT, RSA,
In a classical system, a bit would have to be in one state or the
Chinese Remainder Theorem, Montgomery
other. However, quantum mechanics allows the qubit to be in
Multiplication, Shor’s Algorithm
a coherent superposition of both states simultaneously, a
property that is fundamental to quantum mechanics and
1. INTRODUCTION quantum computing. In addition to superposition, qubits can
also exhibit a phenomenon called entanglement. This means
Quantum computing is a game-changing technology that
that the state of one qubit is directly related to the state of
promises to revolutionize the world of computing as we
another qubit, even if they are separated by large distances.
know it. Traditional computers work with binary digits,
known as bits, which can be either 0 or 1. However, quantum 1.2 The BLOCH Sphere
computers use quantum bits, or qubits, which can exist in
multiple states simultaneously. This property of qubits The Bloch sphere is like a map of all the possible states that a
allows quantum computers to perform certain calculations single qubit can be in. Imagine a sphere, like a beach ball,
exponentially faster than classical computers, making them where each point on the surface represents a different state
ideal for solving complex problems in fields such as of the qubit. The north pole of the sphere represents a qubit
cryptography, drug discovery, and artificial intelligence. The that is definitely in the state "0", and the south pole
RSA algorithm is a widely used and trusted encryption represents a qubit that is definitely in the state "1". All other
method that relies on the difficulty of factoring large points on the sphere represent a superposition of the "0" and
composite numbers. However, the security of RSA can be "1" states. The Bloch sphere is important because it helps us
compromised by quantum computers, which can efficiently to visualize and understand how qubits work. By looking at
factor such numbers using Shor's algorithm. To counter this, the Bloch sphere, we can see how different quantum gates
there has been growing interest in implementing RSA using (like the X, Y, and Z gates) affect the state of a qubit. We can
quantum computing techniques, which can provide an also see how measurements collapse the state of a qubit to
additional layer of security against quantum attacks. either "0" or "1".[3]

© 2023, IRJET | Impact Factor value: 8.226 | ISO 9001:2008 Certified Journal | Page 1282
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 10 Issue: 04 | Apr 2023 www.irjet.net p-ISSN: 2395-0072

2. The Quantum Phenomena Choose two prime numbers p and q. These are kept secret
and are used to generate the public and private key pairs.
One of the most well-known quantum phenomena is
superposition, which means that a quantum object, such as an Compute n = p * q. This is the modulus and is part of the
atom or photon, can exist in multiple states or locations at the public key. Euler's totient function phi(n) = (p-1)*(q-1).
same time. This is different from classical objects, which exist Choose an integer e such that 1 < e < phi(n) and gcd(e, phi(n))
in a single state or location at any given time. (This means = 1. This is the public key. Compute d such that d*e = 1 mod
that an atom can be in two different states at the same time.) phi(n). This is the private key. To encrypt a message, the
sender converts the message into a number m less than n,
Another quantum phenomenon is entanglement, which and raises it to the power of e mod n. To decrypt the message,
occurs when two quantum objects become connected in a the receiver raises the encrypted message to the power of d
way that their properties are correlated, even when they are mod n.[5]
far apart from each other. This means that measuring the
property of one object will instantaneously affect the 4. The IBM-QISKIT
property of the other object, even if they are light years apart.
(Atoms can also become "entangled" with each other. This IBM Qiskit is a powerful open-source software development
means that what happens to one atom can affect what kit for building quantum computing applications. It is one of
happens to another atom, no matter how far apart they are.) the most popular and widely used platforms for creating,
simulating, and executing quantum programs. With Qiskit,
Another phenomenon is quantum tunneling, which is the users can write quantum algorithms and execute them on
ability of a quantum object to pass through a potential real quantum devices provided by IBM or on simulators that
barrier, even if it does not have enough energy to overcome emulate the behavior of quantum systems. Qiskit also
the barrier according to classical physics. (When atoms are includes a variety of powerful tools for visualizing quantum
in superposition, they can sometimes do things that seem circuits and analyzing the results of quantum computations.
impossible. For example, they can pass through solid objects, Whether you are a seasoned quantum computing expert or
like walls, without breaking them. This is called "tunnelling") just starting out, Qiskit provides a robust set of tools and
resources to help you explore the exciting world of quantum
Quantum mechanics also involves, which is described by the computing. Qiskit consists of four main components: Terra,
Heisenberg uncertainty principle. This principle states that Aer, Ignis, and Aqua.[6]
the more precisely the position of a particle is known, the
less precisely its momentum can be known, and vice versa. 6. Implementation of Quantum RSA methods
(It is impossible to simultaneously know the exact position
and the momentum of the particle.)[4] Modular exponentiation: The most straightforward way to
implement RSA is by using modular exponentiation. The key
3. The RSA Algorithm generation algorithm generates two large prime numbers, p
and q, and calculates their product, N = p * q. It then chooses a
RSA (Rivest-Shamir-Adleman) is a public-key cryptosystem number e such that 1 < e < (p-1)(q-1) and gcd(e, (p-1)(q-1)) =
used for secure data transmission over the internet. It is one 1. The public key is (N, e), and the private key is d, where d is
of the most widely used encryption algorithms, and is used to the modular inverse of e modulo (p-1)*(q-1). To encrypt a
encrypt sensitive information such as credit card numbers message, m, the sender calculates c = m^e mod N, and to
and passwords. The RSA algorithm uses two prime numbers decrypt it, the receiver calculates m = c^d mod N.
to generate a public and private key pair. The security of the
algorithm relies on the difficulty of factoring large numbers Chinese remainder theorem: Another way to implement RSA is
into their prime factors. Public Key encryption algorithm is by using the Chinese remainder theorem. This method is
also called the Asymmetric algorithm. Asymmetric algorithms faster than modular exponentiation, especially when the
are those algorithms in which sender and receiver use numbers involved are very large. The key generation
different keys for encryption and decryption. Each sender is algorithm is the same as in the previous method. To encrypt a
assigned a pair of keys: Public Key & Private Key. The Public message, m, the sender first calculates m1 = m mod p and m2
key is used for encryption, and the Private Key is used for = m mod q. The sender then calculates c1 = m1^e mod p and
decryption. Decryption cannot be done using a public key. c2 = m2^e mod q. The sender then uses the Chinese
The two keys are linked, but the private key cannot be remainder theorem to calculate c such that c ≡ c1 (mod p)
derived from the public key. The public key is well known, and c ≡ c2 (mod q). To decrypt the message, the receiver
but the private key is secret and it is known only to the user calculates d1 = d mod (p-1) and d2 = d mod (q-1). The
who owns the key. It means that everybody can send a receiver then calculates m1 = c^d1 mod p and m2 = c^d2
message to the user using user's public key. But only the user mod q. The receiver then uses the Chinese remainder
can decrypt the message using his private key theorem to calculate m such that m ≡ m1 (mod p) and m ≡
m2 (mod q).

© 2023, IRJET | Impact Factor value: 8.226 | ISO 9001:2008 Certified Journal | Page 1283
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 10 Issue: 04 | Apr 2023 www.irjet.net p-ISSN: 2395-0072

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.

5. The IBM-QISKIT Code

5.1 Chinese Remainder Theorem


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, Fig -2: CRT Code Snippet_2
such that y ≡ 1 mod p and z ≡ 1 mod q. This can be done
using the extended Euclidean algorithm. Result:

3. Compute the values u and v, where u ≡ ay mod p and v ≡ The input integers are [2, 3, 4, 5]
bx mod q.
The corresponding constants are [3, 5, 7, 11]
4. The solution for x is given by x ≡ (uqz + vp y) mod N.
The moduli are [5, 7, 9, 11]
In general, the CRT can be extended to solve systems of linear
The solutions are:
congruences with any number of equations, provided that the
moduli are pairwise coprime (i.e., they have no common x = 12640 mod 3465
factors other than 1).[7]
5.2 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. 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.[8]

Fig -1: CRT Code Snippet_1

© 2023, IRJET | Impact Factor value: 8.226 | ISO 9001:2008 Certified Journal | Page 1284
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 10 Issue: 04 | Apr 2023 www.irjet.net p-ISSN: 2395-0072

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.[9][10][11]

Fig -5: Shor’s Algorithm Code Snippet_1

Fig -3: Montgomery Multiplication Code Snippet_1

Fig -6: Shor’s Algorithm Code Snippet_2

Fig -4: Montgomery Multiplication Code Snippet_2

Result:

The first line of the output shows the result of Montgomery


multiplication of 123456 and 654321 modulo 1000000007.
The result is 128054480.

The second line of the output shows the result of


Montgomery exponentiation of 123456 to the power of
123456789 modulo 1000000007. The result is 406267049.

5.3 Shor’s Algorithm


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 Fig -7: Shor’s Algorithm Code Snippet_3

© 2023, IRJET | Impact Factor value: 8.226 | ISO 9001:2008 Certified Journal | Page 1285
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 10 Issue: 04 | Apr 2023 www.irjet.net p-ISSN: 2395-0072

Result: [2] Mavroeidis, V., Vishi, K., Zych, M. D., & Jøsang, A. (2018).
The impact of quantum computing on present
ATTEMPT 1: cryptography. arXiv preprint arXiv:1804.00200.
Register Reading: 11000000 [3] Everitt, H. O. (Ed.). (2005). Experimental aspects of
Corresponding Phase: 0.75 quantum computing. Springer Science+ Business Media.
Result: r = 4 [4] V. Padamvathi, B. V. Vardhan and A. V. N. Krishna,
Guessed Factors: 3 and 5 "Quantum Cryptography and Quantum Key Distribution
Protocols: A Survey," 2016 IEEE 6th International
*** Non-trivial factor found: {guess} *** Conference on Advanced Computing (IACC),
*** Non-trivial factor found: {guess} *** Bhimavaram, India, 2016, pp. 556-562, doi:
10.1109/IACC.2016.109.
6. CONCLUSIONS
[5] I.B. Djordjevic. “Conventional Cryptography
The cryptography field is extensively researched upon in this Fundamentals.” In: Physical-Layer Security and
project. The potential of classical and quantum computer Quantum Key Distribution. Springer, Cham. 2019, pp 65-
and their phenomena was compared and observed. The 91.
observation leads to the belief that quantum cryptography is
much powerful than the traditional cryptography. This is [6] IBM Quantum, https://learn.qiskit.org/course.
possible due to the fact of various potential quantum
[7] Salifu, Abdul-Mumin. (2018). Rivest Shamir Adleman
phenomenon such superposition, entanglement, tunneling
Encryption Scheme Based on the Chinese Remainder
etc.
Theorem. Advances in Networks. 6. 40.
The IBM Quantum Dashboard was accessed in order to 10.11648/j.net.20180601.14.
achieve the desired results in the project. The project was
[8] Jang, K., Song, G. J., Kim, H., Kwon, H., Lee, W. K., Hu, Z., &
initialized with the study of basic quantum gates and then
Seo, H. (2021). Binary field montgomery multiplication
the same was coded in the IBM-QISKIT shell (refer to the
on quantum computers. Cryptology ePrint Archive.
attached images). The histogram plots clearly explain the
presence of superposition in some case and entanglement [9] Chouhan, N., Saini, H. K., & Jain, S. C. (2017, February). A
such as the Hadamard gate implementation & also the other novel technique to modify the SHOR'S algorithm—
phenomena. The result might have some noise due the Scaling the encryption scheme. In 2017 Second
quantum servers but effects are to the minimum. International Conference on Electrical, Computer and
Communication Technologies (ICECCT) (pp. 1-4)..
The work was successful in demystifying and introducing
readers to classical and quantum cryptography as well as the [10] Experimental demonstration of Shor’s algorithm with
fundamental concepts behind encryption. The significant quantum entanglement B. P. Lanyon, T. J. Weinhold, N. K.
pertinent studies in the various branches of classical and Langford, M. Barbieri, D. F. V. James∗ , A. Gilchrist, and A.
quantum cryptography were examined. G. White Centre for Quantum Computer Technology
Department of Physics University of Queensland,
The goal of the project is to inspire to learn more about
Brisbane QLD 4072, Australia ∗Department of Physics
quantum research and to serve as a solid starting point for
Center for Quantum Information and Control University
those just entering the subject of quantum cryptography.
of Toronto, Toronto ON M5S1A7, Canada.
Moreover, while completing the project, it was observed that
quantum cryptography for sure is a level better that classical [11] Gerjuoy, E. (2005). Shor’s factoring algorithm and
cryptography; but the amount of development needed in modern cryptography. An illustration of the capabilities
order to realize it in the practical world is still under- inherent in quantum computers. American journal of
developed. Be it the software or the hardware perspective physics, 73(6), 521-540.
both needs their own share of development and progress.

REFERENCES
[1] Aumasson, Jean-Philippe (2017). The impact of quantum
computing on cryptography. Computer Fraud &
Security, 2017(6), 8–11. doi:10.1016/S1361-
3723(17)30051-9.

© 2023, IRJET | Impact Factor value: 8.226 | ISO 9001:2008 Certified Journal | Page 1286

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy