Lec-7 Number Theory and Algebraic Structures
Lec-7 Number Theory and Algebraic Structures
Lec. 7
Number Theory & Algebriac
Structure
Modular Arithmetic
• Modulo Operator
a. 27 mod 5
Dividing 27 by 5 results in r = 2. This means that 27 mod 5 = 2.
b. -7 mod 10
Dividing −7 by 10 results in r = −7. After adding the modulus to −7, we have
r = 3. This means that −7 mod 10 = 3.
.𝑎 ≡ 𝑎(𝑚𝑜𝑑𝑛)
Algorithm
(a and p are relatively prime)
Example
1.
2.
1st Version (a and n are relatively prime)
Example
Inverse Modulo
When we are working in modular arithmetic, we often need to find
the inverse of a number relative to an operation. We are normally
looking for an additive inverse (relative to an addition operation) or a
multiplicative inverse (relative to a multiplication operation).
Inverse Modulo
Example
Extended Euclidean Algorithm
The extended Euclidean algorithm we discussed earlier can find
the multiplicative inverse of b in 𝑍𝑛 when n and b are given and
the inverse exists. To show this, let us replace the first integer a
with n (the modulus). We can say that the algorithm can find s
and t such s × n + b × t = gcd (n, b). However, if the multiplicative
inverse of b exists, gcd (n, b) must be 1. So the relationship is
Extended Euclidean Algorithm
Extended Euclidean Algorithm
Algorithm
Extended Euclidean Algorithm
Example
Discrete Logarithms
• Order of an element: The order of an element, a(a and n
are relatively prime), is the smallest integer i, such that
𝑎𝑖 ≡ 1 𝑚𝑜𝑑 𝑛 .
Where i is known as the order of mod n
It is represented as 𝑜𝑟𝑑𝑛 𝑎.
• Euler’s Theorem:
This theorem is very helpful because it shows that the
relationship 𝑎𝑖 ≡ 1 𝑚𝑜𝑑 𝑛 holds when i = ∅(n), even if it holds
when i < ∅(n). In other words, this relation holds at least once.
• Primitive Roots: the order of an element is the same as ∅(n),
that element is called the primitive root of the group.
In other words, ∅(n) = 𝑜𝑟𝑑𝑛 𝑎,
a is known as the primitive root of n
Discrete Logarithms
Discrete Logarithms
Discrete Logarithms
• For an integer b with primitive root as a of a prime number p, we can
find a unique exponent i such that
b ≡ 𝒂𝒊 𝒎𝒐𝒅 𝒑
i is known as the discrete log of b for the base of a mod n
Types:
1) Prime Fields(n=1)
2) Extension Fields(n>1)
GF(2n) Fields
Finite fields are important in cryptography. A
number of cryptographic algorithms rely
heavily on properties of finite fields, notably
the Advanced Encryption Standard (AES) and
elliptic curve cryptography.
Prime {GF(p)} Fields
Additive Multiplicative
Extension{GF(𝑃 )} Fields
𝑛
• Represented as 𝑃𝑛
• In AES, the underlying mathematical
structure relies on finite fields,
specifically the finite field GF(2^8), also
known as the Galois Field with 2^8
elements.
Extension{GF(𝑃 )} Fields
𝑛
Coefficients Representation:
Extension fields, such as GF(2^n), involve
polynomials over a base field (e.g., GF(2)).
Elements in the extension field are
represented as polynomials of degree n−1
with coefficients from the base field.
Extension{GF(𝑃 )} Fields
𝑛