Download Slajd 1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Internet Engineering
Czesław Smutnicki
Discrete Mathematics – Numbers Theory
CONTENTS
•
•
•
•
•
•
•
•
•
•
Basic notions
Greatest common divisor
Modular arithmetics
Euclidean algorithm
Modular equations
Chinese theorem
Modular powers
Prime numbers
RSA algorithm
Decomposition into factors
BASIC NOTIONS
•
•
•
•
•
•
•
•
•
•
•
•
Natural/integer numbers
Divisor d|a, a = kd for some integer k
d|a if and only if -d|a
Divisor: 24: 1,2,3,4,6,8,12,24
Trivial divisors 1 and a
Prime number 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59
Composite number, 27 (3|27)
For any integer a and any positive integer n there exist unique integers q and r,
0<=r<n so that a = qn + r
Residue r = a mod n
Division q = [a/n]
Congruence: a  b (mod n) if (a mod n) = (b mod n)
Equivalence class (mod n): [a]n = {a + kn : k  Z}
GREATEST COMMON DIVISOR
• Common divisor: if d|a and d|b
• d|(ax + by)
• Relatively prime numbers a and b : gcd(a,b)=1
gcd(a, b)  gcd(b, a )
gcd(a, b)  gcd( a, b)
gcd(a, b)  gcd( a , b )
gcd(a,0)  a
gcd(a, ka)  a
gcd(a, b)  gcd(b, a modb)
MODULAR ARITHMETIC
[a]n  n [b]n  [a  b]n
[a]n n [b]n  [a  b]n
[a]n  n [b]n  [a  b]n
[a]n n [a 1 ]n  [1]n
1
[a]n / n [b]n  [a]n n [b ]n
+
0
1
2
3
4
5
0
0
1
2
3
4
5
1
1
2
3
4
5
0
2
2
3
4
5
0
1
3
3
4
5
0
1
2
4
4
5
0
1
2
3
5
5
0
1
2
3
4
EUCLIDEAN ALGORITHM
mx  ny  k , k  gcd(m, n)
a0  q1a1  a2
a1  q2 a2  a3
.......... .......... ......
as 1  qs as  as 1
a0  n, a1  m, as 1  0, as  gcd(m, n)
x0 , x1, x2 ,..., xs , y0 , y1, y2 ,..., ys
ai  mxi  nyi , i  0,1,2,..., s
x0  0, y0  1, x1  1, y1  0,
xi 1  qi xi  xi 1 , yi 1  qi yi  yi 1 ,
EUCLIDEAN ALGORITHM.
INSTANCE
333 x  1234 y  1
1234  3*333  235  1234  3*333  235
333  1*235  98  333  1*235  98
235  2*98  39  235  2*98  39
98  2*39  20  98  2*39  20
39  1*20  19  39  1*20  19
20  1*19  1  20  1*19  1
19  19*1  0  19  19*1  0
EUCLIDEAN ALGORITHM.
INSTANCE cont.
20  1*  39  1* 20  1  1* 39  2* 20  1
1* 39  2*  98  2* 39  1  5* 39  2*98  1
5*  235  2*98  2*98  1  5* 235  12*98  1
5* 235  12*  333  1* 235  1  17* 235  12* 333  1
17* 1234  3* 333  12* 333  1  63* 333  17*1234  1
333*63  1234*17  1
x  63
y  17
MODULAR EQUATIONS
ax  b (modn)
d  gcd(a, n)
EQUATION EITHER HAS d VARIOUS SOLUTIONS mod n
OR DOES NOT HAVE ANY SOLUTION
CASE b = 1: MULTIPLICATIVE INVERSE
(IF gcd(a,n)=1 THEN IT EXISTS AND IS UNIQUE)
LEAST COMMON MULTIPLIER
lcm(a, b) 
ab
gcd(a, b)
CHINESE THEOREM
n  n1n2 ...nk , gcd(ni , n j )  1, i  j
a  (a1 , a2 ,..., ak )
ai  a mod ni
b  (b1 , b2 ,..., bk )
(a  b) mod n  (( a1  b1 ) mod n1 ,..., (ak  bk ) mod nk )
(a  b) mod n  (( a1  b1 ) mod n1 ,..., (ak  bk ) mod nk )
(a  b) mod n  (( a1  b1 ) mod n1 ,..., (ak  bk ) mod nk )
MODULAR POWERS
a 2c mod n  (a c ) 2 mod n
a 2c1 mod n  a  (a c ) 2 mod n
RSA ALGORITHM
•
•
•
•
Find two big prime numbers p and q
Calculate n=p*q and z=(p-1)*(q-1)
Find any number d relatively prime with z
Find number e so that (e*d) mod z=1
Public key (e,n)
Private key (d,n)
Encryption message P
Decryption C
C  P e mod n
P  C d mod n
Thank you for your attention
DISCRETE MATHEMATICS
Czesław Smutnicki
Related documents