密码学第五部份课后答案.docx
《密码学第五部份课后答案.docx》由会员分享,可在线阅读,更多相关《密码学第五部份课后答案.docx(12页珍藏版)》请在冰豆网上搜索。
密码学第五部份课后答案
已知下面的密文由单表代换算法产生:
请将它破译。
提示:
1、正如你所知,英文中最多见的字母是e。
因此,密文第一个或第二个(或许第三个)显现频率最高的字符应该代表e。
另外,e常常成对显现(如meet,fleet,speed,seen,been,agree,等等)。
找出代表e的字符,并第一将它译出来。
2、英文中最多见的单词是“the”。
利用那个事实猜出什么字母t和h。
3、依照已经取得的结果破译其他部份。
解:
由题意分析:
“8”显现次数最多,对应明文为“e”,“;48”代表的明文为“the”,“)”、“*”、“5”显现频率都比较高,别离对应“s”、“n”、“a”,由此破译出密文对应的明文为:
AgoodglassintheBishop’shostelintheDevil’sseat-twenty-onedegreesandthirteenminutes-northeastandbynorth-mainbranchseventhlimbeastside-shootfromthelefteyeofthedeath’shead-abeelinefromthetreethroughtheshotfiftyfeetout.
在多罗的怪诞小说中,有一个故事是如此的:
地主彼得碰到了以下图所示的消息,他找到了密钥,是一段整数:
3211234
a.破译这段消息。
提示:
最大的整数是什么?
b.若是只明白算法而不明白密钥,这种加密方案的平安性怎么样?
c.若是只明白密钥而不明白算法,这种加密方案的平安性又怎么样?
解:
A.依照提示,将密文排成每行8字母的矩阵,密钥代表矩阵中每行应取的字母,依次取相应字母即可得明文。
明文为:
HesittethbetweentheislesmaybegladtheriversintheSouth.
B.平安性专门好。
假设密文的字母数为8n,那么共有
种可能的密钥,不易攻破。
C.平安性较差。
将字母总数与密钥总数相除,得每组8个字母,即可破译。
那个问题给出了用一轮DES加密的具体数字的例子。
假设明文和密钥K有相同的位模式,即:
用十六进制表示:
0123456789ABCDEF
用二进制表示:
00000001001000110100010101100111
10001001101010111100110111101111
a.推导第一轮的子密钥
解:
通过表(b)PC-1置换,得:
C0:
00
D0:
00
通过表(d)左移,得:
C1’:
00
D1’:
00
通过表(c)置换选择,得:
K1:
000010110000001001100111100110110100100110100101
用十进制表示为:
0B02679B49A5
b.推导L0,R0
解:
通过表(a)置换,得
L0:
11001100000000001100110011111111
R0:
11110000101010101111000010101010
c.扩展R0求E(R0)
解:
依照表(C)扩充置换,得:
E(R0)=01110100001010101010101011110100001010101010101
d.计算A=E(R0)
K1
解:
依照a、c可得
A=011100010001011100110010111000010101110011110000
e.把(d)的48位结果分成6位(数据)的集归并求对应S盒代换的值
解:
依照表盒代换得
(1110)=
(14)=0(10进制)=0000(2进制)
(1000)=
(8)=12(10进制)=1100(2进制)
(1110)=
(14)=2(10进制)=0010(2进制)
(1001)=
(9)=1(10进制)=0001(2进制)
(1100)=
(12)=6(10进制)=0110(2进制)
(1010)=
(10)=13(10进制)=1101(2进制)
(1001)=
(9)=5(10进制)=0101(2进制)
(1000)=
(8)=0(10进制)=0000(2进制)
f.利用(e)的结论来求32位的结果B
解:
B=00001100001000010110110101010000
g.利用置换求P(B)
解:
依照表(d),得
P(B)=10010010000111000010000010011100
h.计算R1=P(B)
L0
解:
R1=01011110000111001110110001100011
i.写出密文
解:
L1=R0,连接L一、R1可得密文为:
MEYE82
16个密钥(K一、K2……K16)在DSE解密进程中是逆序利用的。
因此,图的右半部份再也不正确。
请仿照表(d)为解密进程设计一个适合的密钥移位扩展方案。
解:
选代轮数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
移位次数
0
1
2
2
2
2
2
2
1
2
2
2
2
2
2
1
(a)
解:
T16(L15||R15)=L16||R16
T17(L16||R16)=R16||L16
IP[IP–1(R16||L16)]=R16||L16
TD1(R16||L16)=L16||R16f(L16,K16)=R15||L15f(R15,K16)f(R15,K16)=R15||L15
(b)
解:
T16(L15||R15)=L16||R16
IP[IP–1(L16||R16)]=L16||R16
TD1(R16||L16)=R16||L16f(R16,K16)=L15f(R15,K16)||R15f(R16,K16)≠L15||R15
For1≤i≤128,takeci∈{0,1}128tobethestringcontaininga1inpositioniandthenzeroselsewhere.Obtainthedecryptionofthese128ciphertexts.Letm1,m2,...,m128bethecorrespondingplaintexts.Now,givenanyciphertextcwhichdoesnotconsistofallzeros,thereisauniquenonemptysubsetoftheci’swhichwecanXORtogethertoobtainc.LetI(c)⊆{1,2,...,128}denotethissubset.Observe
Thus,weobtaintheplaintextofcbycomputing
.Let0betheall-zerostring.Notethat0=0⊕0.FromthisweobtainE(0)=E(0⊕0)=E(0)⊕E(0)=0.Thus,theplaintextofc=0ism=0.Hencewecandecrypteveryc∈{0,1}128.
a.gcd(24140,16762)=gcd(16762,7378)=gcd(7378,2006)=gcd(2006,1360)=gcd(1360,646)=gcd(646,68)=gcd(68,34)=gcd(34,0)=34
b.gcd(4655,12075)=gcd(12075,4655)=gcd(4655,2765)=gcd(2765,1890)=gcd(1890,875)=gcd(875,140)=gcd(140,35)=gcd(35,0)=35
a.Euclid:
gcd(2152,764)=gcd(764,624)=gcd(624,140)=gcd(140,64)=gcd(64,12)=gcd(12,4)=gcd(4,0)=4
Stein:
A1=2152,B1=764,C1=1;
A2=1076,B2=382,C2=2;
A3=538,B3=191,C3=4;
A4=269,B4=191,C4=4;
A5=78,B5=191,C5=4;
A6=39,B6=191,C6=4;
A7=152,B7=39,C7=4;
A8=76,B8=39,C8=4;
A9=38,B9=39,C9=4;
A10=19,B10=39,C10=4;
A11=20,B11=19,C11=4;
A12=10,B12=19,C12=4;
A13=5,B13=19,C13=4;
A14=14,B14=5,C14=4;
A15=7,B15=5,C15=4;
A16=2,B16=5,C16=4;
A17=1,B17=5,C17=4;
A18=4,B18=1,C18=4;
A19=2,B19=1,C19=4;
A20=1,B20=1,C20=4;
故gcd(2152,764)=1´4=4
b.在每一步算法中,Euclid算法所进行的除法运算比较复杂,而Stein算法只需完成除以二、相等、求差或取最小值的简单运算,减小了运算复杂度。
a.9x2+7x+7
b.5x3+7x2+2x+6
a.1
b.1
c.x+1
d.x+78
因为Xn+1=(aXn)mod24,易知假设a为偶数,那么通过n轮以后Xn+1必恒等于0,故a必为奇数。
且a<16,别离取a=3,5,7,9,11,13,15,得:
a=3,那么Xn=1,3,9,11,1,3,……或Xn=5,15,13,7,5,15,……
a=5,那么Xn=1,5,9,13,1,5,……或Xn=3,15,11,7,3,15,……
a=7,那么Xn=1,7,1……舍去
a=9,那么Xn=1,9,1……舍去
a=11,那么Xn=1,11,9,3,1,11,……或Xn=5,7,13,15,5,7,……
a=13,那么Xn=1,13,9,5,1,13,……或Xn=3,7,11,15,3,7,……
故:
(a)最大周期为4
(b)a=3或5或11或13
(c)与a必为奇数同理,种子必需为奇数。
两个发生器产生的伪随机数别离为:
1,6,10,8,9,2,12,7,3,5,4,11,1,...
1,7,10,5,9,11,12,6,3,8,4,2,1,...
从中能够看出,第二个发生器产生的伪随机数存在一部份Xn+1=2Xn的现象,因此第一个伪随机数发生器的随机性更好一些。
a==9794mod73
==12
而0
因为φ(35)=24,x^φ(35)==1mod35
因此x^85mod35=(((x^24mod35)^3)*(x^12mod35)*(xmod35))mod35
=(((x^12mod35)*(xmod35))mod35
又因为x^24mod35=1
因此x^12mod35=1或-1
因此x^85mod35=xmod35或-xmod35=6
故x=6或x=29,代入验证得
x=6
因为n=35因此(35)=24
因为ed==1mod(35);e=5因此d=5
因此M=Cdmodn=5
不平安
因为在已知n的情形下易知(n),依照密钥产生原那么:
(1)选择e使其与(n)互素且小于(n)
(2)确信d使得de==1(mod(n))且d<(n)能够得出e、d的可能值,再通过进一步观看即可求出e和d,专门是在n很小的情形下,只需通过简单的计算就能够够破解密钥。
离散对数表如以下图所示:
a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Log2,29(a)
2
4
8
16
3
1
12
24
19
9
18
7
14
28
a
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Log2,29(a)
27
25
21
13
26
23
17
5
10
20
11
22
15
6
B.因为17x2==10(mod29)
因此[dlog2,29(17)+2dlog2,29(x)](mod28)==23
[21+2log2,29(x)](mod28)==23
因此21+2log2,29(x)=23
或21+2log2,29(x)=51
因此x=2或x=27
C.因为x2-4x-16==(0mod29)
因此(x-2)2==(20mod29)
易知x!
=1
因此[2dlog2,29(x-2)](mod28)==24
因此dlog2,29(x-2)=12
或dlog2,29(x-2)=26
因此x=9或x=21
D.因为x7==17(mod29)
因此[7log2,29(x)]==21
因此7log2,29(x)=21或49或77或105或133或161或189
因此x=8或10或12或15或18或26或27
ThisalgorithmisdiscussedintheCESGreportmentionedinChapter6[ELLI99],andisknownasCocksalgorithm.
a.CocksmakesuseoftheChineseremaindertheorem(seeSectionandProblem,whichsaysitispossibletoreconstructintegersinacertainrangefromtheirresiduesmoduloasetofpairwiserelativelyprimemoduli.InparticularforrelativelyprimePandQ,anyintegerMintherange0≤Mb.InRSA,auserformsapairofintegers,dande,suchthat
de1mod((P–1)(Q–1)),andthenpublisheseandNasthepublickey.Cocksisaspecialcaseinwhiche=N.
c.TheRSAalgorithmhasthemeritthatitissymmetrical;thesameprocessisusedbothforencryptionanddecryption,whichsimplifiesthesoftwareneeded.Also,ecanbechosenarbitrarilysothataparticularlysimpleversioncanbeusedforencryptionwiththepublickey.Inthisway,thecomplexprocesswouldbeneededonlyfortherecipient.
d.TheprivatekeykisthepairPandQ;thepublickeyxisN;theplaintextpisM;andtheciphertextzisC.M1isformedbymultiplyingthetwopartsofk,PandQ,together.M2consistsofraisingMtothepowerN(modN).M3istheprocessdescribedintheproblemstatement.
a.(49,57)
b.C2=29
a.Yes.TheXORfunctionissimplyaverticalparitycheck.Ifthereisanoddnumberoferrors,thentheremustbeatleastonecolumnthatcontainsanoddnumberoferrors,andtheparitybitforthatcolumnwilldetecttheerror.NotethattheRXORfunctionalsocatchesallerrorscausedbyanoddnumberoferrorbits.EachRXORbitisafunctionofaunique"spiral"ofbitsintheblockofdata.Ifthereisanoddnumberoferrors,thentheremustbeatleastonespiralthatcontainsanoddnumberoferrors,andtheparitybitforthatspiralwilldetecttheerror.
b.No.ThechecksumwillfailtodetectanevennumberoferrorswhenboththeXORandRXORfunctionsfail.Inorderforbothtofail,thepatternoferrorbitsmustbeatintersectionpointsbetweenparityspiralsandparitycolumnssuchthatthereisanevennumberoferrorbitsineachparitycolumnandanevennumberoferrorbitsineachspiral.
c.Itistoosimpletobeusedasasecurehashfunction;findingmultiplemessageswiththesamehashfunctionwouldbetooeasy.
a.Forclarity,weuseoverbarsforcomplementation.Wehave:
Therefore,thehashfunctionofmessageMwithinitialvalueIisthesameasthehashfunctionformessageNwithinitialvalue
foranygivenI,where
b.ThesamelineofreasoningapplieswiththeMsandHsreversedinthederivation.
a.1.Interchangex1andx4;x2andx3;y1andy4;andy2andy3.
2.ComputeZ=X+Ymod232.
3.Interchangez1andz4;andz2andz3.
b.Youmustusethesamesortofinterchange.