330 likes | 342 Views
X 1. X 2. X 3. +. +. Number Theory III: Polynomials Modulo A Prime: Secret Sharing, And Error-Correcting Codes. ´ p 0. Modular equivalence of integers a and b: a ´ b [mod n] a ´ n b “a and b are equivalent modulo n” iff (a mod n) = (b mod n) iff n|(a-b).
E N D
X1 • X2 • X3 • + • + Number Theory III:Polynomials Modulo A Prime: Secret Sharing, And Error-Correcting Codes. ´p 0
Modular equivalence of integers a and b: a ´ b [mod n] a ´n b “a and b are equivalent modulo n” iff (a mod n) = (b mod n)iff n|(a-b)
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) c *n ( a +n b) ´n (c *n a) +n (c*n b) • <Zn, +n> • Closed • Associative • 0 is identity • Additive Inverses • Cancellation • Commutative • <Zn*, *n> • Closed • Associative • 1 is identity • Multiplicative Inverses • Cancellation • Commutative
Polynomials Modulo n Let f(x) and g(x) be finite polynomials with integer coefficients. We define: f(x) ´poly g(x) iff each pair of corresponding coefficients of f and g are equivalent modulo n.
Polynomial Evaluation Modulo n Theorem: f(x) ´poly g(x) )8 integer a, f(a) ´n g(a) Proof: Arithmetic with plus, minus, and times modulo n is equivalent no matter which representatives mod n are used.
Degree of a Polynomial Modulo n Degree of f(x) mod n is the highest power of x in f(x) with a non-zero coefficient modulo n. Theorem: For any g(x), there is a degree ·(n) polynomial f(x) such that g(a) ´n f(a), for every a2 Zn*. Proof: Transform g(x) by doing all arithmetic with the rule x(n)´n 1
For rest of lecture: Zp and Zp* p prime
Zp = {0, 1, 2, …, p-1} Zp* = {1,2,3,…., p-1} Define +p and *p: a +p b = (a+b mod p) a *p b = (a*b mod p) c *p ( a +p b) ´p (c *p a) +p (c*p b) • <Zp, +p> • Closed • Associative • 0 is identity • Additive Inverses • Cancellation • Commutative • <Zp-{0}, *p> • Closed • Associative • 1 is identity • Multiplicative Inverses • Cancellation • Commutative
We will now work in Zp = {0, 1, 2, …, p-1} • + defined as +p • * defined as *p • ab means a*b • Let X denote a variable.
A polynomial f(X) over Zp is any expression of the form: a0 + a1 X + a2 X2 + … + ap-1 Xp-1 where a0, a1, …, ap-12 Zp Degree of f(X) = highest power wit a non-zero coefficient.
Solving Linear Equations: a 0 ) aX+b = 0 has the unique solution X = -b / a Proof: aX + b + (-b) = (-b) aX + 0 = -b aX = -b (1/a) aX = (1/a)(-b) = -b/a
Two points define a line. Let (x1, y1) and (x2, y2) be points where x1 x2. There is a unique line f(X) = aX+b passing through the two points. ax1 + b = y1 ax2 +b = y2 ax1 – ax2 = y2 – y1 a(x1 – x2)= y2 – y1 a = (y2 – y1)/(x1 – x2) b = y1 – ax1
Polynomial Interpolation Let a1, a2, …, ak+1 be any distinct elements of Zp. Let b1, …., bk+1 be any elements of Zp. There is a degree k polynomial f(X) over Zp such that f(ai) = bi for 1 i k+1. I.e., it is possible to fit a degree k polynomial through any set of k+1 points with distinct first coordinates.
Polynomial interpolation is just encoding a “case statement” in polynomial arithmetic.
Encoding a case statementon distinct cases: a1, a2, a3, …, ak+1. • For all 1 j k+1, define hj(X) = i j (X – ai) • hj(aj) = product of non-zero things 0 • CASEj(X) = (hj(aj))-1 hj(X) • CASEj (X) has degree · k • CASEj(ai) = 0, i j • CASEj(aj) = 1
CASEj(X) has degree kCASEj(ai) = 0, i j CASEj(aj) = 1 • f(X) = • CASE1(X)b1 + CASE2(X)b2 + … + CASEk+1(X)bk+1 • f(X) has degree k • f(aj) = bj for all 1 j k+1
Polynomial Interpolation Let a1, a2, …, ak+1 be any distinct elements of Zp. Let b1, …., bk+1 be any elements of Zp. There is a degree k polynomial f(X) over Zp such that f(ai) = bi for 1 i k+1. I.e., it is possible to fit a degree k polynomial through any set of k+1 points with distinct first coordinates.
Theorem: No two of the pd+1 polynomials of degree d compute the same function.. • Lemma 1: There are pd+1 distinct polynomials of degree d since they all have the form: a0 + a1 X + a2 X2 + … + ad Xd • Lemma 2: There are pd+1 distinct functions that have degree d: interpolate the points (1,b1), (2,b2), …, (k+1, bk+1) for any b’s.
Unique Polynomial Interpolation Let a1, a2, …, ak+1 be any distinct elements of Zp. Let b1, …., bk+1 be any elements of Zp. There is a unique degree k polynomial f(X) over Zp such that f(ai) = bi for 1 i k+1. A set of k+1 points with distinct first coordinates defines a unique degree k curve.
Lagrange’s Theorem for Zp:A non-trivial polynomial p(X) of degree d has at most d roots. • Proof: d+1 roots means there is a unique degree d polynomial h(x) passing through them (interpolation theorem). The trivial (all 0) polynomial passes through them. Hence, h(x) is the trivial polynomial.
Corollary: Two distinct, degree d polynomials can agree in at most d places. • Suppose two degree d f(x) and g(x) agree in more than d places. Then f(x) – g (x) has more than d roots and is hence zero in every coefficient. Thus f(x) = g(x). Contradiction.
Fundamental Theorem Of Polynomials Modulo 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.
X2 – 1 = 0 modulo 8 has 4 solutions 1, -1, 3,-3
These polynomials have great applications to secret sharing!
Nuclear Launch Codessub/silo sanity/authority check • Missile has random secret s deeply encoded into its hardware. It will not arm without being given s. • n officers have memorized a private, individual “share”. • Any k out of n of them should be able to assemble their shares so as to obtain s. • Any k-1 of them should not be able to jointly determine any information about s.
k out of n threshold secret sharing scheme using polynomials over Zp. • Let s 2 Zp be a random “secret”. • Create randomized shares as follows: • Pick random r1, r2, …, rk-12 Zp • Let f(X) = s + r1 X + r2 X2 + … + rk Xk-1 • For each i, give officer i the value of the polynomial evaluated at i. • “Officer i’s share”: f(i)
k out of n threshold secret sharing scheme using polynomials over Zp. • Let s 2 Zp be a random “secret”. • Pick random r1, r2, …, rk-12 Zp • Let f(X) = s + r1 X + r2 X2 + … + rk Xk-1 • “Officer i’s share”: f(i) • f(0) = s = where f hits y-axis. • f(X) was chosen to be a random degree k-1 polynomial given that f hits the y-axis at s. • I,e., Each such polynomial is equally likely to be chosen
k out of n threshold secret sharing scheme using polynomials over Zp. • Let s 2 Zp be a random “secret”. • Pick random r1, r2, …, rk-12 Zp • Let f(X) = s + r1 X + r2 X2 + … + rk Xk-1 • “Officer i’s share”: f(i) • If k officers combine they will know f(X) evaluated at k points. They can interpolate f(X) and calculate f(0)=s.
k out of n threshold secret sharing scheme using polynomials over Zp. • Let s 2 Zp be a “secret”. • Pick random r1, r2, …, rk-12 Zp • Let f(X) = s + r1 X + r2 X2 + … + rk Xk-1 • “Officer i’s share”: f(i) • If k-1 officers combine they will know f(X) evaluated at k-1 points. For each s’ 2 Zp, there is a unique polynomial passing through their points and f(0) = s’. Each one is equally likely. Thus, the officers get no information.
Shamir’s k out of n Secret Sharing Scheme: Let s 2 Zp be a random “secret”. Create randomized shares as follows: Pick random r1, r2, …, rk-12 Zp Let f(X) = s + r1 X + r2 X2 + … + rk Xk-1 Share i = f(i) Any k shares can be interpolated to obtain f(X), and hence f(0) = s. Fewer than k shares give no information at all about s.
Error Correcting Codes Length d messages over an alphabet of size p. Use elements of Zp as your alphabet. Pick any 1-1 correspondence between messages and polynomials of degree d-1. We can think of sending a polynomial P(X) instead of a message. Let n = 3d + 1. [requires p > 2d + 1] Send n - symbols: P(1), P(2), …, P(n) Up to d errors at receiver end:P’(1), P’(2), …., P’(n)
Error Correcting Codes Pick any 1-1 correspondence between messages and polynomials of degree d-1. We can think of sending a polynomial P(X) instead of a message. Let n = 3d + 1. [requires p > 3d + 1] Send n - symbols: P(1), P(2), …, P(n) Up to d errors at receiver end:P’(1), P’(2), …., P’(n) P’ agrees with P on 2d+1 of values. Any other degree d-1 polynomial agreeing on so many values would agree with p on d+1 values.
Error Correcting Codes Pick any 1-1 correspondence between messages and polynomials of degree d-1. We can think of sending a polynomial P(X) instead of a message. Let n = 3d + 1. [requires p > 3d + 1] Send n - symbols: P(1), P(2), …, P(n) Up to d errors at receiver end:P’(1), P’(2), …., P’(n) The original message can be uniquely reconstructed!