Unit-1 Mathematics On Cryptography
Unit-1 Mathematics On Cryptography
UNIT-1
Basic Principles
(Mathematics of Cryptography)
Binary Operations
• In cryptography, we are interested in three binary operations
applied to the set of integers. A binary operation takes two inputs
(+ve or –ve) and creates one output.
• Z = {……., -2, -1, 0, 1, 2, ………..}
A B
+, -, ×
C
• Solve: -255/11
r = a%b
Find GCD(2740,1760)
GCD(131,5)
• GCD(88,220)
r1 r2 q r
88 220 88/220=0 88
220 88 220/88=2 44
88 44 88/44=2 00
44 00 ---- 44
Given a=17,
b=0, find
GCD(a,b) and
the values of
s=1 and t=0
Given a=0,
b=45, find
GCD(a,b) and
the values of
s=0 and t=1
The Extended Euclidean Algorithm
GCD(a,b) = s*a + t*b
r1 r2 q r s1 s2 s t1 t2 t
88 220 88/220=0 88 1 0 1 0 1 0
220 88 220/88=2 44 0 1 -2 1 0 1
88 44 88/44=2 00 1 -2 5 0 1 -2
44 00 ---- --- -2 5 --- 1 -2 ---
Since r2=0, GCD(88,220)=44, s=s1=-2, and t=t1=1
Linear Diophantine Equations
• Given ax+by=c, find all possible solutions for x, and y.
• Particular solution: x0= (c/d)s and y0= (c/d)t
– Use Extended Euclidean Algorithm to get d=gcd(a,b), s, and t.
• General Solution: x=x0+k(b/d), y=y0-k(a/d) where k is an
integer (i.e. k = -∞ to +∞)
• Find the particular and general solutions to the below
given equation
• 21x+14y=35
Sol: 21x+14y=35
• Use Extended Euclidean Algorithm and get
d=gcd(21,14)=7, s=1, t=-1, a=21, b=14, c=35
• Applying particular solution
– x0= (c/d)s and y0= (c/d)t
– x0= (35/7)*1 and y0= (35/7)*(-1)
– x0= 5 and y0= -5
• General Solutions are
– x=x0+k(b/d), y=y0-k(a/d) where k is an integer
– For k=1, x = 5+1*(14/7) and y = -5-1*(21/7)
– For k=2, x = 5+2*(14/7) and y = -5-2*(21/7)
– For k=-1, x = 5+(-1)*(14/7) and y = -5-(-1)*(21/7)
– For k=-2, x = 5+(-2)*(14/7) and y = -5-(-2)*(21/7)
• Solutions are (5,-5),(7,-8),(9,-11), (1,1), …..
r1 r2 q r s1 s2 s t1 t2 t
21 14 1 7 1 0 1 0 1 -1
14 7 2 0 0 1 -2 1 -1 3
7 0 --- 1 -2 --- -1 3 ---
Example:
• Having a note of 2000, you want to change in notes 50 and 20.
what are the different combinations you will get.
• 50x+20y=2000 or 5x+2y=200
• d=gcd(50,20)=10, s=1 and t=-2
• x0= (c/d)s and y0= (c/d)t
• x0= (2000/10)*1 and y0= (2000/10)*(-2)
• X0=200 y0=-400
• x=x0+k(b/d), y=y0-k(a/d)
• K=1, (202, -405) not a valid combination
• K=-85
• 200+(20/10)k = 200+2(-85) = 30
• -400-(50/10)k = -400-5k = -400-(5*-85) = -400+425 = 25
• (30,25) one combination similarly many we can get
Modular Arithmetic
Modulo Operator
27 mod 5
36 mod 12
-18 mod 14
-7 mod 10
Set of Residues
Congruence
• 2 mod 10 = 12 mod 10
Solution
Solution
Solution
A matrix of size l m
Operations and Relations