Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
15-251
p-1
!p
Zn* = {x 2 Zn | GCD(x,n) =1} Define +n and *n: a +n b = (a+b mod n) a *n b = (a*b mod n)
Zn = {0, 1, 2, , n-1}
c *n ( a +n b) n (c *n a) +n (c*n b) <Zn, +n> 1.! Closed 2.! Associative 3.! 0 is identity 4.! Additive Inverses 5.! Cancellation 6.! Commutative <Zn*, *n> 1.! Closed 2.! Associative 3.! 1 is identity 4.! Multiplicative Inverses 5.! Cancellation 6.! Commutative
= number of 1<k<n that are relatively prime to n. p prime ) Zp*= {1,2,3,,p-1} ) #(p) = p-1
If a #(n) b Then xa n xb
Fermats Little Theorem
xa mod #(n)
Equivalently,
n xb mod #(n)
Zn = {0, 1, 2, , n-1} Zn* = {x 2 Zn | GCD(x,n) =1} Define +n and *n: a +n b = (a+b mod n) a *n b = (a*b mod n)
Definition of a FIELD: A set S with two operations + and * satisfying: (S,+) is an Abelian Group (S-{0},*) is an Abelian group + distributes over *.
c *n ( a +n b) n (c *n a) +n (c*n b)
<Zn, +n>is an Abelian group.
Field? Only if Z*n {0} = Zn
Fundamental Theorem Of Polynomials Modulo A Prime p Each of the degree d polynomials mod p computes a distinct function. Any non-zero, degree d polynomial over Zp has at most d roots. Two distinct, degree d polynomials can agree in at most d places. pd+1
Repeated Doubling of 1
1, 2, 4, 8, 16, 32, ., 2k Doubling 1 K times will get you 2k
Repeated Doubling of X
X, 2X, 4X, 8X, 16X, 32X, ., 2k X Doubling X K times will get you 2k X
Repeated Halving of X Mark each even number 0 Mark each odd number 1
For x = 13
For x = 13 13 6 13
13 6 1 0
13 1
Repeat until X=0 { If X is even then Output O; Otherwise Output 1; X:= &X/2' }
* * * * * * * * * * * = 5X
184
48
14
58
First idea:
5 52 53 54 55 56 57 58 = 52*5 = 5*5
To compute am
Suppose 2k !"m < 2k+1 a a2 a4 a8 ... a2
k
This takes k multiplies Now write m as a sum of distinct powers of 2 say, m = 2k + 2i1 + 2i2 + 2it am = a2 * a2 * * a2
k i1 it
25 11 3
11 81 11 4
58
11 36 11 3
512
513
11 15 11 4
Hence, we can compute am (mod n) while performing at most 2 &log2 m' multiplies where each time we multiply together numbers with &log2 n' + 1 bits
Its a functional language that automatically infers the types of variables. It compiles to fast code. It has an interactive shell so that you can play with the functions youve written. (Similar to SML which you will learn about in 15-212 or 15-150.)
If a #(n) b Then xa n xb
xa mod #(n)
Equivalently,
n xb mod #(n)
The multiplicative inverse of a2 Zn* is the unique b2 Zn* such that a *n b n 1. We denote this inverse by a-1 or 1/a.
Efficient algorithm to compute a-1 from a and n. Execute the Extended Euclid Algorithm on a and n (previous lecture). It will give two integers r and s such that: ra + sn = (a,n) = 1 Taking both sides mod n, we obtain: rn n 1 Output r, which is the inverse of a
Euclid(1,0) outputs
Zn* = {x 2 Zn | GCD(x,n) =1} Quick raising to power. <Zn, +n> 1.! Closed 2.! Associative 3.! 0 is identity 4.! Additive Inverses Fast + amd 5.! Cancellation 6.! Commutative <Zn*, *n> 1.! Closed 2.! Associative 3.! 1 is identity 4.! Multiplicative Inverses Fast * and / 5.! Cancellation 6.! Commutative
Rivest Shamir Adleman
Zn = {0, 1, 2, , n-1}
Euler
Fermat
Pick secret, random large primes: p,q Multiply n = p*q Publish: n $(n) = $(p) $(q) = (p-1)*(q-1) Pick random e ( Z*$(n) Publish: e Compute d = inverse of e in Z*$(n) Hence, e*d = 1 [ mod $(n) ] Private/Secret Key: d
n, e
me [mod n]
(me)d !n m
How about the other way? Does cracking RSA mean we must do one of these two? We dont know (yet)
Generator Theorem: g2 Zn is a generator if the order of g = $(n). i.e., powers of g hit every element of Zn
*
20
Z7* = {1,2,3,4,5,6} = 1; 21 = 2; 22 = 4; 23 = 1
p prime ) Zp* has a generator g. This will mean that Zp* has an alternative representation as the powers of g: {g,g2,g3,,gp-1}.
10
Adversary Eve: has seen gx mod p and gy mod p. Can she quickly compute gxy mod p?
Let p be prime. g be a generator mod p. Alice: Picks random x2 Zp-1 Sends Bob gx mod p Bob: Picks random y2 Zp-1 Sends Alice gy mod p Both parties can compute (gx)y = (gy)x = gxy mod p-1
11
Diffie Hellmann has an *amazing* feature. Two people who have never met and have no prior shared secrets can use the system. Without this property, commerce on the net would be impossible.
Diffie Hellman Secret Key Agreement Protocol. Agree on a random string even though you have no private information in common.
Typical use: Agree on a random string r. Use r as your secret-key in a more conventional private-key crypto system.
Fundamental Theorem Of Polynomials Modulo A Prime p Each of the pd+1 degree d polynomials mod p computes a distinct function. Any non-zero, degree d polynomial over Zp has at most d roots. Two distinct, degree d polynomials can agree in at most d places.
Secret S in Zp* Pick k-1 random numbers in Z_p: cd"1, ###, c2 , c1 p((x) = cd"1 xd"1 + ### + c2 x2 + c1 x + S n shares are p(1). P(2), .p(n) Interpolate from any k shares to yield S Any k-1 shares gives no information about S I.e, there are exactly p-1 polynomials of degree k-1 going through those points.
12