Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views13 pages

Crypto 3

The document discusses several topics in modular arithmetic including the greatest common divisor (GCD), the Euclidean algorithm, extended Euclidean algorithm, modular arithmetic, sets of residues (Zn), and inverses. It provides definitions and examples for each topic. The Euclidean algorithm and extended Euclidean algorithm are methods for finding the GCD of two numbers and expressions related to it. Modular arithmetic involves performing arithmetic operations on numbers modulo a given value. Zn refers to the set of residues from 0 to n-1 when taking numbers modulo n. Inverses are values that when combined with a given number using addition or multiplication yield the identity element modulo n.

Uploaded by

gisotih749
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)
16 views13 pages

Crypto 3

The document discusses several topics in modular arithmetic including the greatest common divisor (GCD), the Euclidean algorithm, extended Euclidean algorithm, modular arithmetic, sets of residues (Zn), and inverses. It provides definitions and examples for each topic. The Euclidean algorithm and extended Euclidean algorithm are methods for finding the GCD of two numbers and expressions related to it. Modular arithmetic involves performing arithmetic operations on numbers modulo a given value. Zn refers to the set of residues from 0 to n-1 when taking numbers modulo n. Inverses are values that when combined with a given number using addition or multiplication yield the identity element modulo n.

Uploaded by

gisotih749
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/ 13

GCD, Modularity

Arithmetic
Chittaranjan Pradhan

Cryptography 3 GCD (Greatest


Common Divisor)

GCD, Modularity Arithmetic Euclidean Algorithm


Extended Euclidean
Algorithm

Modular Arithmetic

Inverse

Chittaranjan Pradhan
School of Computer Engineering,
KIIT University
3.1
GCD, Modularity
GCD (Greatest Common Divisor) Arithmetic
Chittaranjan Pradhan

GCD (Greatest
Common Divisor)
Euclidean Algorithm
Extended Euclidean
Algorithm

Modular Arithmetic

Inverse

GCD (Greatest Common Divisor)


GCD of two positive integers is the largest integer that can
divide both integers

3.2
GCD, Modularity
Euclidean Algorithm Arithmetic
Chittaranjan Pradhan

Euclidean Algorithm
GCD (Greatest
• Fact 1: gcd (a, 0) = a Common Divisor)
Euclidean Algorithm

• Fact 2: gcd (a, b) = gcd (b, r), where r is the remainder of Extended Euclidean
Algorithm

dividing a by b Modular Arithmetic

Inverse
• When gcd (a, b) = 1, we say that a and b are relatively
prime or coprime

3.3
GCD, Modularity
Euclidean Algorithm... Arithmetic
Chittaranjan Pradhan

GCD (Greatest
Common Divisor)
Euclidean Algorithm
Extended Euclidean
Algorithm

Modular Arithmetic

Inverse

3.4
GCD, Modularity
Extended Euclidean Algorithm Arithmetic
Chittaranjan Pradhan

Extended Euclidean Algorithm


GCD (Greatest
Common Divisor)
• Given two integers a and b, we often need to find other Euclidean Algorithm
Extended Euclidean
two integers s and t such that Algorithm

s * a + t * b = gcd (a,b) Modular Arithmetic

Inverse

3.5
GCD, Modularity
Extended Euclidean Algorithm... Arithmetic
Chittaranjan Pradhan

GCD (Greatest
Common Divisor)
Euclidean Algorithm
Extended Euclidean
Algorithm

Modular Arithmetic

Inverse

3.6
GCD, Modularity
Extended Euclidean Algorithm... Arithmetic
Chittaranjan Pradhan

Linear Diophantine Equation GCD (Greatest


Common Divisor)
A linear Diophantine equation of two variables is ax + by = c Euclidean Algorithm
Extended Euclidean

• d= gcd(a,b) Algorithm

Modular Arithmetic
if d|c: infinite solution Inverse
else no solution
• Particular Solution Since d divides a, b and c, reduce the
equation to a1x+b1y=c1. Then solve a1s+b1t =0
• x0 = (c/d)s and y0 = (c/d)t
• General Solutions
• x = x0 +k(b/d) and y = y0 -k(a/d), where k is an integer
• Find the particular and general solutions to the equation
21x + 14y = 35
• If we want Rs.100 note to be changed with Rs.20 and Rs.5
notes, then what are the possible cases

3.7
GCD, Modularity
Modular Arithmetic Arithmetic
Chittaranjan Pradhan

GCD (Greatest
Common Divisor)
Euclidean Algorithm
Extended Euclidean
Algorithm

Modular Arithmetic
Modular Arithmetic Inverse

• 27 mod 10
• -7 mod 10
• a ≡ b(mod n)
• Ex: 2 ≡ 12 (mod 10)

3.8
GCD, Modularity
Zn ( Set of Residues) Arithmetic
Chittaranjan Pradhan

GCD (Greatest
Common Divisor)
Euclidean Algorithm
Extended Euclidean
Zn ( Set of Residues) Algorithm

Modular Arithmetic

• The result of a mod n is always a non negative integer less Inverse

than n i.e. 0 to n-1


• Z10 , Z7
• Property1: (a+b) mod n =[(a mod n) + (b mod n)] mod n
• Property2: (a-b) mod n =[(a mod n) - (b mod n)] mod n
• Property3: (axb) mod n =[(a mod n) x (b mod n)] mod n
• 10n mod x = (10modx)n

3.9
GCD, Modularity
Inverse Arithmetic
Chittaranjan Pradhan

Inverse
GCD (Greatest
Additive Inverse Common Divisor)
Euclidean Algorithm
• Let n be a positive integer Extended Euclidean
Algorithm
If a, b ∈ Zn , then Modular Arithmetic

Inverse
(a + b)modn = a + b, if (a + b) < n
(1)
= a + b − n, if (a + b) >= n

• In Zn , two numbers a & b are additive inverses of each


other if

a +b ≡ 0 (mod n)
• In modular arithmetic, each number has an additive
inverse and the inverse is unique; and each number has
one and only one additive inverse
• Find additive inverse of 6 in Z10
• Find all additive inverse pairs in Z10

3.10
GCD, Modularity
Inverse... Arithmetic
Chittaranjan Pradhan

Inverse...
GCD (Greatest
Multiplicative Inverse Common Divisor)
Euclidean Algorithm
• The integer a in Zn has a multiplicative inverse iff Extended Euclidean
Algorithm

gcd(n,a) ≡ 1 (mod n) Modular Arithmetic

• In Zn , two numbers a and b are the multiplicative inverse of Inverse

each other if
a x b ≡ 1 (mod n)
• Find all multiplicative inverse pairs in Z10
• The Extended Euclidean algorithm can find the
multiplicative inverse of b in Zn where n & b are given and
the inverse exist, i.e. gcd (n, b)=1
s x n + b x t= gcd (n,b)
• If the multiplicative inverse of b exists, gcd (n,b) =1
s x n + b x t= 1
• The multiplicative inverse of b is the value of t after being
mapped to Zn

3.11
GCD, Modularity
Inverse... Arithmetic
Chittaranjan Pradhan

Multiplicative Inverse... GCD (Greatest


Common Divisor)
Euclidean Algorithm
Extended Euclidean
Algorithm

Modular Arithmetic

Inverse

Find the multiplicative inverse of 11 in Z26

Find the multiplicative inverse of 12 in Z26

3.12
GCD, Modularity
Additive & Multiplicative Tables Arithmetic
Chittaranjan Pradhan

GCD (Greatest
Common Divisor)
Additive & Multiplicative Tables Euclidean Algorithm
Extended Euclidean
Algorithm

Modular Arithmetic

Inverse

3.13

You might also like