<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="generator" content="pdf2htmlEX">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css">
<link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css">
<link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/6253725074bc5c0105f97074/raw.css">
<script src="https://static.pudn.com/base/js/compatibility.min.js"></script>
<script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script>
<script>
try{
pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({});
}catch(e){}
</script>
<title></title>
</head>
<body>
<div id="sidebar" style="display: none">
<div id="outline">
</div>
</div>
<div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6253725074bc5c0105f97074/bg1.jpg"><div class="t m0 x1 h2 y1 ff1 fs0 fc0 sc0 ls0 ws0">信<span class="_"> </span>息<span class="_"> </span>保<span class="_ _0"> </span>障<span class="_"> </span>和<span class="_ _0"> </span>安<span class="_"> </span>全</div><div class="t m0 x2 h3 y2 ff1 fs1 fc0 sc0 ls0 ws0">实</div><div class="t m0 x2 h3 y3 ff1 fs1 fc0 sc0 ls0 ws0">验</div><div class="t m0 x2 h3 y4 ff1 fs1 fc0 sc0 ls0 ws0">报</div><div class="t m0 x3 h3 y5 ff1 fs1 fc0 sc0 ls0 ws0">告</div><div class="t m0 x4 h4 y6 ff1 fs2 fc0 sc0 ls0 ws0">学院名称<span class="_ _1"> </span><span class="fs3">计算机<span class="_ _2"></span>科学<span class="_ _2"></span>与技术<span class="_ _2"></span>学院</span></div><div class="t m0 x4 h4 y7 ff1 fs2 fc0 sc0 ls0 ws0">专<span class="_ _3"> </span>业<span class="_"> </span><span class="fs3">计<span class="_ _2"></span>算机科<span class="_ _2"></span>学与技<span class="_ _2"></span>术</span></div><div class="t m0 x4 h4 y8 ff1 fs2 fc0 sc0 ls0 ws0">学生姓名<span class="_ _4"> </span><span class="fs3">杨毅</span></div><div class="t m0 x4 h4 y9 ff1 fs2 fc0 sc0 ls0 ws0">学<span class="_ _3"> </span>号<span class="_ _3"> </span><span class="ff2 fs3 sc1">301321<span class="_ _2"></span>6112</span></div><div class="t m0 x4 h4 ya ff1 fs2 fc0 sc0 ls0 ws0">年<span class="_"> </span>班<span class="_"> </span>级<span class="_ _3"> </span><span class="ff2 fs3 sc1">20<span class="_ _2"></span>13<span class="_ _5"> </span></span><span class="fs3">级<span class="_ _5"> </span><span class="ff2 sc1">4<span class="_ _6"> </span></span>班</span></div><div class="t m0 x5 h4 yb ff2 fs2 fc0 sc1 ls0 ws0">2016<span class="_ _7"> </span><span class="ff1 sc0">年<span class="_"> </span></span>06<span class="_ _7"> </span><span class="ff1 sc0">月<span class="_"> </span></span>08<span class="_"> </span><span class="ff1 sc0">日</span></div></div><div class="pi" data-data='{"ctm":[1.611830,0.000000,0.000000,1.611830,0.000000,0.000000]}'></div></div>
</body>
</html>
<div id="pf2" class="pf w0 h0" data-page-no="2"><div class="pc pc2 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6253725074bc5c0105f97074/bg2.jpg"><div class="t m0 x6 h5 yc ff1 fs4 fc0 sc1 ls0 ws0">一、<span class="_ _2"></span>实验名称及要求<span class="_ _2"></span>:</div><div class="t m0 x7 h6 yd ff1 fs5 fc0 sc1 ls0 ws0">本次实验主要利用<span class="_ _8"> </span><span class="ff3">C++</span>编程语言实现了密钥长度为<span class="_ _9"> </span>192<span class="_ _8"> </span>位的<span class="_ _8"> </span><span class="ff3">AES<span class="_ _9"> </span></span>加密算法。<span class="_ _a"></span>实</div><div class="t m0 x6 h6 ye ff1 fs5 fc0 sc1 ls0 ws0">验要求比较简单,简而言之,就是输入长度为<span class="_ _8"> </span>128<span class="_ _8"> </span>位的明文以及长度为<span class="_ _8"> </span>192<span class="_ _9"> </span>位的密</div><div class="t m0 x6 h6 yf ff1 fs5 fc0 sc1 ls0 ws0">钥,要求输出加密后的长度为<span class="_ _8"> </span>128<span class="_ _8"> </span>位的密文。要求所有的输入和输出都用十六进制</div><div class="t m0 x6 h6 y10 ff1 fs5 fc0 sc1 ls0 ws0">表示,而且要分别输出<span class="_ _8"> </span>12<span class="_ _8"> </span>轮加密过程中每轮加密过后的密文。具体示例图如下:</div><div class="c x0 y11 w0 h7"><div class="t m0 x6 h5 y12 ff1 fs4 fc0 sc1 ls0 ws0">二、<span class="_ _2"></span>算法原理:</div></div><div class="t m0 x8 h6 y13 ff1 fs5 fc0 sc1 ls0 ws0">密钥长度为<span class="_ _8"> </span>192<span class="_ _8"> </span>位的<span class="_ _9"> </span>AES<span class="_ _8"> </span>算法基本流程框图如图二所示。输入<span class="_ _9"> </span>128<span class="_ _8"> </span>位的明文和</div><div class="t m0 x6 h6 y14 ff1 fs5 fc0 sc1 ls0 ws0">192<span class="_ _8"> </span>位的密钥,首先对明文和密钥分组,分别形成<span class="_ _8"> </span>4×4<span class="_ _8"> </span>和<span class="_ _9"> </span>4×6<span class="_ _8"> </span>的矩阵。如测试用</div><div class="t m0 x6 h6 y15 ff1 fs5 fc0 sc1 ls0 ws0">例输入明文:</div><div class="t m0 x9 h8 y16 ff3 fs5 fc0 sc1 ls0 ws0">00<span class="_ _8"> </span>11<span class="_ _8"> </span>22<span class="_ _8"> </span>33<span class="_ _8"> </span>44<span class="_ _8"> </span>55<span class="_ _8"> </span>66<span class="_ _9"> </span>77<span class="_ _8"> </span>88<span class="_ _9"> </span>99<span class="_ _8"> </span>aa<span class="_ _8"> </span>bb<span class="_ _9"> </span>cc<span class="_ _8"> </span>dd<span class="_ _9"> </span>ee<span class="_ _8"> </span>f<span class="_ _b"></span>f</div><div class="t m0 xa h6 y15 ff1 fs5 fc0 sc1 ls0 ws0">,<span class="_ _b"></span>密钥:</div><div class="t m0 xb h8 y16 ff3 fs5 fc0 sc1 ls0 ws0">00<span class="_ _8"> </span>01<span class="_ _8"> </span>02<span class="_ _8"> </span>03<span class="_ _9"> </span>04<span class="_ _8"> </span>05</div><div class="t m0 x6 h6 y17 ff3 fs5 fc0 sc1 ls0 ws0">06<span class="_ _8"> </span>07<span class="_ _8"> </span>08<span class="_ _8"> </span>09<span class="_ _9"> </span>0a<span class="_ _9"> </span>0b<span class="_ _8"> </span>0c<span class="_ _8"> </span>0d<span class="_ _8"> </span>0e<span class="_ _9"> </span>0f<span class="_ _8"> </span>10<span class="_ _9"> </span>11<span class="_ _c"> </span>12<span class="_ _8"> </span>13<span class="_ _8"> </span>14<span class="_ _9"> </span>15<span class="_ _8"> </span>16<span class="_ _9"> </span>17<span class="ff1">,生成的矩阵分别为:</span></div><div class="t m0 x8 h6 y18 ff1 fs5 fc0 sc1 ls0 ws0">然后将明文矩阵与前<span class="_ _8"> </span>4<span class="_ _8"> </span>列密钥矩阵<span class="_ _9"> </span>K0<span class="_ _8"> </span>进行异或运算得到第<span class="_ _9"> </span>0<span class="_ _8"> </span>组密文<span class="_ _9"> </span>M0,<span class="_ _d"></span>接下来</div><div class="t m0 x6 h6 y19 ff1 fs5 fc0 sc1 ls0 ws0">进行十二轮加密,其中前十一轮加密步骤一样,都包括四步,分别是:字节替换,</div><div class="t m0 x6 h6 y1a ff1 fs5 fc0 sc1 ls0 ws0">行移位,列混淆和轮密钥加。第十二轮只包括三个步骤,分别是:字节替换,行移</div><div class="t m0 x6 h6 y1b ff1 fs5 fc0 sc1 ls0 ws0">位,<span class="_ _e"></span>轮密钥加。<span class="_ _e"></span>这样就可以分别得到实验要求的十二轮密文输出<span class="_ _9"> </span>M1-M12。<span class="_ _e"></span>每一轮的</div><div class="t m0 x6 h6 yb ff1 fs5 fc0 sc1 ls0 ws0">字节变换,行移位,列混淆,轮密钥加原理一样,上一轮的输出作为下一轮的输入</div><div class="t m0 x6 h6 y1c ff1 fs5 fc0 sc1 ls0 ws0">循环进行,下面一一介绍这四种操作的基本原理:</div><div class="c xc y1d w2 h9"><div class="t m0 xd h8 y1e ff3 fs5 fc0 sc1 ls0 ws0">00</div></div><div class="c xe y1d w2 h9"><div class="t m0 xd h8 y1e ff3 fs5 fc0 sc1 ls0 ws0">44</div></div><div class="c xf y1d w2 h9"><div class="t m0 xd h8 y1e ff3 fs5 fc0 sc1 ls0 ws0">88</div></div><div class="c x10 y1d w2 h9"><div class="t m0 xd h8 y1e ff3 fs5 fc0 sc1 ls0 ws0">cc</div></div><div class="c xc y1f w2 h9"><div class="t m0 xd h8 y20 ff3 fs5 fc0 sc1 ls0 ws0">11</div></div><div class="c xe y1f w2 h9"><div class="t m0 xd h8 y20 ff3 fs5 fc0 sc1 ls0 ws0">55</div></div><div class="c xf y1f w2 h9"><div class="t m0 xd h8 y20 ff3 fs5 fc0 sc1 ls0 ws0">99</div></div><div class="c x10 y1f w2 h9"><div class="t m0 xd h8 y20 ff3 fs5 fc0 sc1 ls0 ws0">dd</div></div><div class="c xc y21 w2 h9"><div class="t m0 xd h8 y22 ff3 fs5 fc0 sc1 ls0 ws0">22</div></div><div class="c xe y21 w2 h9"><div class="t m0 xd h8 y22 ff3 fs5 fc0 sc1 ls0 ws0">66</div></div><div class="c xf y21 w2 h9"><div class="t m0 xd h8 y22 ff3 fs5 fc0 sc1 ls0 ws0">aa</div></div><div class="c x10 y21 w2 h9"><div class="t m0 xd h8 y22 ff3 fs5 fc0 sc1 ls0 ws0">ee</div></div><div class="c xc y23 w2 ha"><div class="t m0 xd h8 y24 ff3 fs5 fc0 sc1 ls0 ws0">33</div></div><div class="c xe y23 w2 ha"><div class="t m0 xd h8 y24 ff3 fs5 fc0 sc1 ls0 ws0">77</div></div><div class="c xf y23 w2 ha"><div class="t m0 xd h8 y24 ff3 fs5 fc0 sc1 ls0 ws0">bb</div></div><div class="c x10 y23 w2 ha"><div class="t m0 xd h8 y24 ff3 fs5 fc0 sc1 ls0 ws0">f<span class="_ _b"></span>f</div></div><div class="c x11 y25 w3 hb"><div class="t m0 xd h8 y26 ff3 fs5 fc0 sc1 ls0 ws0">00</div></div><div class="c x12 y25 w4 hb"><div class="t m0 xd h8 y26 ff3 fs5 fc0 sc1 ls0 ws0">04</div></div><div class="c x13 y25 w3 hb"><div class="t m0 xd h8 y26 ff3 fs5 fc0 sc1 ls0 ws0">08</div></div><div class="c x14 y25 w3 hb"><div class="t m0 xd h8 y26 ff3 fs5 fc0 sc1 ls0 ws0">0c</div></div><div class="c x15 y25 w4 hb"><div class="t m0 xd h8 y26 ff3 fs5 fc0 sc1 ls0 ws0">10</div></div><div class="c x16 y25 w3 hb"><div class="t m0 xd h8 y26 ff3 fs5 fc0 sc1 ls0 ws0">14</div></div><div class="c x11 y27 w3 hb"><div class="t m0 xd h8 y28 ff3 fs5 fc0 sc1 ls0 ws0">01</div></div><div class="c x12 y27 w4 hb"><div class="t m0 xd h8 y28 ff3 fs5 fc0 sc1 ls0 ws0">05</div></div><div class="c x13 y27 w3 hb"><div class="t m0 xd h8 y28 ff3 fs5 fc0 sc1 ls0 ws0">09</div></div><div class="c x14 y27 w3 hb"><div class="t m0 xd h8 y28 ff3 fs5 fc0 sc1 ls0 ws0">0d</div></div><div class="c x15 y27 w4 hb"><div class="t m0 xd h8 y28 ff3 fs5 fc0 sc1 ls0 ws0">11</div></div><div class="c x16 y27 w3 hb"><div class="t m0 xd h8 y28 ff3 fs5 fc0 sc1 ls0 ws0">15</div></div><div class="c x11 y29 w3 hb"><div class="t m0 xd h8 y2a ff3 fs5 fc0 sc1 ls0 ws0">02</div></div><div class="c x12 y29 w4 hb"><div class="t m0 xd h8 y2a ff3 fs5 fc0 sc1 ls0 ws0">06</div></div><div class="c x13 y29 w3 hb"><div class="t m0 xd h8 y2a ff3 fs5 fc0 sc1 ls0 ws0">0a</div></div><div class="c x14 y29 w3 hb"><div class="t m0 xd h8 y2a ff3 fs5 fc0 sc1 ls0 ws0">0e</div></div><div class="c x15 y29 w4 hb"><div class="t m0 xd h8 y2a ff3 fs5 fc0 sc1 ls0 ws0">12</div></div><div class="c x16 y29 w3 hb"><div class="t m0 xd h8 y2a ff3 fs5 fc0 sc1 ls0 ws0">16</div></div><div class="c x11 y2b w3 hc"><div class="t m0 xd h8 y2c ff3 fs5 fc0 sc1 ls0 ws0">03</div></div><div class="c x12 y2b w4 hc"><div class="t m0 xd h8 y2c ff3 fs5 fc0 sc1 ls0 ws0">07</div></div><div class="c x13 y2b w3 hc"><div class="t m0 xd h8 y2c ff3 fs5 fc0 sc1 ls0 ws0">0b</div></div><div class="c x14 y2b w3 hc"><div class="t m0 xd h8 y2c ff3 fs5 fc0 sc1 ls0 ws0">0f</div></div><div class="c x15 y2b w4 hc"><div class="t m0 xd h8 y2c ff3 fs5 fc0 sc1 ls0 ws0">13</div></div><div class="c x16 y2b w3 hc"><div class="t m0 xd h8 y2c ff3 fs5 fc0 sc1 ls0 ws0">17</div></div><div class="c x17 y2d w5 hd"><div class="t m0 x18 he y2e ff1 fs6 fc0 sc1 ls0 ws0">明文<span class="_ _7"> </span>(128bits)</div></div><div class="c x19 y2f w6 hf"><div class="t m0 x18 he y30 ff1 fs6 fc0 sc1 ls0 ws0">密钥(192<span class="_ _b"></span>bits)</div></div><div class="c x1a y31 w7 h10"><div class="t m0 x18 he y32 ff1 fs6 fc0 sc1 ls0 ws0">第十<span class="_ _b"></span>二轮加<span class="_ _b"></span>密</div></div><div class="c x1b y33 w8 h11"><div class="t m0 x18 he y34 ff1 fs6 fc0 sc1 ls0 ws0">密文<span class="_ _c"> </span>M1<span class="_ _7"> </span>(128bits<span class="_ _b"></span>)</div></div><div class="c x1c y35 w8 h11"><div class="t m0 x18 he y36 ff1 fs6 fc0 sc1 ls0 ws0">密文<span class="_ _c"> </span>M2<span class="_ _7"> </span>(128bits<span class="_ _b"></span>)</div></div><div class="c x1d y37 w9 h12"><div class="t m1 x1e h13 y38 ff4 fs7 fc0 sc1 ls0 ws0">...</div></div><div class="c x1c y39 w8 h11"><div class="t m0 x18 he y3a ff1 fs6 fc0 sc1 ls0 ws0">密文<span class="_ _c"> </span>M1<span class="_ _b"></span>2<span class="_"> </span>(128bi<span class="_ _b"></span>ts)</div></div><div class="c x1f y3b wa h14"><div class="t m0 x18 h15 y3c ff1 fs8 fc0 sc1 ls0 ws0">图<span class="_ _c"> </span><span class="ff4">1<span class="_ _0"> </span></span>实验要求<span class="_ _b"></span>流程<span class="_ _b"></span>图</div></div><div class="c x20 y3d w7 h10"><div class="t m0 x21 he y3e ff1 fs6 fc0 sc1 ls0 ws0">第一<span class="_ _b"></span>轮加密</div></div><div class="c x20 y3f w7 h10"><div class="t m0 x21 he y40 ff1 fs6 fc0 sc1 ls0 ws0">第二<span class="_ _b"></span>轮加密</div></div></div><div class="pi" data-data='{"ctm":[1.611830,0.000000,0.000000,1.611830,0.000000,0.000000]}'></div></div>
<div id="pf3" class="pf w0 h0" data-page-no="3"><div class="pc pc3 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/6253725074bc5c0105f97074/bg3.jpg"><div class="c x0 y41 w0 h7"><div class="t m0 x6 h5 y42 ff1 fs4 fc0 sc1 ls0 ws0">1、<span class="fs5">字节变换:</span></div></div><div class="t m0 x8 h6 yb ff1 fs5 fc0 sc1 ls0 ws0">字节变换主要通过如图<span class="_ _8"> </span>3<span class="_ _8"> </span>所示的字节变换表<span class="_ _e"></span>(S<span class="_ _8"> </span>盒)<span class="_ _f"></span>完成字节的替换,<span class="_ _f"></span>如:<span class="_ _f"></span>对于</div><div class="t m0 x6 h6 y1c ff1 fs5 fc0 sc1 ls0 ws0">十六进制数<span class="_ _8"> </span>0x2a,高四位代表行数<span class="_ _8"> </span>2,低四位代表列数<span class="_ _8"> </span>a,所以将其替换为字节变</div><div class="t m0 x6 h6 y43 ff1 fs5 fc0 sc1 ls0 ws0">换表中对应的第<span class="_ _8"> </span>2<span class="_ _8"> </span>行第<span class="_ _8"> </span>a<span class="_ _9"> </span>列的数(S<span class="_ _8"> </span>盒中行数为<span class="_ _9"> </span>0-f,列数为<span class="_ _8"> </span>0-f):229</div><div class="c x22 y44 wb h11"><div class="t m0 x18 h16 y45 ff4 fs8 fc0 sc1 ls0 ws0">K12(12<span class="_ _b"></span>8bits)</div></div><div class="c x23 y46 w7 h10"><div class="t m0 x24 h17 y47 ff4 fs6 fc0 sc1 ls0 ws0">128bits</div><div class="t m0 x25 he y40 ff1 fs6 fc0 sc1 ls0 ws0">明文</div></div><div class="c x26 y48 wa h14"><div class="t m0 x18 h15 y49 ff1 fs8 fc0 sc1 ls0 ws0">图<span class="_ _c"> </span><span class="ff4">2<span class="_ _10"> </span></span>算法主要流程<span class="_ _b"></span>图</div></div><div class="c x27 y4a wc h18"><div class="t m0 x18 h17 y4b ff4 fs6 fc0 sc1 ls0 ws0">K0<span class="_ _11"> </span>(128bits)</div></div><div class="c x23 y4c w7 h10"><div class="t m0 x24 he y4d ff4 fs6 fc0 sc1 ls0 ws0">128bits<span class="_ _11"> </span><span class="ff1">明文</span></div></div><div class="c x28 y4e w7 h10"><div class="t m0 x29 he y4f ff1 fs6 fc0 sc1 ls0 ws0">字节<span class="_ _b"></span>替换</div></div><div class="c x23 y50 w7 h10"><div class="t m0 x2a he y51 ff1 fs6 fc0 sc1 ls0 ws0">行移<span class="_ _b"></span>位</div></div><div class="c x23 y52 w7 h10"><div class="t m0 x2a he y53 ff1 fs6 fc0 sc1 ls0 ws0">列混<span class="_ _b"></span>淆</div></div><div class="c x23 y54 w7 h10"><div class="t m0 x21 he y40 ff1 fs6 fc0 sc1 ls0 ws0">轮密<span class="_ _b"></span>钥加密</div></div><div class="c x2b y55 wd hd"><div class="t m0 x18 he y56 ff1 fs6 fc0 sc1 ls0 ws0">第一<span class="_ _b"></span>轮加密</div></div><div class="c x2c y57 wb h11"><div class="t m0 x18 h16 y58 ff4 fs8 fc0 sc1 ls0 ws0">K1<span class="_ _c"> </span>(12<span class="_ _b"></span>8bits)</div></div><div class="c x2 y59 w9 h19"><div class="t m1 x1e h13 y5a ff4 fs7 fc0 sc1 ls0 ws0">...</div></div><div class="c x23 y5b w7 h10"><div class="t m0 x29 he y4f ff1 fs6 fc0 sc1 ls0 ws0">字节<span class="_ _b"></span>替换</div></div><div class="c x23 y5c w7 h10"><div class="t m0 x2a he y40 ff1 fs6 fc0 sc1 ls0 ws0">行移<span class="_ _b"></span>位</div></div><div class="c x23 y5d w7 h10"><div class="t m0 x2a he y53 ff1 fs6 fc0 sc1 ls0 ws0">列混<span class="_ _b"></span>淆</div></div><div class="c x2d y5e we h1a"><div class="t m0 x18 he y5f ff1 fs6 fc0 sc1 ls0 ws0">第二<span class="_ _b"></span>轮加密</div></div><div class="c x23 y60 w7 h10"><div class="t m0 x21 he y4f ff1 fs6 fc0 sc1 ls0 ws0">轮密<span class="_ _b"></span>钥加密</div></div><div class="c x2e y61 wb h11"><div class="t m0 x18 h16 y62 ff4 fs8 fc0 sc1 ls0 ws0">K2(128<span class="_ _b"></span>bits)</div></div><div class="c x2f y63 w7 h10"><div class="t m0 x29 he y40 ff1 fs6 fc0 sc1 ls0 ws0">字节<span class="_ _b"></span>变换</div></div><div class="c x2f y64 w7 h10"><div class="t m0 x2a he y32 ff1 fs6 fc0 sc1 ls0 ws0">行移<span class="_ _b"></span>位</div></div><div class="c x2f y65 w7 h10"><div class="t m0 x21 he y66 ff1 fs6 fc0 sc1 ls0 ws0">轮密<span class="_ _b"></span>钥加密</div></div><div class="c x30 y67 wf h1b"><div class="t m0 x18 he y68 ff1 fs6 fc0 sc1 ls0 ws0">第十<span class="_ _b"></span>二轮加<span class="_ _b"></span>密</div></div></div><div class="pi" data-data='{"ctm":[1.611830,0.000000,0.000000,1.611830,0.000000,0.000000]}'></div></div>