Jacobs
Jacobs
JASON JACOBS
Contents
1. Introduction 1
2. Number Theory Background 1
2.1. Basic Principles 1
2.2. Definitions and Theorems to Know 2
3. RSA Encryption 4
3.1. Background 4
3.2. Attacks 6
4. Diffie-Helman Key Exchange 7
4.1. Background 7
4.2. Attacks 9
5. Conclusion 9
5.1. Final Notes 9
6. Acknowledgments 10
References 10
1. Introduction
Sending messages in secret has been necessary for thousands of years. If two
parties want to communicate without a third party knowing what they are saying,
they must correspond in a fashion that the third party couldn’t understand even
if they saw the message. For example, if ally military leaders want to discuss
key battle tactics, they cannot risk their foes intercepting and understanding their
messages. This overall idea gave rise to the concept of cryptography. Individuals
were enlisted to create ciphers in order to encrypt messages. One famous historical
technique is the Caesar Cipher, a primitive method of encryption named after Julius
Caesar. This is an example of a shift cipher, as its idea is to replace each letter
with a different letter by shifting the alphabet a specific number of places (e.g.
“at” becomes “bu” if the alphabet is shifted by 1). If this was used for the English
alphabet, obviously any number but a multiple of 26 would work (as this would
shift a letter back to itself). However, since there are only 25 possible ways to shift
the alphabet, this was easily broken by codebreakers. Even though more complex
ciphers of the same sort are possible, they are often easily broken by frequency
analysis, a technique that uses the frequency of letters in words and attempts to
match the most common symbols of the encrypted text to the most common letters
in the alphabet (e.g. a circle is the most common symbol in the intercepted message
and e is the most common letter in the English alphabet, therefore there is a solid
chance that the circle represents e).
Following this process, there has been a race between codemakers and codebreak-
ers for many years. One wants to construct an indecipherable code, and the other
will keep attempting to crack the cipher. As math advances, so do the different
techniques used to construct ciphers. Overall, this paper will demonstrate that
number theory is a crucial component of cryptography by allowing a coherent way
of encrypting a message that is also challenging to decrypt. The discussion in this
paper follows the set of notes [1] [2] [3] by Evan Dummit.
2.1.1. Divisibility and Prime Numbers. Prime numbers are an elementary part of
number theory that all readers must understand. First, consider all positive integers
besides 1, e.g. 2, 3, 4, etc. We can divide these numbers into two types: prime
numbers and composite numbers. However, prior to going into the definition, we
first need to explain the statement “a divides b.”
Definition 2.1. For any two integers, we say that “a divides b” or “a|b” if b is
divisible by a. In other words, a divides b if b = ac for some integer c.
Example 2.2. 4 | 12, since 12 = 4(3).
Example 2.3. 8 | 56, since 56 = 8(7).
Now, we can explore the idea of prime numbers and composite numbers.
2 JASON JACOBS
Definition 2.4. An integer n ≥ 2 is prime if the only positive integers that divide
n are 1 and n.
Definition 2.5. An integer n is composite if more than two positive integers divide
n.
To clarify, every positive integer besides 1 is either prime or composite, as it will
always be divisible by at least 1 and itself.
2.1.2. Modular Arithmetic. We will next discuss a part of number theory that
has played a role in a vast array of ciphers: modular arithmetic. To understand
modular arithmetic, picture a clock. The maximum number is 12, and no number
is larger than that. If one were to reference 5 hours after 12, they would not be
referencing 17, as there is no 17 on the clock. They would be talking about 5. This
is the idea of modular arithmetic, and this is what we will call “modulo 12.”
We define modular arithmetic formally as follows:
Definition 2.6. We say that a ≡ b (mod m) if m divides a − b.
In arithmetic modulo (or “mod”) 12, all numbers are equivalent to some number
in the ranges 0-11 or 1-12. If we were speak about 20 hours after 6, we would not
be referring to 26, but instead be talking about 2. To reduce a large number to a
smaller number modulo 12, we repeatedly subtract 12 from that number until we
arrive at a number between 0 and 11. [1]
Additionally, the following are some (but not all) arithmetic rules which still
apply:
If a ≡ c (mod n) and b ≡ d (mod n), then a + b = c + d (mod n) and ab = cd
(mod n).
Example 2.7. (1) 10 is congruent to 2 modulo 4, because 10 − 2 = 8, which
is a multiple of 4.
2.2.1. Definitions and Theorems. We should also express the following definitions
and theorems before we begin to discuss cryptography.
Definition 2.8. Two positive integers a and b are relatively prime if there does
not exist a positive integer c greater than 1 such that c|a and c|b.
NUMBER THEORY IN CRYPTOGRAPHY 3
3. RSA Encryption
3.1. Background.
3.1.1. Terms to Know.
We are about to discuss one of the most popular and well-known cryptosystems:
RSA encryption (this acronym originates from the last names of its creators). This
is a method of encryption that originated in 1977 and is still used today. For ex-
ample, RSA is used for digital signatures on documents [4]. Before explaining RSA
encryption, we first need to establish a few terms that are necessary to understand.
(1) Cryptosystem: A cryptosystem is a general term that describes the entire
process for encrypting and decrypting a message.
(2) Key: This is a “string of bits used by a cryptographic algorithm to trans-
form plain text into cipher text or vice versa” [5]. For instance, if we were
to use a Caesar Cipher and shift all letters over 3 places in the alphabet,
our key would be the number 3.
(3) Alice, Bob, and Eve: The names of three hypothetical individuals used to
describe a situation involving a cryptosystem. Alice and Bob want to com-
municate in private, and Eve desires to intercept their message. Sometimes
the name Carol is also used if we depict a situation where three parties
want to communicate secretly.
(4) Asymmetric versus Symmetric Cryptosystems: Asymmetric, or Public-Key,
cryptography is when the key is not kept secret. Symmetric cryptography
is when the same key is used for encryption and decryption and therefore
should only be known by Alice and Bob. For instance, if Alice and Bob were
to use a Caesar Cipher, that is an example of Symmetric cryptography, as
if Eve knows the key, she will be able to decrypt any message that Alice
and Bob send to one another.
3.1.2. Introduction to RSA Encryption.
We are finally ready to proceed with learning about RSA Encryption. If Alice
wants to send a secure message to Bob under RSA Encryption, they proceed as in
[2]:
NUMBER THEORY IN CRYPTOGRAPHY 5
3.1.3. Proof that RSA works. We need to prove that m ≡ cd (mod N ). Remember
that m is the secret message, c ≡ me (mod N ), d is the inverse of e modulo ϕ(N ),
and N = pq (where p and q are two prime numbers). Additionally, remember that
d exists because e is relatively prime to ϕ(N ).
We want to show that m ≡ cd (mod p) and m ≡ cd (mod q), since this will let us
apply the Chinese Remainder Theorem to guarantee that m ≡ cd (mod N ). Keep
in mind that the other condition for the Chinese Remainder Theorem to apply is
met: p and q are relatively prime because they are prime numbers. Therefore, p
only has 1 and p as its divisors, and q only has 1 and q as its divisors. Thus, the
only number that divides both p and q is 1, and therefore they are relatively prime.
We are only going to show the p case for the sake of brevity, as the q case is
virtually identical (one just has to replace the “p”s with “q”s).
It’s time to simplify some terms so we can see if the RSA decryption process
works. First, we will examine cd mod p.
We know that c ≡ me (mod p). Therefore,
RSA key. Some RSA keys are of that length, but many are multiple times more
than 1048 bits and thus impossible to factor at the moment. [2]
We will now proceed with showing how Diffie-Helman Key Exchange works. Here
is the process as articulated by [3], which is fairly straightforward yet extremely
effective:
(1) Alice and Bob publicly agree on two values: a prime number, p, and g, a
primitive root modulo p.
(2) Alice privately picks an integer a.
(3) Bob privately picks an integer b.
(4) Alice computes g a mod p.
(5) Bob computes g b mod p.
(6) The two publicly send their results to each other.
(7) Alice and Bob determine the key by taking g ab mod p, which just entails
raising the number they received from the other to the power of their indi-
vidual number (a for Alice, b for Bob).
Another useful property of Diffie-Helman Key Exchange is that it can include
more than two parties. For instance, assume that Alice and Bob want to include
Carol. The process is quite similar to the two-person process:
(1) Alice, Bob, and Carol publicly agree on two values: p and g. Again, p is a
prime number, and g is a primitive root modulo p.
(2) Alice privately picks an integer a.
(3) Bob privately picks an integer b.
(4) Carol privately picks an integer c.
(5) Alice computes g a mod p.
(6) Bob computes g b mod p.
(7) Carol computes g c mod p.
(8) All of these results are made public.
(9) Alice computes g ab mod p.
(10) Alice computes g ac mod p.
(11) Bob computes g bc mod p.
(12) All of these numbers are made public.
(13) Alice determines the key by taking g bc mod p and raising it to the power
of a.
(14) Bob determines the key by taking g ac mod p and raising it to the power of
b.
(15) Carol determines the key by taking g ab mod p and raising it to the power
of c.
4.1.3. Proof that Diffie-Helman Works. This proof is quite easy. Suppose that
there are m people and person n (where n ≤ m) needs to find the key. They have
received g a1 a2 ...an−1 an+1 ...am , and raising that number to the power of an will yield
g a1 a2 ...an−1 an an+1 ...am (which they reduce mod p) and therefore the secret key. This
is considered to be a secure form of encryption, as a and b are kept private and
figuring them out is extremely challenging.
4.2. Attacks.
4.2.1. General. Again, recall the information that Eve possesses. She has all of the
public values, which includes g, g a , g b , g ab , etc. She needs to determine the value
of g abc... to obtain the key. [3]
5. Conclusion
5.1. Final Notes. As a whole, number theory and cryptography are closely re-
lated. As number theory has advanced, so has the security of cryptosystems. In
this paper, we examined two techniques that are well-known and important in the
field of cryptography. Both RSA encryption and Diffie-Helman Key Exchange are
still used and the former is extraordinarily popular, but they are relatively old. In
this field, the rapid development of technology means that constant attacks are be-
ing staged on cryptosystems. As a result, cryptologists are looking for new ideas to
deliver secret messages. One more modern example is elliptic curve cryptography,
which has a similar premise to RSA and Diffie-Helman. The idea is that these are
all probably solvable with powerful enough technology and infinite time, but they
are virtually impossible to solve in any reasonable amount of time with our current
technology. Elliptic curve cryptography centers around the idea that calculating
discrete logarithms on elliptic curves is very difficult with modern technology, and
thus it is extremely interesting for the future of cryptography. Long-term, cryp-
tologists are considering post-quantum methods of encrypting messages. Since the
advent of quantum computers may spell doom for modern cryptosystems, cryptol-
ogists need to find new techniques. It is unclear exactly how this will work, but
it is certain that math will be crucial. Nonetheless, cryptography is a fascinating
field and the main way in which number theory has proven to be extremely useful
10 JASON JACOBS
outside of inherent academic purposes. Technology will continue to advance and at-
tack complex mathematical problems, but mathematicians will continue to explore
the outer reaches of their field and invent new ways of encoding messages.
6. Acknowledgments
I would like to thank my brother, parents, and grandparents for always being
there for me and being the main reasons why I was fortunate enough to receive
the opportunity to attend the University of Chicago and its Mathematics REU.
Additionally, I would like to thank Sam Quinn for being an excellent mentor. This
paper would not be nearly what it is without his guidance, and I sincerely appreciate
all that he has done to enrich my REU experience. Lastly, I would like to thank
Professor May for hosting the REU and ensuring that it is a great program.
References
[1] Evan Dummit. Cryptography (part 1): Classical Cryptosystems and Modular Arithmetic.
Northeastern University, 2016. Located online at: https://web.northeastern.edu/dummit/
docs/cryptography_1_classical_cryptosystems.pdf.
[2] Evan Dummit. Cryptography (part 2): Public-Key Cryptography. Northeastern Univer-
sity, 2016. Located online at: https://web.northeastern.edu/dummit/docs/cryptography_
2_public_key_cryptography.pdf.
[3] Evan Dummit. Cryptography (part 3): Discrete Logarithms in Cryptography Northeast-
ern University, 2016. Located online at: https://web.northeastern.edu/dummit/docs/
cryptography_3_discrete_logarithms_in_cryptography.pdf.
[4] Kenneth Levasseur. Digital Signatures using RSA. University of Massachusetts Lowell,
2013. Located online at: https://faculty.uml.edu//klevasseur/math/RSA_Signatures/RSA_
Signatures.pdf.
[5] Cryptographic Key. techopedia. Located online at: https://www.techopedia.com/
definition/24749/cryptographic-key.
[6] How to generate Large Prime numbers for RSA Algorithm. Geeks-
forGeeks. Located online at: https://www.geeksforgeeks.org/
how-to-generate-large-prime-numbers-for-rsa-algorithm/.
[7] Israel Koren. Fault-Tolerant Systems, 2nd Edition. University of Massachusetts Amherst,
2020. Located online at: http://www.ecs.umass.edu/ece/koren/FaultTolerantSystems/
simulator/RSA/new_page_5.htm.