Problem 1

According to the encryption algorithm,we can get the ciphertext of M3M_3 as follow:

C1=CBCMCk(0nM1)=M2C3=CBCMCk(C10n)=CBCMCk(M2)\begin{aligned} \begin{array}{l} C_1=CBC-MC_k(0^n\oplus M_1)=M_2\\ C_3=CBC-MC_k(C_1\oplus0^n)=CBC-MC_k(M_2) \end{array} \end{aligned}

It cannot play a role in increasing the difficulty of calculation because M3M_3 is padded using 0n0^n.

Problem 2

a.

According to the question,we get the information as follow:eAdA=1(mod p1),eBdB=1(mod p1)e_Ad_A=1(mod\ p-1),e_Bd_B=1(mod\ p-1)

We can compute MAdBM_A^{d_B} as the next process:

MAdB=(CBdA)dB=CBdAdB=(CAeB)dAdB=CAdA=MeAdA=M(modp)M_A^{d_B}=(C_B^{d_A})^{d_B}=C_B^{d_Ad_B}=(C_A^{e_B})^{d_Ad_B}=C_A^{d_A}=M^{e_Ad_A}=M(modp)

b.

Euler Theorem

c.

  • eBe_B will be computed when Eve hijacked the message CAC_A and CBC_B on the public communication channel. Then ,Eve will get dBd_B according to eBdB=1(mod p1)e_Bd_B=1(mod\ p-1).
  • dAd_A will be computed when Eve hijacked the message CBC_B and MAM_A on the public communication channel. Then ,Eve will get eAe_A according to eAdA=1(mod p1)e_Ad_A=1(mod\ p-1).

d.

The secret key is more shorter.

e.

The length of the plaintext of this algorithm has an upper bound.

Problem 3

a.

According to cqr=1bprapqcqr=1-bpr-apq, both sides of equation (1) take modulo pp at the same time:

M(modp)=(cqrMp+bprMq+apqMr+kn)(modp)=(cqrMp+bprMq+apqMr+kpqr)(modp)=cqrMp(modp)=(1bprapq)Mp(modp)=Mp(modp)\begin{aligned} \begin{array}{l} M^{'}(modp)&=(cqrM_p+bprM_q+apqM_r+kn)(modp)\\ &=(cqrM_p+bprM_q+apqM_r+kpqr)(modp)\\ &=cqrM_p(modp)\\ &=(1-bpr-apq)M_p(modp)\\ &=M_p(modp) \end{array} \end{aligned}

Similarly, we can prove MMq(modq)M'\equiv M_q(modq) and MMr(modr)M'\equiv M_r(modr).

b.

According to Euler’s theorem:M(modp)=Cd(modp)=Cd(modφ(p))(modp)=Cdp(modp)=Mp(modp)M(modp)=C^d(modp)=C^{d(mod\varphi(p))}(modp)=C^{d_p}(modp)=M_p(modp).

Similarly, we can get M(modq)=Mq(modq)M(modq)=M_q(modq) and M(modr)=Mr(modr)M(modr)=M_r(modr).

Those result are as follows:

{MMp(mod p)MMq(mod q)MMr(mod r)\begin{aligned} \left\{ \begin{array}{l} M\equiv M_p(mod\ p)\\ M\equiv M_q(mod\ q)\\ M\equiv M_r(mod\ r)\\ \end{array} \right. \end{aligned}

Let np=n/p=qr,nq=n/q=pr,nr=n/r=pqn_p=n/p=qr,n_q=n/q=pr,n_r=n/r=pq. Combining with apq+bpr+cqr=1apq+bpr+cqr=1,we can get np1=c(modp),nq1=b(modq),nr1=a(modr)n_p^{-1}=c(modp),n_q^{-1}=b(modq),n_r^{-1}=a(modr).

To sum up,combining with the Chinese Remainder Theorem, we can see:

M=Mpnpnp1+Mqnqnq1+Mrnrnr1(modn)=Mp(qr)c+Mq(pr)b+Mr(pq)a(modn)=cqrMp+bprMq+apqMr(modn)\begin{aligned} \begin{array}{l} M&=M_pn_pn_p^{-1}+M_qn_qn_q^{-1}+M_rn_rn_r^{-1} (modn)\\ &=M_p(qr)c+M_q(pr)b+M_r(pq)a(modn)\\ &=cqrM_p+bprM_q+apqM_r(modn) \end{array} \end{aligned}

That is, the above encryption is correct because we can get the proof of M=MM^{'}=M.

c.

  • According to gcd(p,q)=1gcd(p,q)=1x,y,s.t.xp+yq=1\exists x,y,s.t.xp+yq=1
  • Easy to know gcd(pq,r)=1gcd(pq,r)=1s,t, s.t.s(pq)+tr=1\exists s,t,\ s.t.s(pq)+tr=1

We do the following calculations:

1=s(pq)+tr=s(pq)+tr(xp+yq)=s(pq)+tx(pr)+ty(qr)\begin{aligned} \begin{array}{l} 1&=s(pq)+tr\\ &=s(pq)+tr(xp+yq)\\ &=s(pq)+tx(pr)+ty(qr) \end{array} \end{aligned}

Then,a=s,b=tx,c=tya=s,b=tx,c=ty are the integers.

Problem 4

a:

According to the Jacobi symbol:

n=pq,(Mn)=(Mp)(Mq)n=pq,\rightarrow \left(\frac{M}{n}\right)=\left(\frac{M}{p}\right)\left(\frac{M}{q}\right)

Because of gcd(e,φ(n))=1gcd(e,\varphi(n))=1,we can infer that ee is prime.

From the fact that both pp and qq are odd prime numbers:

  • If MqM|q or MpM|p, we can get (0e=00^e=0), so the original formula clearly holds。
  • If (Mp)=1,(Mq)=1\left(\frac{M}{p}\right)=-1,\left(\frac{M}{q}\right)=-1,the original formula holds because of [(1)(1)]e=[(1)(1)][(-1)(-1)]^e=[(-1)(-1)].
  • If (Mp)=1,(Mq)=1\left(\frac{M}{p}\right)=1,\left(\frac{M}{q}\right)=-1,the original formula holds because of[(1)(1)]e=[(1)(1)][(1)(-1)]^e=[(1)(-1)].
  • If (Mp)=1,(Mq)=1\left(\frac{M}{p}\right)=-1,\left(\frac{M}{q}\right)=1,the original formula holds because of[(1)(1)]e=[(1)(1)][(-1)(1)]^e=[(-1)(1)].
  • If (Mp)=1,(Mq)=1\left(\frac{M}{p}\right)=1,\left(\frac{M}{q}\right)=1,the original formula holds because of[(1)(1)]e=[(1)(1)][(1)(1)]^e=[(1)(1)].

b:

According to C=Me+knC=M^e+kn, we can prove as follow combining with the conclusion of (a):

(Cn)=(Me+knn)=(Men)=(Mn)e=(Mn)\left(\frac{C}{n}\right)=\left(\frac{M^e+kn}{n}\right)=\left(\frac{M^e}{n}\right)=\left(\frac{M}{n}\right)^e=\left(\frac{M}{n}\right)

c:

RSA is not semantically secure:

Assuming we know the plain/ciphertext pairs,(M1,C1),(M2,C2)(M_1,C_1),(M_2,C_2), then we can forge information by setting M=M1M2M=M_1M_2.

We can get the ciphertext of MM as follow:CM=(M1M2)e=M1eM2e=C1C2(modn)C_M=(M_1M_2)^e=M_1^eM_2^e=C_1C_2(modn)


Defeat polynomial security:

Suppose the adversary A randomly selects the quadratic non-residue rr and mm on modulo n:

  • Let M0=rm,M1=MM_0=rm,M_1=M, and send them to the user.
  • The user will select one of them and send its cipertext MbM_b to A.
  • A will compute result=(Mbn)result=\left(\frac{M_b}{n}\right).If result=1result=-1,M1M_1 is encrypted,otherwise M0M_0 is encrypted.

Proof as follows:

  • If M0M_0 is encrypted,Mb=M0e(modn)M_b=M_0^e(modn).

    According to the result of (b),A can compute (Mbn)=(rmn)=(mn)(rn)=(1)(1)=1\left(\frac{M_b}{n}\right)=\left(\frac{rm}{n}\right)=\left(\frac{m}{n}\right)\left(\frac{r}{n}\right)=(-1)(-1)=1

  • If M1M_1 is encrypted,Mb=M1e(modn)M_b=M_1^e(modn).

    According to the result of (b),A can compute(Mbn)=(mn)=1\left(\frac{M_b}{n}\right)=\left(\frac{m}{n}\right)=-1

  • Adversary A can distinguish the source of the encrypted message every time, which is a polynomial security attack.

Problem 5

a.

Yes,because rZn,s.t.N=r2(modn)\exists r \in Z^*_n,s.t. N = r^2(modn)

b.

Proof by contradiction.

Assuming N=yr2(modn)N=yr^2(modn) is a quadratic residue,tZn,s.t.t2=yr2(modn)\exists t\in Z^*_n,s.t.t^2=yr^2(modn) will hold.

And then we can compute yy because y=(tr1)2(modn)y=(tr^{-1})^2(modn). We can get the conclusion that yy is also a quadratic residue contrary to the statement of the question.

So NN is a pseudosquare modulo nn.

c.

  • Bob will compute result=(Np)result=\left(\frac{N}{p}\right) after receiving the pp.
  • If result=1result=1,the outcome of Alice’s coin is “heads", if result=1result=-1,the outcome is ”tails“.

d.

Determine whether NN is a quadratic residue modulo nn.

If NN is a quadratic residue ,send “heads” to Alice,otherwise “tails”.

e.

1.p=71,q=89

(5086319)=(50871)(50889)=(11+71771)(895+6389)=(1171)(6389)\left(\frac{508}{6319}\right)=\left(\frac{508}{71}\right)\left(\frac{508}{89}\right)=\left(\frac{11+71*7}{71}\right)\left(\frac{89*5+63}{89}\right)=\left(\frac{11}{71}\right)\left(\frac{63}{89}\right)

Compute (11/71)(11/71) and (63/89) as follow:

(11/71)=(5/11)=(1/5)=1(11/71) = -(5/11) = -(1/5) = -1

(63/89)=(26/63)=(13/63)=(11/13)=(2/11)=(1/11)=1(63/89) = (26/63) = (13/63) = (11/13) = (2/11) = -(1/11) = -1

Because (5086319)=(1)(1)=1\left(\frac{508}{6319}\right)=(-1)(-1)=1, 508 is a pseudosquare modulo 6319.

(62456319)=(624571)(624589)=(6871)(1589)\left(\frac{6245}{6319}\right)=\left(\frac{6245}{71}\right)\left(\frac{6245}{89}\right)=\left(\frac{68}{71}\right)\left(\frac{15}{89}\right)

Compute (68/71)(68/71) and (15/89)(15/89) as follow:

(68/71)=(34/71)=(17/71)=(3/17)=(2/3)=(1/3)=1(68/71) = (34/71) = (17/71) = (3/17) = (2/3) = -(1/3) = -1

(15/89)=(14/15)=(7/15)=(1/7)=1(15/89) = (14/15) = (7/15) = -(1/7) = -1

Because (62456319)=(1)(1)\left(\frac{6245}{6319}\right)=(-1)(-1),the outcome of coin is “tails”.

Problem 6

a.

According to hz=x(modφ(p))hz=x(mod\varphi(p)),

so sh=ghz(modp)=gx(modp)=y(modp)s^h=g^{hz}(modp)=g^x(modp)=y(modp)

b.

Use the extend Euclidean algorithm to find the inverse of 17 modulo φ(p)\varphi(p)

1=522=75217=7229171=5-2*2=7*5-2*17=7*22-9*17

so h1=(9)(mod22)=13h^{-1}=(-9)(mod22)=13.

According to hz=x(mod(p1))hz=x(mod(p-1))

we can compute zz as z=xh1(mod(p1))=1013mod22=20z=xh^{-1}(mod(p-1))=10*13mod22=20

And then s=gz(modp)=520mod23=523152mod23=(25mod23)1(mod23)=12s=g^z(modp)=5^{20}mod23=5^{23-1}*5^{-2}mod23=(25mod23)^{-1}(mod23)=12

c.

s=yh(modp)s=y^{-h}(modp)

Problem 7

a.

Xi+1aXi+b(mod m)Xi+2aXi+1+b(mod m)\begin{aligned} X_{i+1}&\equiv aX_{i}+b(mod\ m)\\ X_{i+2}&\equiv aX_{i+1}+b(mod\ m)\\ \end{aligned}

Easy to know:Xi+2Xi+1=a(Xi+1Xi)(modm)X_{i+2}-X_{i+1}=a(X_{i+1}-X_i)(modm),so we can get the information:89=100a(mod1023)-89=100a(mod1023)

Use the extend Euclidean algorithm to find the inverse of 100 modulo 1023:

1023=10010+23100=234+823=82+78=7+1\begin{aligned} 1023&=100*10+23\\ 100&=23*4+8\\ 23&=8*2+7\\ 8&=7+1 \end{aligned}

So the follow will hold:

1=87=8323=10032313=100133102313\begin{aligned} 1&=8-7\\ &=8*3-23\\ &=100*3-23*13\\ &=100*133-1023*13 \end{aligned}

That’s mean 1001=133(mod1023)100^{-1}=133(mod1023).

a=(89)1001(mod1023)=439(mod1023)a=(-89)*100^{-1}(mod1023)=439(mod1023)

According to Xi+1=aXi+b(mod m)X_{i+1}= aX_{i}+b(mod\ m)b=418439318(mod1023)=967b=418-439*318(mod1023)=967


Check the answer:

aXi+1+b=(439418+967)(mod1023)=429=Xi+2aX_{i+1}+b=(439*418+967)(mod1023)=429=X_{i+2}

b.

  • According to the result of (a),the whole linear congruential pseudorandom number generator will be known easily if three consecutive numbers are acquired.
  • The sequence period TT is less than or equal to the modulo mm.