This presentation contains the contents pertaining to the undergraduate course on Cryptography and Network Security (UITC203) at Sri Ramakrishna Institute of Technology. This covers the basic concepts of mathematics that are essential to work with cryptography.
2. Overview
• Divisibility
• Division Algorithm
• Modular Arithmetic
• Euclidean Algorithm
• Extended Euclidean Algorithm
• Groups, Rings and Fields
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 2
• Prime Numbers
• Relative Primality
• Fermat’s Theorem
• Euler Totient Function
• Euler’s Theorem
• Chinese Remainder Theorem
3. Divisibility
If 𝒂, 𝒃 ∈ ℤ, 𝒃 = 𝟎, then to say that 𝒃 divides 𝒂, denoted by 𝒃|𝒂,
means that 𝒂 = 𝒃𝒙 for a unique 𝒙 ∈ ℤ, denoted by 𝒙 = 𝒂/𝒃.
• The existence and uniqueness of 𝑥 implies that 𝑏 cannot be 0
• This can be stated as 𝑎 is divisible by 𝑏.
• If 𝑏 does not divide 𝑎, then we write 𝑏 ∤ 𝑎 and say that 𝑎 is not divisible by 𝑏.
• Division by zero is undefined.
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 3
4. Division Algorithm
If 𝒂 ∈ ℕ and 𝒃 ∈ ℤ, then there exist unique integers 𝒒, 𝒓 ∈ ℤ
with 𝟎 ≤ 𝒓 ≤ 𝒂, and 𝒃 = 𝒂𝒒 + 𝒓.
Proof:
Two parts
• Existence
• Uniqueness
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 4
5. Modular Arithmetic
Let 𝒏 ∈ ℕ and suppose that for any 𝒙 ∈ ℤ,
𝒙 denotes the congruence class of 𝒙 modulo 𝒏.
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 5
Congruence:
If 𝒏 ∈ ℕ, then we say that a is congruent to 𝒃 modulo 𝒏 if 𝒏 | (𝒂 − 𝒃), denoted by
𝒂 ≡ 𝒃 (𝒎𝒐𝒅 𝒏).
On the other hand, if 𝒏 ∤ (𝒂 − 𝒃), then we write
𝒂 ≢ 𝒃 (𝒎𝒐𝒅 𝒏)
and say that 𝒂 and 𝒃 are incongruent modulo 𝒏, or that 𝒂 is not congruent to 𝒃 modulo 𝒏. The
integer 𝒏 is the modulus of the congruence. The set of all integers that are congruent to a given
integer 𝒎 modulo 𝒏, denoted by 𝒎, is called the congruence class or residue class of 𝒎 modulo 𝒏.
Sometimes termed “clock arithmetic”
6. Euclidean Algorithm
Let 𝒂, 𝒃 ∈ ℤ (𝒂 ≥ 𝒃 > 𝟎), and set 𝒂 = 𝒓−𝟏, 𝒃 = 𝒓 𝟎. By repeatedly applying the Division
Algorithm, we get 𝒓𝒋−𝟏 = 𝒓𝒋 𝒒𝒋+𝟏 + 𝒓𝒋+𝟏 with 𝟎 < 𝒓𝒋+𝟏 < 𝒓𝒋 for all 𝟎 ≤ 𝒋 < 𝒏, where 𝒏 is the
least non-negative number such that 𝒓 𝒏+𝟏 = 𝟎, in which case 𝒈𝒄𝒅 𝒂, 𝒃 = 𝒓𝒏.
An equivalent definition: 𝒈𝒄𝒅 𝒂, 𝒃 = 𝒎𝒂𝒙 𝒌, 𝒔𝒖𝒄𝒉 𝒕𝒉𝒂𝒕 𝒌 𝒂 𝒂𝒏𝒅 𝒌 𝒃
A simpler form: Let 𝒂, 𝒃 > 𝟏 with 𝒃 ∤ 𝒂. Then,
gcd(𝒂, 𝒃) = gcd(𝒃, [𝒂 𝒎𝒐𝒅 𝒃])
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 6
The Euclidean algorithm GCD
Input: Integers 𝑎, 𝑏 with 𝑎 ≥ 𝑏 > 0
Output: The greatest common divisor
of 𝑎 and 𝑏
if 𝑏 𝑑𝑖𝑣𝑖𝑑𝑒𝑠 𝑎
return 𝑏
else
return 𝐺𝐶𝐷(𝑏, [𝑎 𝑚𝑜𝑑 𝑏])
7. Extended Euclidean Algorithm
Let 𝒂, 𝒃 ∈ ℕ, and let 𝒒𝒊 for 𝒊 = 𝟏, 𝟐, . . . , 𝒏 + 𝟏 be the quotients obtained from the application of the
Euclidean Algorithm to find 𝒈 = gcd(𝒂, 𝒃), where 𝒏 is the least non-negative integer such that 𝒓 𝒏+𝟏 =
𝟎. If 𝒔−𝟏 = 𝟏, 𝒔 𝟎 = 𝟎, and
𝒔𝒊 = 𝒔𝒊−𝟐 − 𝒒 𝒏−𝟏+𝟐 𝒔𝒊−𝟏,
for 𝒊 = 𝟏, 𝟐, . . . , 𝒏 + 𝟏, then
𝒈 = 𝒔 𝒏+𝟏 𝒂 + 𝒔 𝒏 𝒃.
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 7
The extended Euclidean algorithm eGCD
Input: Integers 𝑎, 𝑏 with 𝑎 ≥ 𝑏 > 0
Output: (𝑑, 𝑋, 𝑌) with 𝑑 = 𝑔𝑐𝑑(𝑎, 𝑏) and 𝑋 𝑎 + 𝑌𝑏 = 𝑑
if 𝑏 𝑑𝑖𝑣𝑖𝑑𝑒𝑠 𝑎
return (𝑏, 0, 1)
else
Compute integers 𝑞, 𝑟 with 𝑎 = 𝑞𝑏 + 𝑟 and 0 < 𝑟 < 𝑏
(𝑑, 𝑋, 𝑌) ∶= 𝑒𝐺𝐶𝐷(𝑏, 𝑟) /* note that 𝑋𝑏 + 𝑌𝑟 = 𝑑 */
return (𝑑, 𝑌, 𝑋 − 𝑌𝑞)
8. Groups, Rings and Fields
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 8
Image Source: Cryptography and Network Security: Principles and Practices, 6th Ed.
9. Prime Numbers
Why Prime numbers are prominently used in Cryptography?
Difficulty in determining the prime factors of a large number …
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 9
The Factoring Problem is the determination of the prime
factorization of a given 𝒏 ∈ ℕ guaranteed by The Fundamental
Theorem of Arithmetic. This theorem says that the primes in the
factorization of a given natural number 𝑛 are unique to 𝑛 up to
order of the factors. Thus, the prime numbers are the
fundamental building blocks of number theory.
10. Relative Primality
If 𝒂, 𝒃 ∈ 𝒁, and 𝒈𝒄𝒅(𝒂, 𝒃) = 𝟏, then 𝒂 and 𝒃 are said to be relatively prime or coprime.
Sometimes the phrase
𝒂 is prime to 𝒃
is also used.
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 10
11. Fermat’s Theorem
If 𝒑 is prime and 𝒂 is a positive integer not divisible by 𝒑, then
𝒂 𝒑−𝟏 ≡ 𝟏 (𝒎𝒐𝒅 𝒑)
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 11
12. Euler Totient Function
The Euler’s totient function, usually represented as 𝝓 𝒏 is defined as the number of
positive integers less than 𝒏 and relatively prime to 𝒏.
By convention, 𝝓 𝟏 = 𝟏.
In general, 𝝓 𝒏 = 𝒏 − 𝟏
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 12
13. Euler’s Theorem
For every 𝒂 and 𝒏 that are relatively prime:
𝒂 𝝓(𝒏)
≡ 𝟏(𝒎𝒐𝒅 𝒏)
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 13
14. Chinese Remainder Theorem
Discovered by the Chinese mathematician Sun Tse
Let 𝒏𝒊 ∈ ℕ for natural numbers 𝒊 ≤ 𝒌 ∈ ℕ be pairwise relatively prime, set
𝒏 =
𝒋=𝟏
𝒌
𝒏𝒋
and let 𝒓𝒊 ∈ ℤ for 𝒊 ≤ 𝒌. Then the system of 𝒌 simultaneous linear congruences given by
𝒙 ≡ 𝒓 𝟏 (𝒎𝒐𝒅 𝒏 𝟏),
𝒙 ≡ 𝒓 𝟐 (𝒎𝒐𝒅 𝒏 𝟐),
…
𝒙 ≡ 𝒓 𝒌 (𝒎𝒐𝒅 𝒏 𝒌),
has a unique solution modulo 𝒏.
In simpler terms, if the prime factorization of 𝒏 is 𝒑 𝟏 ∗ 𝒑 𝟐 ∗ ⋯ ∗ 𝒑 𝒕, then the system of equations
(𝒙 𝒎𝒐𝒅 𝒑𝒊) = 𝒂𝒊, 𝒘𝒉𝒆𝒓𝒆 𝒊 = 𝟏, 𝟐, … , 𝒕
has a unique solution, 𝒙, where 𝒙 is less than 𝒏.
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 14
15. References
Schneier, B. (2007). Applied cryptography: protocols, algorithms, and source code in C. John Wiley & Sons.
Rosen, K. H. (2007). An Introduction to Cryptography. ISBN-10, 1-58488.
Stallings, W. (2014). Cryptography and network security, 6/E. Pearson Education India.
Katz, J., & Lindell, Y. (2014). Introduction to modern cryptography. CRC press.
UITC203 CRYPTOGRAPHY AND NETWORK SECURITY 15