Number Theory in Cryptography
Number Theory in Cryptography
Article
Department of Science, Technology and Engineering, Rajarshi Janak University Janakpurdham, Nepal
* Correspondence: [email protected]
Abstract: Technology has transformed the way we access and store information, making data
retrieval fast and efficient. However, safeguarding this information is critical to prevent
unauthorized access. Cryptography, rooted in number theory, plays a vital role in data protection
by enabling encryption and decryption processes. This study aims to explore various cryptographic
algorithms, examining their mechanisms and effectiveness in securing data. Through a
comprehensive review of literature from books, journals, and other sources, this research will
provide insights into the strengths and weaknesses of different cryptographic methods. The
findings will contribute to enhancing data security practices in the digital age.
1. Introduction
Information plays an important role in our lives It helps us make choices. We can get
information in different ways — like trying out ourselves, talking friends, or reading letters
& news articles. Just remember, when you share personal opinions, it's good to say they
are opinions! Today’s tech world makes it way easier to find information. You can grab it
quickly from the internet, watch videos, or check other sources. Also, tech lets us save a lot
Citation: Rahul Das, Ashok
of stuff that’s hard to remember or really important. But we have to be careful. Keeping
Kumar Mahato, Suresh Kumar
Sahani. Study on Computer private info safe is super important so no one else can sneak a peek at it. Tech developers
Applications of Number Theory in work hard to find better ways to protect our information [1].
Cryptography. Central Asian
Journal of Mathematical Theory They look for solutions until they discover something that can help process or change
and Computer Sciences 2024, 5(3),
data; this is known as cryptography! It uses something called Number Theory — a bit of
320-328.
math magic! An exciting paper is in the works titled "Application of Number Theory in
Received: 27th July 2024
Revised: 27th August 2024 Cryptography for Data Security." This paper will show how number theory can help keep
Accepted: 3th Sept 2024 our data safe in fun ways. Math is essential in life, and number theory is a big part of it!
Published: 10th Sept 2024
This area of math is useful all over the place in everyday life. Even though technology
moves fast and has its perks, we should also keep an eye on its downsides [2].
Copyright: © 2024 by the authors. Tech usually aims to make things easier & quicker for us. But if someone uses tech
Submitted for open access for bad reasons, it could lead to trouble. Cybercrime is a sneaky kind of crime that happens
publication under the terms and
conditions of the Creative
especially often with technology. Hacking into important data has become more common
Commons Attribution (CC BY) and makes many people uneasy when using tech tools. That’s why a system was created!
license
Cryptography helps fight back against cybercrime by turning information into tricky codes
(https://creativecommons.org/lice
nses/by/4.0/)
Central Asian Journal of Medical and Natural Science 2024, 5(3), 320-328. https://cajmtcs.centralasianstudies.org/index.php/CAJMTCS
321
that are really tough for anyone who shouldn’t see them to read. So, we can stay safer
while enjoying all the neat things technology offers!
Central Asian Journal of Medical and Natural Science 2024, 5(3), 320-328. https://cajmtcs.centralasianstudies.org/index.php/CAJMTCS
322
Now, congruency is another term in number theory [6]. Let's say we have integers 𝑎
and 𝑏. If they satisfy the rule where m > 0, then we can say that a ≡ b (mod m) if m divides
(a - b). If they aren’t congruent under modulus m, then we write it as,
a ≢ b (mod m)
Now let’s talk about the Euclidean algorithm—it’s famous for finding the greatest
common divisor of two integers [7]. Euclid came up with it long back, and he was this
clever Greek mathematician. The trick involves repeating the division algorithm over &
over.
To find GCD using the Euclidean Algorithm:
1. First off: when n equals zero, then guess what? GCD(m, n) = m, But if n isn't
zero yet? You move on to step 2.
2. You’ll divide m by n & remember that r is your remainder.
3. Now swap things around: take n for your new m and r for your new n; head
back to step 1.
Just to illustrate this—let's say r0 = m and r1 = n then you'd see how it works:
r0 = r1 * q1 + r2 , with restrictions on r2 like: 0 ≤ r2 < r1
r1 = 𝑟2 . 𝑞2 + 𝑟3 , 0 ≤ 𝑟3 < 𝑟2
⋮
rn-1 = 𝑟n-1 . 𝑞n-1 + 𝑟n , 0 ≤ 𝑟n < 𝑟n-1
n = 𝑟n . 𝑞n + 0
So you get:
GCD(m, n) = GCD(𝑟0, 𝑟1) = GCD(𝑟1, 𝑟2) = … GCD(𝑟n-1, 𝑟n) = GCD(𝑟n, 0) = 𝑟n
Example : m = 525, n = 231 dan dipenuhi syarat m * n
512 = 2 * 231 + 63
231 = 3 * 63 + 42
63 = 1 * 42 + 21
Central Asian Journal of Medical and Natural Science 2024, 5(3), 320-328. https://cajmtcs.centralasianstudies.org/index.php/CAJMTCS
323
42 = 2 * 21 + 0
So you get:
GCD(512, 231) = GCD(231, 63) = GCD(63, 42) = GCD(42, 21) = GCD(21, 0) = 21
The Euclidean algorithm is quite famous. It’s named after a Greekian named Euclid,
wrote about it in his book, Now, let’s talk about cryptography. It plays a super important
role in keeping information safe [8]. The word cryptography comes from two Greek words:
"cryptos meaning secret, & "graphein" which means writing. Basically, cryptography a
field that looks at math techniques to protect information. This includes things like
confidentiality (keeping info private), integrity (making sure data isn’t messed with), &
authentication (proving who sent the message). Schneier describes it as both the science
and art of keeping messages secure. So, it’s about ensuring that messages stay private, the
data remains intact, confirming who sent the info, & stopping denial from the sender.
In cryptography, there are lots of technical terms you’ll hear. Here’s a quick list of
common ones:
1. Information can be understood through both sight and sound.
2. The sender is the person or group sending out the message.
3. The recipient is the one who gets the message.
4. Ciphertext refers to messages that get coded to keep them safe from people
who shouldn’t read them.
5. Encryption is how we change regular text into ciphertext.
6. Decryption is when we turn ciphertext back into its original text.
7. Cipher refers to methods used for encoding & decoding messages.
8. Keys are special bits used in encryption and decryption.
9. During sending messages, there can be sneaky eavesdroppers trying to
intercept them.
10. Cryptoanalysis is all about cracking ciphertext back into regular text without
knowing the key—those doing this are called cryptanalysts. An Arab
scientist from the 9th century named Al-Kindi first suggested this idea.
11. Cryptology is simply the study of both cryptography & cryptoanalysis.
For thousands of years, cryptography has been part of our lives. Its roots go way
back — way before today’s tech became fancy and complicated! Ancient Egyptians were
using it around 4000 years ago with unique hieroglyphs to send messages on pyramid
walls [9].
Ancient civilizations like Egypt, Greece, Rome, & India their own ways of using
cryptography. The Greeks were pretty clever; came up with a tool called the scytale about
400 years before Christ! There's a book called Arab Origins of Cryptology, made by the
King Faisal Center in Saudi Arabia. It talks all about the Arab world's history with
cryptography [10]. This ancient skill helped people send secret messages. For example, in
the Kama Sutra, there’s advice for gals on how to get the hang of ciphers. Two types
mentioned are Kautiliyam & Mulavediy.
In Europe, folks also started using cryptography during the Renaissance—
particularly around the 15th and 16th centuries. A bunch of codes became super popular
back then:
1. The Vigenere Cipher kicked off in 1586, thanks to a French diplomat named
Blaise de Vigenere.
2. The Playfair Cipher was pushed by a British diplomat called Lord Playfair
but was originally invented by Charles Wheatstone way back in 1854.
But not everything about cryptography is great. It had a dark side too. In the 17th
century, Queen Mary of Scotland got caught because Thomas Phelippes—a code breaker—
figured out her secret message about taking down Queen Elizabeth I while she was stuck
in prison. Even during World War II, cryptography played a big role. The German Nazis
made a super-secret machine called Enigma [11]. Luckily, the Allies cracked that code!
Solving Enigma is often seen as one reason World War II didn't last forever. Cryptography
relies on algorithms that use number theory. There are lots of different cryptographic
Central Asian Journal of Medical and Natural Science 2024, 5(3), 320-328. https://cajmtcs.centralasianstudies.org/index.php/CAJMTCS
324
algorithms out there like RSA, Elgamal, Diffie-Hellman key exchange, and knapsack
algorithms. They can be split into three groups:
a. Symmetric Key Cryptography
b. Asymmetric Key Cryptography
c. Hash Function
Symmetric Key Cryptography (or Secret Key Cryptography): Is an old-school
method where you use one key to encrypt and decrypt stuff! This method's been around
for over 4,000 years. To read a message sent this way, you need that special key. So if you
know the key, you can encrypt or decrypt messages easily [12].
Algorithms that use symmetric keys include:
a. RC2, RC4, RC5, RC6
b. One Time Pad (OTP)
c. Data Encryption Standard (DES)
d. Advanced Encryption Standard (AES)
e. Data Encryption Algorithm (IDEA)
f. A5, & others
Asymmetric key cryptography: This fancy term means using different keys for
encryption & decryption. It's also known as public key cryptography. In this system, the
key is split into two parts:
1. Public key: This key is okay for everyone to know! It gets published so
anyone can use it.
2. Secret key (or private key): This one's kept under wraps. Only one person
knows it!
These two keys are connected in a special way. A public key can encrypt messages,
but here's the catch—you need the secret key to decrypt them. So, only the person with the
secret key can read the message. Asymmetric algorithms are generally seen as more secure
when sending messages compared to symmetric ones.
Algorithms that use of public keys include:
a. Digital Signature (DSA)
b. RSA
c. Diffie-Hellman (DH)
d. Elliptic Curve Cryptography (ECC)
e. Cryptography
Hash function: A hash function is a mathematical tool! It takes in input of any length
and turns it into a fixed-length binary sequence. This is often called a one-way function or
a message digest. Sometimes it’s also known as a compression function or a Message
Authentication Code (MAC). They act like a fingerprint for messages. Fingerprinting helps
us check if a message is real and it ensures that nobody has messed with it.
Some of the common hash function include:
a. MD5
b. SHA-1, SHA-2, SHA-3
c. MAC
RSA Algorithm: RSA is a very popular public-key algorithm It does a lot important
things, This first found by some smart folks: Rivest, Adi Shamir, and Adleman. Were
working at MIT in 1976 they figured it out, The name RSA comes the first letters of their
last names. So, what makes RSA safe? Well, it's all about figuring out large numbers. RSA's
security comes from the hard job of breaking down a big number (we’ll call it 𝑛) into two
smaller prime numbers (let's say 𝑝 and 𝑞). Here’s 𝑛 is made by multiplying 𝑝 and 𝑞
together! you can find another number using Ø(n) = (𝑝-1) × (𝑞-1). Now, if someone knows
the encryption key 𝑒—and that’s a big “if”—then they can find another key called the
decryption key 𝑑. This works through a special math rule:
e𝑑 ≡ 1 (𝑚𝑜𝑑(𝑛))
Central Asian Journal of Medical and Natural Science 2024, 5(3), 320-328. https://cajmtcs.centralasianstudies.org/index.php/CAJMTCS
325
The person who created RSA suggests that both 𝑝 and 𝑞 should be more than 100
digits long. Because then their product, which we call 𝑛 = 𝑝 × 𝑞, will have over 200 digits.
something important: The fastest ways to factor numbers are pretty complicated. If you
look at an integer like 𝑛 that has b bits—the truth is—no quick way to break down those
big numbers in polynomial time has been found yet. So right now, people still think RSA
is secure. Long story short, the bigger the number, the harder it is to factor.
Even though the RSA algorithm has some flaws, it's really popular. It not as quick as
other encryption methods like DES or AES. RSA used for sending secret messages directly
Instead, it helps to send a symmetric key (which is like a session key) using the recipient's
public key. The actual messages are encrypted using a symmetric method, like DES or AES.
So, both the message and the symmetric key go together when using RSA. The person
receiving them uses their private key to unlock the symmetric key first. After that, they can
easily decrypt the message with that key.
Example-1:
Example demonstrating the operation of the RSA cryptosystem with small values.
Assume that n = 143 and Ø(n) = 120 result from p = 11 and q = 13. Given that GCD(7,
120) = 1, we can select e = 7.
Since 7*103 = 1 (mod 120), we can compute d = 103 using the extended Euclidean
technique.
We have (143, 7) as our public key and (143, 103 ) as our private key.
Let's say we wish to encrypt the "HELLO" message.
Using ASCII encoding, we can translate this to the integer 726564766. We calculate
the ciphertext as c = 726564766^7 (mod 143) = 32 using the public key.
Using the private key, we can decrypt the ciphertext by computing the original
message, m = 32^103 (mod 143) = 726564766.
Example-2: If p = 7, q = 11, and e = 13 in the RSA algorithm, what will the value of d be?
Solution: Let p = 7, q = 11, and e = 13.
According to the RSA algorithm, Ø(n) = (7–1) × (11–1) = 6 × 10 = 60
Consequently, (e × d) mod Ø(n) = 1 (13 × d) mod 60 = 1 d = 37. Thus, key is 37.
Example-3: A participant in an RSA cryptosystem generates his public and private keys
using the prime numbers p = 3 and q = 11. How will the text computer be encrypted using
the public key if the private key is 7?
Solution: Given prime integers, n = 3 x 11 = 33, p = 3, and q = 11.
Ø(n) is equal to (3-1) × (11-1) = 2 x 10 = 20
In response to question d = 7, the greatest common divisor (20, d) = 1.
Mod Ø(n) = (e × d) = 1.
(e x 7) mod 20 = 1
Consequently, e x 7= 20 x 1+1
e = 217 = 3 is feasible.
Encrypt key: e = public key = 3
Thus, n = 33, e = 3, d = 7, and Ø(n) = 20.
Computer is the plan text. m mod n is the ciphertext.
For C = 33 mod 33 = 27, the ciphertext
For O = 153 mod 33 = 9, the ciphertext
Given prime integers, n = 3 x 11 = 33, p = 3, and q = 11.
Ø(n) is equal to (3-1) × (11-1) = 2 x 10 = 20
In response to question d = 7, the greatest common divisor (20, d) = 1.
Mod Ø(n) = (e × d) = 1.
(e x 7) mod 20 = 1
Consequently, e x 7= 20 x 1+1
Central Asian Journal of Medical and Natural Science 2024, 5(3), 320-328. https://cajmtcs.centralasianstudies.org/index.php/CAJMTCS
326
e = 217 = 3 is feasible.
Similarly,
For M = 133 mod 33 = 19, the ciphertext
For P = 163 mod 33 = 4, the ciphertext
For U = 213 mod 33 = 21, the ciphertext
For T = 203 mod 33 = 14, the ciphertext
For E = 53 mod 33 = 26, the ciphertext
For R = 183 mod 33 = 24, the ciphertext
The Elgamal algorithm: It was made by Taher Elgamal back in 1985 and first
appeared in a paper called “A public key cryptosystem and a signature scheme based on
discrete logarithms.” Its security comes from how tough it is to solve discrete logarithms.
You run into this problem when p is prime, and g & y are any integers, with x needing to
be found, looking something like this:
gx ≡ y (mod p)
Here’s how encryption works in the Elgamal algorithm:
1. Break the plaintext into blocks.
2. Pick a random number k that fits: 1 ≤ k ≤ p - 2.
3. Each block gets encrypted using this formula:
𝑎 = gk (mod p)
𝑏 = ykm (mod p)
The pair of values a & b represents the encrypted message block. This means that the
ciphertext is actually double the size of the plaintext. The decryption process includes the
following:
1. Use your private key x to calculate (ax)-1 ≡ ap-x-1.
2. Then calculate plaintext using this equation:
𝑚 = 𝑏 / (ax) (mod p), which is also written as 𝑚 = 𝑏(ax)-1 (mod p)
Diffie Hellman key Exchange Algorithm: Whitfield Diffie & Martin Hellman
created the Diffie-Hellman key exchange method. This algorithm allows two people to
share a secret key safely for encrypting messages with symmetric algorithms like DES and
AES. Just like Elgamal, it relies on how tricky it is to compute discrete logarithms for
security.
The AES Algorithm: It’s an encryption method that works with just one key for
both encryption and decryption—a symmetric approach! AES has three options for keys:
AES-128, AES-192, and AES-256, each round uses a different internal key called the round
key for each round process. For AES-128 specifically, there are ten rounds:
Central Asian Journal of Medical and Natural Science 2024, 5(3), 320-328. https://cajmtcs.centralasianstudies.org/index.php/CAJMTCS
327
4. Conclusion
Numerous mathematical applications, including cryptography methods, stem from
the field of number theory. The study of converting useful information into meaningless
information and vice versa is known as cryptography. It uses particular encryption
techniques or algorithms to keep messages private. Because it increases security and
prevents illegal data or information disclosure, cryptography is essential to technology.
Numerous cryptographic techniques, including the Diffie-Hellman key exchange,
Elgamal, RSA, and knapsack cryptographic algorithms, are based on number theory. Since
cryptography seeks to improve security and prevent unauthorized data or information
leakage, it is a useful tool in technology. For cryptography, there are many different
algorithms accessible. Depending on its intended usage, the best method should be chosen.
Central Asian Journal of Medical and Natural Science 2024, 5(3), 320-328. https://cajmtcs.centralasianstudies.org/index.php/CAJMTCS
328
REFERENCES
[1] [Online]. “ElGamal Encryption Algorithm,” GeeksforGeeks. Available:
https://www.geeksforgeeks.org/elgamal-encryption-algorithm/. Accessed: Dec. 12, 2022.
[2] Prayitno and N. Nurdin, “Analisa dan Implementasi Kriptografi pada Pesan Rahasia,” J. Elektron. Sist. Inf. dan
Komput., vol. 3, no. 1, pp. 1–11, 2017. [Online]. Available: [email protected].
[3] “AES - Advanced Encryption Standard,” Study Informatics, Jul. 2012. [Online]. Available:
http://studyinformatics.blogspot.com/2012/07/aes-advanced-encryption-standard.html. Accessed: Dec. 12, 2022.
[4] “Algoritma RSA,” KomputerKata, 2012. [Online]. Available: https://komputerkata.com/algoritma-rsa/.
Accessed: Dec. 12, 2022.
[5] D. Ariyus, Kriptografi: Keamanan Data dan Komunikasi. Yogyakarta: Graha Ilmu, 2006.
[6] I. M. A. Arrijal, R. Efendi, and B. Susilo, “Penerapan Algoritma Kriptografi Kunci Simetris dengan Modifikasi
Vigenere Cipher dalam Aplikasi Kriptografi Teks,” J. Pseudocode, vol. 3, no. 1, pp. 69–82, 2016. [Online].
Available: https://doi.org/10.33369/pseudocode.3.1.69-82.
[7] B. S. Hasugian, “Peranan Kriptografi Sebagai Keamanan Sistem Informasi pada Usaha Kecil dan Menengah,” J.
Chem. Inf. Model., vol. 53, no. 9, pp. 1689–1699, 2019. [Online]. Available:
https://doi.org/10.46576/wdw.v0i53.269.
[8] E. Endaryono, N. Dwitiyanti, and H. S. Setiawan, “Aplikasi Operasi Matriks pada Perancangan Simulasi Metode
Hill Cipher Menggunakan Microsoft Excel,” STRING, vol. 6, no. 1, pp. 1–9, Aug. 2021. [Online]. Available:
http://dx.doi.org/10.30998/string.v6i1.8603.
[9] A. M. T., B. Konseling, F. I. Pendidikan, and U. N. Surabaya, “Studi Kepustakaan Mengenai Landasan Teori dan
Praktik Konseling Expressive Writing,” J. BK UNESA, vol. 8, pp. 1–8, 2018. [Online]. Available:
https://ejournal.unesa.ac.id/index.php/jurnal-bk-unesa/article/view/22037.
[10] “What is Cryptography: Types, Tools and Its Algorithms,” Elprocus. [Online]. Available:
https://www.elprocus.com/cryptography-and-its-concepts/. Accessed: Dec. 11, 2022.
[11] “What Is Encryption?,” Cisco. [Online]. Available:
https://www.cisco.com/c/en/us/products/security/encryption-explained.html. Accessed: Dec. 11, 2022.
[12] W. Widaya, Modul Penyusunan Soal Keterampilan Berpikir Tingkat Tinggi (Higher Order Thinking Skills)
Matematika. Jakarta: Direktorat Pembinaan Sekolah Menengah Atas, 2018.
Central Asian Journal of Medical and Natural Science 2024, 5(3), 320-328. https://cajmtcs.centralasianstudies.org/index.php/CAJMTCS