• 沒有找到結果。

Application: The RSA Function

N/A
N/A
Protected

Academic year: 2022

Share "Application: The RSA Function"

Copied!
59
0
0

加載中.... (立即查看全文)

全文

(1)

Three Easy Applications

• The inverse of a in (Zp,×) is ap−2 mod p.

– ap−2a = ap−1 ≡ 1 mod p by Fermat’s “little”

theorem.

• 3 | (n2 − 1) when 3  | n.

– The number 3 is a prime.

– By Fermat’s “little” theorem,

n3−1 = n2 ≡ 1 mod 3.

(2)

Three Easy Applications (concluded)

• apn−pn−1 ≡ 1 mod pn for odd prime p and gcd(a, p) = 1.

– By Euler’s theorem (p. 862) and Theorem 61 (p.

423),

1 ≡ aφ(pn) ≡ apn−pn−1 mod pn.

(3)

Application: The RSA Function

a

• Let n = pq, where p and q are distinct odd primes.

• Then

φ(n) = (p − 1)(q − 1) by Theorem 61 (p. 423).

• Let e be an odd integer relatively prime to φ(n).b

• The RSA function is defined as

E(x) = xe mod n, where gcd(x, n) = 1.

aRivest, Shamir, & Adleman (1978).

(4)

Adi Shamir, Ron Rivest, and Leonard Adleman

(5)

Encryption Using the RSA Function

• The RSA function is a good candidate for the encryption of message x.

• The number e is called the encryption key.

• The prime number theorem (p. 160) guarantees an abundance of primes.

(6)

Decryption and Trapdoor Information

• To be useful, an efficient algorithm must exist to recover x from E(x).

• But this is an open problem (so far).

• The way out is the existence of the trapdoor

information not available to others except the receiver.

• A candidate is the factorization of n.

– Factorization is believed to be hard.a

aNumbers can be factorized efficiently by Shor’s (1994) quantum al- gorithm.

(7)

Inversion of the RSA Function

• Let d be the inverse of e modulo φ(n), that is, ed = 1 mod φ(n).

• Because gcd(e, φ(n)) = 1, such d exists.

– d can be found by the extended Euclidean algorithm (p. 802).

• By Euler’s theorem (p. 862), the encrypted message y = E(x) can be decrypted byΔ

yd = (xe)d = xed = x1+kφ(n) = xx(n) = x mod n.

• So the decryption function is

d

(8)

Sophie Germain Primes

• How many e’s are there such that gcd(e, φ(n)) = 1?

• The density of numbers between 1 and φ(n) that satisfy the above condition isa

φ(φ(n))

φ(n) = φ((p − 1)(q − 1)) (p − 1)(q − 1) .

aThe 5th edition of Grimaldi’s Discrete and Combinatorial Mathe- matics errs with φ(n)/n on p. 760.

(9)

Sophie Germain Primes (concluded)

• Suppose p = 2p + 1 and q = 2q + 1, where p, q are also primes.

– Such primes are called Sophie Germain primes.

• The density becomes φ(4pq)

(p − 1)(q − 1) = 2(p − 1)(q − 1)

4pq 1 2.

(10)

Sophie Germain (1776–1831)

• A French mathematician.

• Gauss on Germain: “But when a person of the sex which, according to our customs and prejudices, must encounter infinitely more difficulties than men to

familiarize herself with these thorny researches, succeeds nevertheless in surmounting these obstacles and

penetrating the most obscure parts of them, then

without doubt she must have the noblest courage, quite extraordinary talents and superior genius.”

http://www.pbs.org/wgbh/nova/proof/germain.html.

(11)

Second Corollary of Lagrange’s Theorem

Corollary 128 Every group of prime order is cyclic.

• Pick any element a = e of the group G.a

• Note that o(a) > 1.

• As o(a) also divides | G |,b a prime number, o(a) = | G |.

• This implies that every b ∈ G must be of the form ak for some k ∈ Z.

aBecause a group of prime order has at least 2 elements, such an a exists.

bSee Corollary 124 (p. 859).

(12)

Criterion for Generators

• The computational problem of verifying if g is a generator is believed to be hard without the

factorization of | G |.

• Exhaustive testing is too slow, taking O(| G |) time.

• A better algorithm is based on the next corollary, assuming the factorization of | G | is available.

(13)

Third Corollary of Lagrange’s Theorem

Corollary 129 Let G be a finite cyclic group with prime factorization of its order m = pa11pa22 · · · pann. Then g ∈ G is a generator of G if and only if

gm/pi = e (106)

for i = 1, 2, . . . , n.

• Define mi Δ

= m/pi.

• Hence

mi = pa11pa22 · · · paii−1 · · · pann.

• Suppose g is a generator.

(14)

The Proof (continued)

• Because o(g) = m, gm/pi = e for all i.

• Conversely, assume inequality (106).

• We proceed to show that g must be a generator.

• Let o(g) = j so gj = e.

• Because j divides m by Lagrange’s theorem (p. 855), m = dj for some d ≥ 1.

(15)

The Proof (concluded)

• Let

j = pb11pb22 · · · pbnn, where 0 ≤ bi ≤ ai for i = 1, 2, . . . , n.

• What if j < m?

• Then bi < ai for some i.

• But then j divides mi.

• This implies that gmi = e, contradicting inequality (106).

• We must conclude that j = m and g is a generator.

(16)

Algorithm for Testing If g Is a Generator of G

1: m := pa11pa22 · · · pann;

2: for i = 1, 2, . . . , n do

3: if gm/pi = e then

4: return “g is not a generator”;

5: end if

6: end for

7: return “g is a generator”;

• Note that n = O(log2 m).

• So the number of steps is polynomial in log2 m.

• In contrast, the exhaustive method takes m steps.

(17)

Number of Generators in Finite Cyclic Groups

Lemma 130 Let G be a finite cyclic group with order m and g be a generator of G. Then the generators are

gi,

where 1 ≤ i < m and gcd(i, m) = 1. Hence the number of generators is φ(m), Euler’s phi function (p. 423).

• Suppose 1 ≤ i < m is relatively prime to m.

• Let j = o(gi).

• So gij = e.

• As g is a generator, m divides ij by Lemma 117 (p. 840).

(18)

The Proof (concluded)

• As m cannot divide i by assumption, m divides j.

• As 1 ≤ j ≤ m, we must have j = m and gi is a generator.

• Next assume 1 ≤ i < m but gcd(i, m) = d > 1.

• Define j = m/d.

• Now, 0 < j < m.

• By the Fermat-Euler theorem (p. 860),

(gi)j = gij = gim/d = g(i/d)m = (gm)i/d = e.

• So gi is not a generator.

(19)

Number of Generators in (Z

n

, ×), If Any

Theorem 131 If (Zn,×) has a generator, then it has φ(φ(n)) generators.a

• Recall Euler’s phi function (p. 423).

• If (Zn,×) has a generator, then it is a finite cyclic group.

• Lemma 130 (p. 880) then implies the theorem.

aA common mistake is to answer φ(n). Is it easy to calculate φ(φ(n)) even if one knows the factorization of n?

(20)

Powers of a Generator in (Z

n

, ×)

Corollary 132 Suppose (Zn,×) has a generator g. Then gi is a generator if and only if gcd(i, φ(n)) = 1. Furthermore, there are no other generators.

• (Zn,×) is a finite cyclic group with order φ(n).

• Lemma 130 (p. 880) then implies the claim.

(21)

F

• Let (F, +, ·) be a finite field.

• (F − { 0 }, ·) is an abelian group by the definition of ring.a

• Define

F∗ Δ= (F − { 0 }, ·),

the multiplicative group of the nonzero elements of F .

aRecall p. 769.

(22)

“Order Statistics”

Lemma 133 If F is a finite field and d divides | F |, then φ(d) elements of F have order d.

• Let q =Δ | F |.

• Assume q ≥ 3 without loss of generality.

• Let oi ≥ 0 denote the number of elements of F with order i.

• By Corollary 124 (p. 859), the order of an element must divide q.

• Hence oi = 0 if i is not a divisor of q.

(23)

The Proof (continued)

• As every element of F has a finite order by Lemma 118 (p. 841),



d| q

od = q.

• But Theorem 62 (p. 429) says



d| q

φ(d) = q.

• So it suffices to show

od ≤ φ(d)

(24)

The Proof (concluded)

• Let d divide q.

• If od > 0, then

od = φ(d) by Lemma 130 (p. 880).

• Hence od ≤ φ(d).

(25)

F

Is Cyclic

Theorem 134 If F is a finite field, then F is a cyclic group with φ(| F |) generators.

• F has φ(| F |) generators by Lemma 133 (p. 885).

• But φ(| F |) ≥ 1.

(26)

Group Homomorphism and Isomorphism

• Let (G, ◦) and (H, ◦) be 2 groups.

• A function f : G → H is a homomorphism if f (x ◦ y) = f(x) ◦ f (y)

for all x, y ∈ G.

• It is called an epimorphism if f is onto.

• It is called an isomorphism if f is a bijection.

• An isomorphism is called an automorphism if G = H.

(27)

Group Homomorphism and Isomorphism (concluded)

• G and H are said to be isomorphic (written as G ∼= H) if an isomorphism exists between them.

• Isomorphic groups have the same multiplication table (up to relabeling by f ).

• When ambiguity is an issue,

– Write eG for the identity of G.

– Write eH for the identity of H.

(28)

All Cyclic Groups Are Isomorphic

Lemma 135 Cyclic groups of the same order are isomorphic.

• Let G = ( g , ◦g) and H = ( h , ◦h) be 2 cyclic groups of the same order.

• Define f : G → H by f(gi) = hi.

• For all x = gi ∈ G and y = gj ∈ G,

f (x g y) = f (gi+j) = hi+j = hi h hj = f (x) h f (y).

• f is a one-to-one correspondence between G and H because f (g) = h clearly generates H.

(29)

All Cyclic Groups Are Isomorphic (concluded)

Corollary 136 Every cyclic group of order n > 1 is isomorphic to (Zn, +).

• (Zn, +) is a cyclic abelian group.a

• Lemma 135 (p. 891) then implies this corollary.

aRecall p. 839.

(30)

Permutations

a

• Let function f : { 1, 2, . . . , n } → { 1, 2, . . . , n } be one-to-one and onto.

• f must be a permutation of { 1, 2, . . . , n }.

• Write f as

1 2 · · · n

f(1) f(2) · · · f(n)

I =

1 2 · · · n 1 2 · · · n

, the identity permutation.

aLagrange (1770); Ruffini (1799); Cauchy (1815). Recall p. 433.

(31)

Permutations (concluded)

• So permutations are functions.

• We are mainly interested in permutations of a finite set.

(32)

Permutation Groups

• Let f and g be two permutations of { 1, 2, . . . , n }.

• Then f ◦ g is defined as

⎝ 1 2 · · · n

g(f (1)) g(f (2)) · · · g(f(n))

⎠ . (107)

• Note that f is applied first.

• The alternative of applying g first is more consistent with function composition on p. 316.

• But our convention is more convenient in calculations.

• Either convention works.

(33)

Permutation Groups (continued)

• For example,

1 2 3 4 2 3 4 1

⎠ ◦

1 2 3 4 3 4 1 2

⎠ =

1 2 3 4 4 1 2 3

⎠.

• In general, permutations can work on any finite set X, not just { 1, 2, . . . , n }.

– The X can even be a set of permutations.

• When a set of permutations forms a group under ◦, we have a permutation group.

• In general, ◦ is not abelian.

(34)

Permutation Groups (concluded)

• A key result of Cayley says every group is isomorphic to a permutation group!a

• But the permutation perspective has one unique advantage over groups: Permutations are functions!

• Under this perspective, notations like g(x), x ∈ X, make sense for a group element g ∈ G that “acts on” X.

• This idea was used to construct interconnection networks for parallel computers.b

aSee p. 919.

bAnnexstein, Baumslag, & Rosenberg (1990).

(35)

Permutation Group as a Multiplication Table

g1 g2 g3 g4 g5 g6

(36)

The Symmetric Group

• There are n! permutations of { 1, 2, . . . , n }.

• These permutations form a group (verify it).

– This group Sn is called the symmetric group of degree n.

• | Sn | = n!.

• Every permutation group is thus a subgroup of Sn.

• By Cayley’s resulta again, every group is a subgroup of a symmetric group.

• In general, SX denotes the set of all permutations of a set X.

(37)

Cycles

• Call a cycle (i1 i2 · · · im) an m-cycle, where i1, i2, . . . , im are distinct.

• It represents the permutation

i1 i2 i3 · · · im−1 im other fixed points i2 i3 i4 · · · im i1 other fixed points

⎠ .

• The order of an m-cycle g is m because gm = I,

the identity permutation.

(38)

Cycles (concluded)

• A 1-cycle is a fixed point.

• The inverse of a cycle:

(i1 i2 · · · im)−1 = (im in−1 · · · i1).

– Because

(i1 i2 · · · im)(im im−1 · · · i1) = (i1)(i2)· · · (im).a

aIn fact, (im im−1 · · · i1)(i1 i2 · · · im) = (i1)(i2)· · · (im), too (recall p. 818).

(39)

Cycle Decomposition of Permutations

• A permutation like

1 2 3 4 5 3 4 1 2 5

can be represented as

(1 3)(2 4)(5).

• There are 3 disjoint cycles above.

• 5 is a fixed point; it is invariant under the permutation.

• Obviously, a permutation is a cycle or a product of disjoint cycles.

(40)

Cycle Decomposition of Permutations (concluded)

• Now,

(1 3)(2 4)(5) = (1 3)(2 4).

– So fixed points drop out.

• A cycle decompositiona of a permutation is a product of disjoint cycles that contains a 1-cycle for every

invariant element.

• A cycle decomposition can be calculated efficiently.

aAlso called a complete factorization.

(41)

Another Cycle Decomposition

⎝ 1 2 3 4 5 6

2 3 1 5 4 6

⎠ = (1 2 3)(4 5)(6).

• There are 3 disjoint cycles above.

• Equivalent cycle decompositions:

(3 1 2)(5 4)(6), (4 5)(1 2 3)(6),

...

• The cycle decomposition is essentially unique.

(42)

Transpositions

• A 2-cycle is called a transposition.

• (1 2 3) = (1 2)(1 3).a

• In general,

(i1 i2 · · · in) = (i1 i2)(i1 i3)· · · (i1 in).

• So every permutation is a product of (not necessarily disjoint) transpositions.

aFrom left to right always.

(43)

Order of a Permutation

Theorem 137 Let g ∈ Sn. If g = g1 · · · gm is a product of disjoint cycles,a then

o(g) = lcm(r1, r2, . . . , rm), where gi is an ri-cycle.

• We knew o(gi) = ri (p. 900).

• Suppose o(g) = M.

• Clearly,

gM = (g1 · · · gm)M = g1M · · · gmM = I because the gis are disjoint and hence commute.

aIt is not necessarily a cycle decomposition of g because 1-cycles may

(44)

Order of a Permutation (concluded)

• The disjointness of the gis implies giM = I for each i.

• Then ri | M by Lemma 117 (p. 840) for i = 1, 2, . . . , m.

• Hence lcm(r1, r2, . . . , rm)| M as well.

• But glcm(r1,r2,...,rm) = I.

– Trivially, ri divides lcm(r1, r2, . . . , rm).

– So

glcm(r1,...,rm) = g1lcm(r1,...,rm) · · · gmlcm(r1,...,rm) = I.

• Hence lcm(r1, r2, . . . , rm) = M .

(45)

Conjugates

• Let f and g be permutations of { 1, 2, . . . , n }.

• The permutation

g−1 ◦ f ◦ g is called f ’s conjugate.

• Conjugacy is an equivalence relation (prove it!).

• Take f = (1 3)(2 4 7)(5)(6) and g = (2 5 6)(1 3 4)(7).

• Then

g−1 ◦ f ◦ g

= (7)(4 3 1)(6 5 2)(1 3)(2 4 7)(5)(6)(2 5 6)(1 3 4)(7)

= (1 7 5)(2)(3 4)(6).

(46)

Conjugates (concluded)

• Interestingly,

(g(1) g(3))(g(2) g(4) g(7))(g(5))(g(6))

= (3 4)(5 1 7)(6)(2)

= (1 7 5)(2)(3 4)(6)

= g−1f g.

• So we simply replaced every element in a cycle by its image under the conjugating permutation g.

• This is not an accident, as the next theorem shows.

(47)

Conjugate and Cycle Decomposition

Theorem 138 Let f and g be permutations of

{ 1, 2, . . . , n }. The conjugate g−1 ◦ f ◦ g results by applying g to the symbols in the cycle decomposition of f .

• If f fixes i, then g−1 ◦ f ◦ g fixes g(i) because (g−1 ◦ f ◦ g)(g(i)) = g 

f 

g−1(g(i))

= g(f (i)) = g(i).

• So the 1-cycle (i) in the cycle decomposition of f becomes the 1-cycle (g(i)) in that of g−1 ◦ f ◦ g.

(48)

The Proof (continued)

• Now suppose f(i) = j.

• The cycle decomposition of f contains a cycle (i j . . .).

• Then g−1 ◦ f ◦ g moves g(i) to (g−1 ◦ f ◦ g)(g(i)) = g 

f 

g−1(g(i))

= g(f (i)) = g(j).

• Hence the cycle decomposition of g−1 ◦ f ◦ g contains the cycle

(g(i) g(j) . . .).

(49)

The Proof (concluded)

• So whenever f(i) = j, g−1 ◦ f ◦ g moves g(i) to g(j) regardless of i = j or not.

• As g is a bijection, there are no more numbers to consider.

(50)

Isomorphism between Symmetric Groups of the Same Degree

All symmetric groups of the same order are isomorphic.

Lemma 139 If X and Y have the same cardinality, then SX ∼= SY .

• Assume X = { x1, x2, . . . , xn } and Y = { y1, y2, . . . , yn }.

• We shall demonstrate an isomorphism ϕ from SX to SY .

• Let ψ : X → Y be any bijective function.

(51)

The Proof (continued)

• Pick any arbitrary permutation from SX:

f =Δ

x1 x2 · · · xn f (x1) f (x2) · · · f(xn)

⎠ .

• We choose the mapping ϕ : SX → SY that turns f into

fψ =Δ

ψ(x1) ψ(x2) · · · ψ(xn) ψ(f (x1)) ψ(f (x2)) · · · ψ(f(xn))

⎠ .

– Technically, ϕ(f ) = fψ.

• Note that fψ ∈ SY because ψ and f are bijective.

(52)

The Proof (continued)

• Let

fψ(yi) = yj.

• It is one of the columns of fψ.

• So there is an xi ∈ X such that yi = ψ(xi), yj = ψ(f (xi)).

• Hence

yj = ψ  f 

ψ−1(yi)

. (108)

(53)

The Proof (continued)

• After sorting,

fψ

=

y1 y2 · · · yn

ψ(f(ψ−1(y1))) ψ(f(ψ−1(y2))) · · · ψ(f(ψ−1(yn)))

⎠ .

• Alternatively,

ϕ(f ) = ψ ◦ f ◦ ψ−1 by Eq. (108).

(54)

The Proof (continued)

• Pick any f1, f2 ∈ SX.

• Then

ϕ(f1 ◦ f2)

=

 y1 · · · yn

ψ(f2(f1−1(y1)))) · · · ψ(f2(f1−1(yn))))



=

 y1 · · · yn

ψ(f2−1(ψ(f1−1(y1)))))) · · · ψ(f2−1(ψ(f1−1(yn))))))



= ϕ(f1) ◦ ϕ(f2).

• Hence ϕ is a homomorphism.

(55)

The Proof (concluded)

• To show that ϕ is an isomorphism, it remains to show that ϕ is one-to-one.

• But this is obvious because all functions we used are bijective.

(56)

Cayley’s Theorem

Theorem 140 Every finite group is isomorphic to a group of permutations.

• Let (G, ◦) be a finite group of order m, G = { g1, g2, . . . , gm }.

• Define m distinct permutations by

π1(g) = g ◦ g1, π2(g) = g ◦ g2, . . . , πm(g) = g ◦ gm.

• They are called (right) translations.a

aThe proof also works if we use left translations: πi(g) = gi ◦ g.

(57)

The Proof (continued)

• Each πi postmultiplies every g ∈ G by gi:

πi =

g1 g2 · · · gm g1 ◦ gi g2 ◦ gi · · · gm ◦ gi

⎠ .

• It is easy to verify that πi is a permutation.

• Consider the permutation set (G,◦), where G = { π1, π2, . . . , πm }

and  denotes multiplication of permutations.a

aRecall p. 895.

(58)

The Proof (continued)

• (G,◦) is a group (why?).

• We next show that (G, ◦) is isomorphic to (G,◦).

• Define f : G → G by

f (gi) = πi, i = 1, 2, . . . , m.

• Clearly, f is a one-to-one correspondence.

• Next we show that f is an isomorphism.

(59)

The Proof (concluded)

• Suppose gi ◦ gj = gk.

• For each g ∈ G,

πk(g) = g ◦ gk = g ◦ (gi ◦ gj)

= (g ◦ gi) ◦ gj = πi(g) ◦ gj

= πji(g)) = (πi  πj)(g).

– Recall our convention on permutation composition (p. 895).

• As πk = πi  πj, it means

f (gi ◦ gj) = f (gk) = πk = πi  πj = f (gi)  f (gj).

參考文獻

相關文件

According to the regulations, the employer needs to provide either a mobile or landline phone number at which the employer (or a contact person) can be reached.. If

The aim of this paper is to summarize some of the bibliographical data for the more than 230 mountain and temple gazetteers of which the archive is comprised, to compare the

z Choose a delivery month that is as close as possible to, but later than, the end of the life of the hedge. z When there is no futures contract on the asset being hedged, choose

Reading Task 6: Genre Structure and Language Features. • Now let’s look at how language features (e.g. sentence patterns) are connected to the structure

 Promote project learning, mathematical modeling, and problem-based learning to strengthen the ability to integrate and apply knowledge and skills, and make. calculated

Which of the following is used to report the crime of damaging the Great Wall according to the passage.

To complete the “plumbing” of associating our vertex data with variables in our shader programs, you need to tell WebGL where in our buffer object to find the vertex data, and

To look at the most appropriate ways in which we should communicate with a person who has Autism and make it.. applicable into our day to