0% found this document useful (0 votes)
29 views22 pages

Some Applications of Number Theory To RS

The document discusses the application of number theory concepts like the Euler totient function and Fermat's little theorem to RSA public key cryptography. It provides an overview of the RSA algorithm and its three phases: key generation, encryption, and decryption. Examples are also given to demonstrate encryption and decryption of messages using RSA.

Uploaded by

Noor Alshibani
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)
29 views22 pages

Some Applications of Number Theory To RS

The document discusses the application of number theory concepts like the Euler totient function and Fermat's little theorem to RSA public key cryptography. It provides an overview of the RSA algorithm and its three phases: key generation, encryption, and decryption. Examples are also given to demonstrate encryption and decryption of messages using RSA.

Uploaded by

Noor Alshibani
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/ 22

SOME APPLICATIONS OF NUMBER THEORY TO

RSA PUBLIC KEY CRYPTOGRAPHY

SUBMITTED TO

SCHOOL OF PHYSICAL SCIENCES


DEPARTMENT MATHEMATICS
FEDERAL UNIVERSITY OF TECHNOLOGY, OWERRI

Chukwu Ikechukwu John


20131858925

September 2018
Abstract

This project looked at some aspects of Number Theory and its applications of RSA public
key cryptography. This project used a sample message to demonstrate encryption and
decryption application.

1
Dedication

I dedicate this work to God Almighty, who has been and is still my backbone. My parents,
the source of my joy and strength, and my siblings too.

2
Acknowledgment

My profound gratitude goes to my project supervisor, Dr. M. C. Obi who has been a
father to me. I also wish to appreciate him for his patience, his constructive criticisms and
also for giving me a sound academic guidance to achieve and present this work.
I am also indebted to my Head of Department, Dr. C. A. Nse for his tutelage. I wish
to thank all my Professors – Professor S. C. Inyama, Professor A. M. Ette, Professor E. N.
Erumaka, Dr. R. A. Umana, Dr. (Mrs) E. E. Onugha, Dr. (Mrs) Joy U. Chukwuchekwa,
Mrs. Nneka, Dr. Andrew, Mr. Henry, my understanding and excellent course adviser,
Mr. Araka Nnamdi, Mrs. Chinwe Obi and Mrs. Precious and also all the non-academic
staff of the department.
I wish to specially thank my beloved parents, Mr. and Mrs. J. Chukwu whose
prayers, and love have kept me stronger throughout my sojourn in college. I also thank
my siblings for their prayers. I wish to appreciate the support from my course mates.
They have always been a family to me, ever supporting and loving, God bless you all.
Finally, i’d love to appreciate my roommates, KendricX, Martinez, and Chizzy these
awesome people have always been supporting.

3
Contents

1 Introduction 6
1.1 Background of Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2 Statement of Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Aim and Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Scope of Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5 Definition of Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5.1 Cryptology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5.2 Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5.3 Cryptanalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5.4 Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5.5 Decryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.5.6 Assymetric Key Encryption . . . . . . . . . . . . . . . . . . . . . . . 8
1.5.7 Euler’s Totient Function . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.5.8 Fermat’s Little Theorem . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5.9 Euler’s Theorm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5.10 Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5.11 Number Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5.12 Prime Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2 Literature Review 10

3 Methodology 12
3.1 Divisibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1.1 Divisibility Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1.2 Corollary: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.1.3 Theorem (Algorithm For Computing The G.C.D Of Two Integers) . 13
3.2 Theorem (Euler’s Totient Function) Φ(n) . . . . . . . . . . . . . . . . . . . . 14
3.2.1 Theorem (Euler’s Theorem 1) . . . . . . . . . . . . . . . . . . . . . . 14
3.2.2 Theorem (Euler’s Theorem 2) . . . . . . . . . . . . . . . . . . . . . . 14
3.2.3 Theorem(Fermat’s Little Theorem 1) . . . . . . . . . . . . . . . . . . 14
3.2.4 Theorem(Fermat’s Little Theorem 2) . . . . . . . . . . . . . . . . . . 14
3.3 Congruence Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.3.1 Theorem 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.3.2 Logarithms in Modular Arithmetic . . . . . . . . . . . . . . . . . . . 15
3.4 RSA Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.4.1 Phase 1 (Public and Private Keys Generation) . . . . . . . . . . . . 15
3.4.2 Phase 2 (Encryption) . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.4.3 Phase 2 (Decryption) . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.5 RSA Set-Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.5.1 RSA: How To Encrypt and Decrypt . . . . . . . . . . . . . . . . . . 16

4
4 Analysis and Results 18
4.1 Application 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.2 Application 2 (Communication Between A Browser And A Server . . . . . 19

5 Summary, Conclusion, and Recommendation 20


5.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.3 Recommendation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5
Chapter 1

Introduction

Encryption plays a crucial role in the day-to-day functioning of our society. For example,
millions of people make purchases on the internet every day. Each time you submit your
credit-card details online, there is a risk that this information may be stolen. So how can
the information be sent securely?
A shopper’s credit-card details need to be encrypted before they are transmitted over
the internet, and so the method of encryption needs to be made public. But the method
of decryption should be known only to the bank that is processing the payment. For all
of the ciphers in use before RSA, the methods of encryption and decryption were known
to both the sender and the receiver of the message. With RSA, the instructions for how to
encrypt a message can be made public, without compromising the security of the method
of decryption. This was the big breakthrough that came with RSA encryption.

1.1 Background of Study


RSA is the most widely used and tested public-key cryptosystem. It stands for R ivest, S
hamir, and A dleman. RSA was invented in 1997 by Ron Rivest, Adi Shamir, and Leonard
Adleman. It is based on a very simple number-theoretical idea, and yet it has been able
to resist all cryptanalytic attacks. The idea is a clever use of the fact that, while it is easy
to multiply two large primes, it is extremely difficult to factorize their product.
Thus, the product can be publicized and used as the encryption key. The primes
themselves cannot be recovered from the product and are used for decryption. Two
points need to be borne in mind however, while dealing with the RSA system: there is no
formal proof whatsoever

• That factorization is intractable or is intractable in the special case needed for RSA,
and
• That factorization is needed for the cryptanalysis of the RSA.

1.2 Statement of Problem


This project addresses the issue of how data safety and authentication could be executed
by utilizing RSA public key cryptography within a successful way.

1.3 Aim and Objective


This aim of this project is to show that any group of persons or company can adopt public
key cryptography approach to their message standing and receiving. The objectives of

6
this project includes:

1. To demonstrate the phenomenon of mathematical algorithms in Public Key Cryp-


tography.
2. To offer a way to compare the myriad RSA scheme in use today.
3. To provide some real life examples of RSA in use today.

1.4 Scope of Study


The study covers the elementary part of cryptography and the mathematics of cryptogra-
phy. These includes all widely used RSA Public key cryptography procedures which are
based on results from algebra and number theory. The essence is to form the necessary
basis with which to present the notion of the RSA pubic-key cryptographic system.

1.5 Definition of Terms


There are several ways of classifying cryptographic algorithms. For the purpose of this
study, we will be defining terms related to cryptography and the mathematical formalism
that makes up this study. Hence we introduce some pre-requisite terms on mathematics
and public-key cryptography;

1.5.1 Cryptology
This is the term referring to the broad study of secret writing.

1.5.2 Cryptography
This is the development and creation of the mathematical algorithms used to encrypt and
decrypt messages.

1.5.3 Cryptanalysis
This is the science of analyzing and breaking encryption schemes. The purpose of crypt-
analysis is to break the cryptosystem, in other words, to find the decrypting key or
encrypting key, or to at least produce a method which will let us get some information
out of encrypted messages. In this case it is usually assumed that the cryptanalyzer is an
eaves-dropper or some other hostile party and that the cryptanalyzer knows which cryp-
tosystem is being used but does not know the key being used. A cryptanalyzer may have
different information available: (CO) just some, maybe random, cryptotext (cryptotext
only), (KP) some, maybe random, plaintext and the corresponding cryptotext (known
plaintext), (CP) a chosen plaintext and the corresponding cryptotext (chosen plaintext),
(CC) a chosen cryptotext and the corresponding plaintext (chosen cryptotext).

1.5.4 Encryption
This is one specific element of cryptography in which one hides data or information by
transforming it into an undecipherable code. Encryption is used in everyday modern
life. Encryption is mostly used amongst transactions over insecure channels of commu-
nication, such as the Internet. Encryption is also used to protect data being transferred
between devices such as automatic teller machines (ATM’s ), mobile telephones, and
many more.

7
1.5.5 Decryption
This is often classified along with encryptions as it’s opposite. Decryption of encrypted
data results in the original data.

1.5.6 Assymetric Key Encryption


In Asymmetric key encryption, two different keys are used for the encryption and de-
cryption (private and public). The public key is meant for the general use so it is available
to anyone on the network. Anyone who wants to encrypt the plain text should know the
public key of the receiver. Only the authorized person should know the public key of
the receiver to decrypt the cipher text through his own private key. Private key is kept
secret from the outside world. Asymmetric key encryption is based on some topics in
the number theory, including theories related to primes, factorization of composite into
primes, modulo exponentiation, logarithm, and Chinese remainder theorem.

Figure 1.1: Encryption - Decryption Illustrated

Asymmetric key encryption uses prime extensively. Positive integers can be divided
into three groups: the number 1, prime and composites. A positive integer is a prime if
and only if it is exactly divisible by two integers, 1 and itself. A composite is a positive
integer with more than two divisors. The smallest prime is 2, which is divisible by 2
(itself) and 1. Integer 1 is not a prime according to the definition, because a prime must
be divisible by two different integers, no more, no less. Two positive integers, a and b,
are relatively prime, or co prime, if gcd(a, b) = 1. The integer 1 is relatively prime to any
integer. RSA encryption is based on a special property of the prime numbers. The prime
numbers:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, . . .
are natural numbers greater than 1 which cannot be expressed as a product of smaller
natural numbers. That is, a prime number is a natural number greater than 1 whose only
positive factors are itself and 1. Each natural number greater than 1 can be factorized as a
product of powers of primes. Moreover, if we ignore the order of the prime powers, then
there is only one way to do this. For example, we can write 60 = 22 × 3 × 5. There are
infinitely many prime numbers. Using a computer, it is relatively easy to find lots of large
prime numbers. At present, however, it is very difficult to find the prime factorization of
a very large number. This is what makes RSA encryption so hard to crack.

1.5.7 Euler’s Totient Function


Euler’s totient function ϕ(n), also called Euler′ s phi f unction plays a very important role
in cryptography. The function finds the number of integers that are smaller than n and
relatively prime to n. The ϕ(n) calculates the number of elements in the set. ϕ(n) =
0, ϕ(p) = p − 1, if p is a prime, ϕ(m ∗ n) if m and n are relatively prime, ϕ(pe ) = pe - pe−1 , if p
is a prime.

8
1.5.8 Fermat’s Little Theorem
Fermat’s little theorem plays a very important role in number theory and cryptography.
Two versions of the theorem includes:

• The first version says that if p is prime, α is an integer such that p does not divide α,
then αp−1 ≡ 1modp.

• The second version removes the condition on α . It says that if p does not divide α ,
then , αp–1 ≡ 1mod

Fermat’s little theorem is helpful for quickly finding a solution to exponentiation and
multiplicative inverses. To find 312 mod11, we can use Fermat’s little theorem.

312 mod11 ≡ (311 ∗ 3)mod11 ≡ 311 mod11 ∗ 3mod11 ≡ (3 ∗ 3)mod11 = 9

1.5.9 Euler’s Theorm


Euler’s totient function can be thought of as a generalization of Fermat’s Little Theorem.
The modulus in the Fermat’s Theorem is a prime; the modulus of in Euler is an integer.
Two versions of Euler’s Theorem were introduced :

• The first version is similar to that of the first version of Fermat’s little theorem. If α
and n are co-prime, the αφ(n) = 1 mod n

• The second removes the condition that α and n should be co-prime. If n = p ∗ q


, α < n and k an integer, then αkx φ(n)+1 = α mod n. The second version of Euler’s
theorem is used in the RSA algorithm.

1.5.10 Authentication
Often one of the most important parts of a message is the signature. A person’s signature
let’s the recipient know that the message really is from the person whose name is typed
below. If the the message is particularly important, or the sender wished to make his
signature harder to use, it might be necessary to use additional methods to autheticate
the communication.
Most especially in electronic communication, where one does not have aphysical sig-
natiure, one has to rely on other methods. For example, User A (say John) who stays
in a distant location, and wishes to wire funds through an electronic channel, it is im-
possible to put a signature on the computer, instead he might need to create a password
(a secret key). Hence, when he needs to transfer funds, he simply supplies the secret key
that the banks knows and no other third-party (imposter) would likely know and viola!
money is wired.

1.5.11 Number Theory


The branch of mathematics that deals with the properties and relationship of numbers,
especially the positive integers.

1.5.12 Prime Number


A prime number is a natural number greater than 1 whose only positive factors are itself
and 1.

9
Chapter 2

Literature Review

There are huge amounts of contributions by researchers in the field of Number Theory
and public key cryptography. Some of these contributions are explained in this chapter.

Ron Rivest, Adi Shamir, and Leonard Adleman (1978) introduced a cryptographic
algorithm, which was essentially to replace the less secure National Bureau of Standards
(NBS) algorithm. Most importantly, RSA implements a public-key cryptosystem, as well
as digital signatures. RSA is motivated by the published works of Diffie and Hellman
from several years before, who described the idea of such an algorithm, but never truly
developed it.

Kefa Rabah (2006) in his paper “Reviewed of methods for integer factorization applied
to cryptography” In this study, hel outlined some useful and recent integer factorization
algorithms, including the Elliptic Curve Algorithm (ECM), Quadratic Sieve (QS), Number
Field Sieve (NFS).

Betty Huang (2010) presented “The Analysis of RSA Encryption Algorithm” , In


summary, the core aspect of the security of the RSA is that factorization is difficult, or
expensive. The project aimed to research and compare the various factorization methods
required by RSA encryption algorithm.

Ying Shi, and Shuang Zhang (2012) in the paper ”A method on safe data transmission
with lossless compression”, they proposed a method on safe data transmission for the
embedded system, which is convenient and of high computational efficiency. This method
not only removes the redundancy by re-encoding, but also encrypts the frame by Rivest
- Shamir - Adleman (RSA) algorithm after scrambling it with a random matrix. The
experimental results show a good security of data transmission and a certain compression
effect. Due to the slow variance in the collected data of embedded system and the existence
of large historical data redundancy, the method mentioned above is more suitable for the
embedded system than the conventional methods.
In the paper “Improved RSA cryptosystem based on the study of number theory and
public key cryptosystem”, Israt Jahan, Mohammad Asif and Liton Jude Rozario (2015)
proposed an improved approach of RSA algorithm using two public key pairs and using
some mathematics logic rather than sending one public key directly.

Juliet N. Gaithuru, Majid Bakhtiari, Alwuhayd M. Muteb and Mazleena Salleh (2015)
provided a description of their encryption and decryption operations, points out their
security basis, areas of implementation, their strengths and weaknesses during operation.
Finally, the paper pinpoints the existing gaps based on the conclusions drawn from the

10
review, with particular emphasis on an algorithm most suited for industrial application
given the current trends in cryptography towards quantum computing. This papers then
narrows down on the earnest need for an algorithm that has no trade-off in encryption
and decryption speeds, has low computation overhead and is secure enough to withstand
quantum algorithm attacks.

Shireen Nisha and Mohammed Farik (2017) in the paper “RSA Public Key Cryptog-
raphy Algorithm” reviewed RSA, examined its strengths and weaknesses, and propose
novel solutions to overcome the weakness. RSA (Rivest, Shamir, and Adleman) is one of
the best cryptographic algorithms in use today that ensures secure communication over
networks.

11
Chapter 3

Methodology

Certain concepts and results of RSA computations existing in the literature review can be
achieved using some mathematical formalism in Number Theory.

3.1 Divisibility
Let b be an integral divisor or factor of b is an integral a such that b = ac for some integer c.
b is also said to be divisible by a or an integral multiple of a. We write a|b if a divides b. If
a|b and 0 < a < b, then a is called ”proper divisor o f b”. For example, a|0 f or all a ∈ Z, a , 0.

3.1.1 Divisibility Algorithm


For any a and b with b > 0 , there exist unique integers q and r such that a = bq + r, 0 ≤ r ≤ b
proo f
Consider the set S = {a − xb|x ∈ Z and a − xb ≥ 0} , it suffices to exibit a value of x, making
a − xb non-negative. Since the integer b ≥ 1, then

|a|b ≥ |a|
and so,
a − (−|a|) b = a + |a| b ≥ a + |a| ≥ 0
Hence, for the choice X = −|a|, a − xb will lie in S. This paves the way for an application
of well ordering principle. It infers that the set S contains a smallest integer, say r. By the
definition of S, there exist an integer q satisfying r = a − qb, 0 ≤ r and with the notion that
r < b. If this were not the case, then r ≥ b and

a − (q + 1) b = (a − qb) − b = r − b ≥ 0

The implication is that


a − (q + 1) ∈ S
but,
a − (q + 1) b = r − b < r,
leading to a contradiction of the choice of the smallest member of S. Hence, the uniqueness
of q and r is proved as follows :
Suppose that a has two representations of the desired form; say

a = bq + r = bq′ + r

12
where 0 ≤ r ≤ b, 0 ≤ r′ ≤ b. Then r′ − r = b(q − q′ ) and for the fact the absolute value of a
product is equivalent to the product of the absolute values,

|r′ − r| = b |q − q′ |.

On adding the two inequalities −b < −r ≤ 0 and 0 ≤ r′ < b, then −b < r < b or equivalently,
|r′ − r| < b, thus b |q − q′ | < 1, Since |q − q′ | is a non-negative integer, the only possibility is
that |q − q′ | = 0. Hence q = q′ . This in turn gives r = r′ . The restriction that b be positive
integer is replaced by b , 0 following corollary is obtained.

3.1.2 Corollary:
If a and b are integers, with b , 0, then there exist unique integers q and r such that

a = qb + r, 0 ≤ r ≤ |b|

proo f : If it is enough to consider the case where b is negative, Then |b| > 0 and the theorem
produces unique integers q′ and r for which

a = q′ |b| + r, 0 ≤ r ≤ |b|

Since |b| = −b, take q = −q′ to arrive at a = qb + r, with 0 ≤ r ≤ |b|.

3.1.3 Theorem (Algorithm For Computing The G.C.D Of Two Integers)


Let a, b, q, r be into integers satisfying the hypothesis that a − bq + r, 0 ≤ r < b. If either (a, b)
or (b, r) exists, then so does the other and they are equal.

proo f

Now suppose that a, b are two non-zero integers and q, r the unique integers such that

a = bq + r, 0 ≤ r < b

Then (a, b) = (b, r), so either r | b or r ∤ b, we should have the following

a = bq + r, 0 ≤ r < b

b = rq1 + r1 , 0 ≤ r1 < r
r = r1 q2 + r2 , 0 ≤ r2 < r1
r1 = r2 q3 + r3 , 0 ≤ r3 < r2
..
.
rk−2 = rk−1 qk + rk , 0 ≤ rk < rk−1
rk−1 = rk qk+1 + 0
Since one of the following ri must be zero after a finite number of steps, since ri ’s are
steadily deceasing non-negative integers. Hence (a, b) = (b, r) = (r, r) = . . . = (rk−1 , rk ) = rk
is the g.c.d of a and b.

13
3.2 Theorem (Euler’s Totient Function) Φ(n)
The number of positive integers less than n and relatively prime to n
• Φ(n) = 1

• For prime p, Φ(n) = p−1

• For a, relatively prime to b and n = ab,

Φ(n) = (Φ(a))(Φ(b))

• For different primes p and q and n = pq

Φ(n) = (p − 1) ∗ (q − 1)

3.2.1 Theorem (Euler’s Theorem 1)


For every a and n that are relatively prime

aΦ(n) ≡ 1(modn)

Example : 3 and 5 are relatively prime, 34 mod 5 = 1

3.2.2 Theorem (Euler’s Theorem 2)


For positive integers a and n
aΦ(n)+1 ≡ 1(modn)
Example: 97121 mod143
Φ(143) = Φ(13) ∗ Φ(11) = 120
97120+1 mod143 = 97
Note : To do this, the problem must hold the form of euler’s theorem.

3.2.3 Theorem(Fermat’s Little Theorem 1)


If p is prime and a is a positive integer not divisible by p, then,

ap−1 ≡ a mod(p)

3.2.4 Theorem(Fermat’s Little Theorem 2)


If p is prime and a is a positive integer, then

ap ≡ a mod(p)

proo f The proof is by induction on a. If a = 1, then ap = 1p = 1 = a. So the result holds for


a = 1. Assume that
kp ≡ k mod(p)
and consider
(k + 1)p
Hence, by induction assumption, we obtain

(k + 1)p ≡ k + 1 (modP)

By the principle of induction, it follows that ap ≡ a (modp), for every positive integer a.

14
3.3 Congruence Class
Let n be a positive integer, and let a be an integer. The congruence class of a modulo n
denoted by [a], is the set of all integers that are congruent to a modulo n. That is,

[a] = {b ∈ Z : b ≡ a (modn)}

= {b ∈ Z : b = a + kn, f or some k ∈ Z}

3.3.1 Theorem 1
a ≡ b (mod n) iff [a] = [b].
proo f Assume a ≡ b (mod n). Let c ∈ [a]. Then c ≡ a (mod n). By transitivity, we have
c ≡ b(mod n). Thus c ∈ [b], and so, we have shown that [a] ⊆ [b]. In the same way, it can
be shown that [b] ⊆ [a]. Hence, [a] = [b].

Conversely, assume [a] = [b]. By reflexivity, we have a ≡ a (mod n), and therefore,
a ∈ [a] = [b]. Hence, a ≡ b (mod n)

3.3.2 Logarithms in Modular Arithmetic


Logarithm in ordinary arithmetic, we say

b = ai

i = loga (b)
In modular arithmetic, it is known as discrete logarithm

b = ai (mod p)

i = dloga,p (b)
A unique exponent i can be found if a is a primitive root of prime p.

3.4 RSA Algorithm


The working of RSA can be explained in 3 stages:

3.4.1 Phase 1 (Public and Private Keys Generation)


• Begin by selecting two prime numbers p and q (of the order of a few hundred bits).

• Compute their product n which is the modulus for encryption and decrption.

• Next, we need the quantity, Φ(n) referred to as Euler totient of n. Compute the Euler
totient function Φ(n) = (p − 1)(q − 1).

• Choose a large random number D(D > 1 such that (D; Φ(n)) = 1 (i.e, D and Φ(n) are
relatively prime).

3.4.2 Phase 2 (Encryption)


Choose an integer E with 1 < E < Φ(n) such that (E; Φ(n)) = 1. (i.e E and Φ(n) are relatively
prime).

15
3.4.3 Phase 2 (Decryption)
Find the integer D with 1 < D < Φ(n) such that D ∗ E = 1(modn)

3.5 RSA Set-Up


To begin, we must associate each letter of the alphabet with a unique number. This will
allow us to convert our message into series of numbers which we can perform operations
on. Let us use the following for this,

CODE
LETTER NUMBER LETTER NUMBER
A 00 N 13
B 01 O 14
C 02 P 15
D 03 Q 16
E 04 R 17
F 05 S 18
G 06 T 19
H 07 U 20
I 08 V 21
J 09 W 22
K 10 X 23
L 11 Y 24
M 12 Z 25
- 26

One would observe that instead of letting A = 0, we equated it to 00. This is because
once we got up to K, we started using double digits. If we have a mix of single digits and
double digits, it would be impossible to convert back to our original message. Also, it
is useful to denote spaces in between words with a number. To this effect, we will use a
”dash” between words instead of space to make it clearer.

3.5.1 RSA: How To Encrypt and Decrypt


Step 1 :
Choose two prime numbers, say p and q

p = 3 and q = 11

Step 2 :
Let n = p ∗ q
n = 3 ∗ 11 = 33

Step 3 :
Let Φ(n) = (p − 1)(q − 1)
Φ(n) = 2 ∗ 10 = 20

Step 4 : Choose an integer E with 1 < E < Φ(n) such that gcd(Φ(n), E) = 1. We have several
choices for E but we’ll pick 7 for simplicity

E = {7, 11, 13, 17, 19}

16
Step 5 :
So, the number n = 33, and k = 7 becomes the public key.

Step 6 :
To decrypt , we choose a decryption key D such that

D = E ∗ D mod Φ(n) = 1

= E ∗ D = 1 (mod Φ(n))
7d mod 20 = 1
d=3

17
Chapter 4

Analysis and Results

Here, some applications are presented:

4.1 Application 1
The number n and E are the public key; they can be shared with anyone. The number D
is the private keyl it must be kept secret.
Blessing (User A) wants to receive a secret message from John (User B). She sends him
the value of n and E. It doesn’y matter if this message is intercepted by an eavedropper;
the value of n and E can be made public. Only Blessing (User A) must know the value of
D.
Suppose the message John (User B) want to send Blessing is ”HELP”. For simplicity, we
suppose the letters H, E, L, and P were assigned the numbers 2, 3, 4, and 5.

Message = H E L P = 2 3 4 5

To encrypt the message ”HELP”, we apply the encryption formula, Ci = Me mod n, where,

C1 = 27 mod 33 = 29

C2 = 37 mod 33 = 9
C3 = 47 mod 33 = 16
C4 = 57 mod 33 = 14

Hence, the encrypted message to be sent is 29 9 16 14.


The method of decryption is similar, but we use D instead of E.

M = Cd mod n

M1 = 293 mod 33 = 2
M2 = 93 mod 33 = 3
M3 = 163 mod 33 = 4
M4 = 143 mod 33 = 5

18
4.2 Application 2 (Communication Between A Browser And A
Server
A browser wants to send Message = 14 to the server, using the key generation method.
Here is the mathematical formalism the browser executes :

Ciphertext = Message ∗ mod n

After plugging in the values, this equation is solved as follows

147 = E(mod 33)

105413504 / 33 = 3194348.606
3194348 ∗ 33 = 10541348
E = 105413504–10541348
E = 20
Encrypted message = 20 will be sent to the server. Here is the decryption algorithm the
server executes to recover the original plain text message which the browser started with
:
Message = Ciphertextd mod n
After plugging in the values

= 203 mod 3 = 8000 mod 33

= 14 (Message)

19
Chapter 5

Summary, Conclusion, and


Recommendation

5.1 Summary
Number theory may be one of the “purest” branches of mathematics, but it has turned out
to be one of the most useful when it comes to computer security. This project is a study
application of some aspects of number theory and the RSA public key cryptosystems .

5.2 Conclusion
RSA is a strong encryption algorithm that has stood a partial test of time. RSA implements
a public-key cryptosystem that allows secure communications and “digital signatures”,
and its security rests in part on the difficulty of factoring large numbers. The authors
urged anyone to attempt to break their code, whether by factorization techniques or
otherwise, and nobody till date seems to have succeeded. This has in effect certified RSA,
and will continue to assure its security for as long as it stands the test of time against such
break-ins.

5.3 Recommendation
To improve the findings of this work, I recommend that further research should be carried
out and the topic should be adopted and taught to undergraduates in mathematics as it
would reveal the applications of mathematics and increase there interest in cyber security.

20
Bibliography

[1] M.C Obi, “Group Theory, An introductory Approach” p.86

[2] Wikipedia, ”Wikipedia, 29 March 2017. [Online]. Available:


http://www.wikipedia.org/wiki/RSA

[3] RSA Laboratories, [Frequently Asked Questions About Today’s Cryptography(version3.0)].


http://www.rsa.com/rsalabs/newfaq/

[4] Pooja, “A Review Paper on Cryptography for Data Security”

21

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