Computer and Data Security 4 Class: Dr. Ashwaq Mahmood Alabaichi 2015-2016 Lec.6
Computer and Data Security 4 Class: Dr. Ashwaq Mahmood Alabaichi 2015-2016 Lec.6
Security
4th Class
Dr. Ashwaq Mahmood Alabaichi
2015-2016
lec.6
Mathematics of Cryptography
Modular
The modular of number can get from div tow number
and get reminder
Example:
12 div 3=4 because 4*3=12 and 12 mod 3=0(non
reminder)
12 div 5=2 because 5*2=10 and 12 mod 5=2
(reminder)
25 mod 6=1 can proof by 6*4=24 and reminder=1
R = a mod b
R = Remainder of dividing a by b.
Cont…
q=a/b
a = (q * b) + r 0≤r<b
r = a – (q * b )
q=23 /12 q=1
23=(1*12)+11 then 11=23-(1*12)
Rules :
If a>b then used r = a – (q * b) to find the reminder (R).
if a<b then r=a as reminder.
if a is negative(-) then used:
-a mod b=(-a +b) to get (+a mod b)
a=-11 ,b=7 find R
-11+7=-4 the get first positive integer
-4 +7=3.
[(a mod n)]+(b mod n)] mod n =(a + b) mod n
[(a mod n)]-(b mod n)] mod n =(a - b) mod n
[(a mod n)]*(b mod n)] mod n =(a *b) mod n
11 mod 8 =3; 15 mod 8 =7
[(11 mod 8 )+(15 mod 8)] mod 8 =10 mod 8 =2
(11+15) mod 8 = 26 mod 8 =2
GCD(27,18)
27= 18*1 +9
18= 9*2+0
GCD(27,18)=9
GCD(5,3)
5= 3*1+2
3=2*1+1
2=1*1+1
1=1*1+0
Two numbers are relatively prime when they share no factors in common
other than 1. In
other words, if the greatest common divisor of a and n is equal to 1.
This is written GCD(a, n) = 1
GCD(5,3)=1
GCD(123,4567)
4567=123*37+16
123=16*7+11
16=11*1+5
11=5*2+1
5=1*5+0
GCD(123,4567)=1
Another method
GCD(93,36)= GCD(36,93 mod 36)=GCD(36,21(
GCD(36,21)=GCD(21,36 mod 21) = GCD (21,15(
GCD(21,15)=GCD(15,21 mod 15)=GCD(15,6(
GCD(15,6)=GCD(6,15 mod 6)=GCD(6,3)
GCD(6,3)=GCD(3,6 mod 3) =GCD (3,0(
GCD (93,36)=3
. GCD OF Relative prime number (A,B) =1
Fermat's Theorem
Fermat's theorem states the following: If p is prime and a is a
positive integer not divisible by p, then
Equation:
ap-1 =1 mod p a = 7, p = 19
72 = 49 ≡11(mod 19)
74 ≡121 ≡7(mod 19)
78 ≡49 ≡11(mod 19)
716 ≡121 ≡7(mod 19)
ap-1 = 718 = 716 x 72 ≡7 x 11 ≡1(mod 19)
Least Common Multiple (LCM)
LCM(a, b) = a * b / GCD(a, b)
Example: LCM(4864,3458)
GCD(4864,3458)
4864 = 3458 * 1 + 1406
3458= 1046 *2 + 646
1406 = 646 *2 + 114
646 = 114* 5 + 76
114 = 67 * 1 + 38
76 = 38 *2 + 0
GCD(4864,3458) = 38
LCM(3864,3458) = (3864 * 3458 )/ GCD(4864,3458)
= 16819712 / 38
= 442624
Euler function
Euler function is an arithmetic function that counts
the positive integers less than M that are relatively
prime to M.
When the number(M) is prime number:
Φ(M)=M-1
Note: GCD(M, Φ(m))=1
Find Φ(5) : the number(5) is prime then
Φ(5)=5-1=4
The set or reduce are{1,2,3,4}
GCD(Φ(5),5)=1
GCD(5,1)=1 , GCD(2,5)=1 , GCD(3,5)=1 , GCD(4,5)=1
Cont…
When the M is not prime number :
Ф(Mr) = Mr-1 (M-1)
Find Ф(27) the number 27 is not prime then:
Ф(33)=3 2(3-1) =9*2 = 18
The set of reduce{1,2, 4, 5, 7, 8, 10, 11, 13, 14, 16,
17, 19, 20, 22, 23, 25, 26}
When the number composite of multi two
number (prime number) then
Ф(m1*m2) =(m1-1)(m2-1)
Find Ф(10) the number (10) make of (2*5) then :
Ф(10) = ( 2 * 5 ) = (2 -1) (5-1)
= 1* 4 = 4
The set of reduce={1,3,7,9}
Cont…
When the M is even number then :