




已閱讀5頁,還剩12頁未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
現(xiàn) 代 密 碼 學(xué)實(shí) 驗(yàn) 報(bào) 告學(xué)生姓名 學(xué) 號(hào) 專業(yè)班級(jí) 指導(dǎo)教師 學(xué) 院 信息科學(xué)與工程學(xué)院 完成時(shí)間 2014年5月實(shí)驗(yàn)一 對(duì)稱密碼算法實(shí)驗(yàn)實(shí)驗(yàn)?zāi)康?.掌握密碼學(xué)中經(jīng)典的對(duì)稱密碼算法DES、AES、RC4的算法原理。2.掌握DES、AES、RC4的算法流程和實(shí)現(xiàn)方法。實(shí)驗(yàn)預(yù)備1. DES算法有什么特點(diǎn)?算法中的哪些結(jié)構(gòu)保證了其混淆和擴(kuò)散的特性?答:分組比較短、密鑰太短、密碼生命周期短、運(yùn)算速度較慢。采用替代和置換的方法簡(jiǎn)單有效地遵循了香農(nóng)定理,替代操作通過S盒達(dá)到了混淆效果,置換操作通過P盒擴(kuò)散效果。2. AES算法的基本原理和特點(diǎn)。答:AES加密數(shù)據(jù)塊分組長(zhǎng)度必須為128比特,密鑰長(zhǎng)度可以是128比特、192比特、256比特中的任意一個(gè)(如果數(shù)據(jù)塊及密鑰長(zhǎng)度不足時(shí),會(huì)補(bǔ)齊)。AES加密有很多輪的重復(fù)和變換。大致步驟如下:1、密鑰擴(kuò)展(KeyExpansion),2、初始輪(Initial Round),3、重復(fù)輪(Rounds),每一輪又包括:SubBytes、ShiftRows、MixColumns、AddRoundKey,4、最終輪(Final Round),最終輪沒有MixColumns。3. 流密碼RC4的密鑰流生成以及S盒初始化過程。答:RC4由偽隨機(jī)數(shù)生成器和異或運(yùn)算組成。RC4的密鑰長(zhǎng)度可變,范圍是1,255。RC4一個(gè)字節(jié)一個(gè)字節(jié)地加解密。給定一個(gè)密鑰,偽隨機(jī)數(shù)生成器接受密鑰并產(chǎn)生一個(gè)S盒。S盒用來加密數(shù)據(jù),而且在加密過程中S盒會(huì)變化。 初始化長(zhǎng)度為256的S盒。第一個(gè)for循環(huán)將0到255的互不重復(fù)的元素裝入S盒。第二個(gè)for循環(huán)根據(jù)密鑰打亂S盒。下面i,j是兩個(gè)指針。每收到一個(gè)字節(jié),就進(jìn)行while循環(huán)。通過一定的算法((a),(b))定位S盒中的一個(gè)元素,并與輸入字節(jié)異或,得到k。循環(huán)中還改變了S盒((c))。如果輸入的是明文,輸出的就是密文;如果輸入的是密文,輸出的就是明文。實(shí)驗(yàn)內(nèi)容1. 分析DES、AES、RC4、SHA的實(shí)現(xiàn)過程。2. 用程序設(shè)計(jì)語言將算法過程編程實(shí)現(xiàn)。3. 完成字符串?dāng)?shù)據(jù)的加密運(yùn)算和解密運(yùn)算輸入明文:Idolikethisbook 輸入密鑰:cryption 實(shí)驗(yàn)步驟1. 預(yù)習(xí)DES、AES、RC4算法。2. 寫出算法流程,用程序設(shè)計(jì)語言將算法過程編程實(shí)現(xiàn)。DES算法流程:代碼:#include memory.h#include stdio.h#include #include #include using namespace std;enumencrypt,decrypt;/ENCRYPT:加密,DECRYPT:解密void des_run(char out8,char in8,bool type=encrypt);/設(shè)置密鑰void des_setkey(const char key8);static void f_func(bool in32,const bool ki48);/f函數(shù)static void s_func(bool out32,const bool in48);/s盒代替/變換static void transform(bool *out, bool *in, const char *table, int len);static void xor(bool *ina, const bool *inb, int len);/異或static void rotatel(bool *in, int len, int loop);/循環(huán)左移/字節(jié)組轉(zhuǎn)換成位組static void bytetobit(bool *out,const char *in, int bits); /位組轉(zhuǎn)換成字節(jié)組static void bittobyte(char *out, const bool *in, int bits); /置換IP表const static char ip_table64=58,50,42,34,26,18,10,2, 60,52,44,36,28,20,12,4, 62,54,46,38,30,22,14,6, 64,56,48,40,32,24,16,8, 57,49,41,33,25,17,9,1, 59,51,43,35,27,19,11,3, 61,53,45,37,29,21,13,5, 63,55,47,39,31,23,15,7;/逆置換IP-1表const static char ipr_table64=40,8,48,16,56,24,64,32, 39,7,47,15,55,23,63,31, 38,6,46,14,54,22,62,30, 37,5,45,13,53,21,61,29, 36,4,44,12,52,20,60,28, 35,3,43,11,51,19,59,27, 34,2,42,10,50,18,58,26, 33,1,41,9,49,17,57,25;/E位選擇表static const char e_table48=32,1,2,3,4,5,4,5, 6,7,8,9,8,9,10,11, 12,13,12,13,14,15, 16,17,16,17,18,19, 20,21,20,21,22,23, 24,25,24,25,26,27, 28,29,28,29,30,31,32,1;/P換位表const static char p_table32=16,7,20,21,29,12,28, 17,1,15,23,26,5,18, 31,10,2,8,24,14,32, 27,3,9,19,13,30,6,22,11,4,25;/pc1選位表const static char pc1_table56=57,49,41,33,25,17,9, 1,58,50,42,34,26,18, 10,2,59,51,43,35,27, 19,11,3,60,52,44,36, 63,55,47,39,31,23,15, 7,62,54,46,38,30,22, 14,6,61,53,45,37,29, 21,13,5,28,20,12,4;/pc2選位表const static char pc2_table48=14,17,11,24,1,5,3,28, 15,6,21,10,23,19,12,4, 26,8,16,7,27,20,13,2, 41,52,31,37,47,55,30, 40,51,45,33,48,44,49, 39,56,34,53,46,42,50,36,29,32;/左移位數(shù)表const static char loop_table16=1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1;/S盒const static char s_box8416=/s114,4,13,1,2,15,11,8,3,10,6,12,5,9,0,7,0,15,7,4,14,2,13,1,10,6,12,11,9,5,3,8,4,1,14,8,13,6,2,11,15,12,9,7,3,10,5,0,15,12,8,2,4,9,1,7,5,11,3,14,10,0,6,13,/s215,1,8,14,6,11,3,4,9,7,2,13,12,0,5,10,3,13,4,7,15,2,8,14,12,0,1,10,6,9,11,5,0,14,7,11,10,4,13,1,5,8,12,6,9,3,2,15,13,8,10,1,3,15,4,2,11,6,7,12,0,5,14,9,/s310,0,9,14,6,3,15,5,1,13,12,7,11,4,2,8,13,7,0,9,3,4,6,10,2,8,5,14,12,11,15,1,13,6,4,9,8,15,3,0,11,1,2,12,5,10,14,7,1,10,13,0,6,9,8,7,4,15,14,3,11,5,2,12,/s47,13,14,3,0,6,9,10,1,2,8,5,11,12,4,15,13,8,11,5,6,15,0,3,4,7,2,12,1,10,14,9,10,6,9,0,12,11,7,13,15,1,3,14,5,2,8,4,3,15,0,6,10,1,13,8,9,4,5,11,12,7,2,14,/s52,12,4,1,7,10,11,6,8,5,3,15,13,0,14,9,14,11,2,12,4,7,13,1,5,0,15,10,3,9,8,6,4,2,1,11,10,13,7,8,15,9,12,5,6,3,0,14,11,8,12,7,1,14,2,13,6,15,0,9,10,4,5,3,/s612,1,10,15,9,2,6,8,0,13,3,4,14,7,5,11,10,15,4,2,7,12,9,5,6,1,13,14,0,11,3,8,9,14,15,5,2,8,12,3,7,0,4,10,1,13,11,6,4,3,2,12,9,5,15,10,11,14,1,7,6,0,8,13,/s74,11,2,14,15,0,8,13,3,12,9,7,5,10,6,1,13,0,11,7,4,9,1,10,14,3,5,12,2,15,8,6,1,4,11,13,12,3,7,14,10,15,6,8,0,5,9,2,6,11,13,8,1,4,10,7,9,5,0,15,14,2,3,12,/s813,2,8,4,6,15,11,1,10,9,3,14,5,0,12,7,1,15,13,8,10,3,7,4,12,5,6,11,0,14,9,2,7,11,4,1,9,12,14,2,0,6,10,13,15,3,5,8,2,1,14,7,4,10,8,13,15,12,9,0,3,5,6,11;static bool subkey1648;/16圈子密鑰void des_run(char out8,char in8,bool type)static bool m64,tmp32,*li=&m0,*ri=&m32;bytetobit(m,in,64);transform(m,m,ip_table,64);if(type=encrypt)for(int i=0;i=0;i-)memcpy(tmp,li,32);f_func(li,subkeyi);xor(li,ri,32);memcpy(ri,tmp,32);transform(m,m,ipr_table,64);bittobyte(out,m,64);void des_setkey(const char key8)static bool k64, *kl=&k0, *kr=&k28;bytetobit(k,key,64);transform(k,k,pc1_table,56);for(int i=0;i16;i+)rotatel(kl,28,loop_tablei);rotatel(kr,28,loop_tablei);transform(subkeyi,k,pc2_table,48);void f_func(bool in32,const bool ki48)static bool mr48;transform(mr,in,e_table,48);xor(mr,ki,48);s_func(in,mr);transform(in,in,p_table,32);void s_func(bool out32,const bool in48)for(char i=0,j,k;i8;i+,in+=6,out+=4)j=(in01)+in5;k=(in13)+(in22)+(in31)+in4;bytetobit(out,&s_boxijk,4);void transform(bool *out,bool *in,const char *table,int len)static bool tmp256;for(int i=0;ilen;i+)tmpi=intablei-1;memcpy(out,tmp,len);void xor(bool *ina,const bool *inb,int len)for(int i=0;ilen;i+)inai=inbi;void rotatel(bool *in,int len,int loop)static bool tmp256;memcpy(tmp,in,loop);memcpy(in,in+loop,len-loop);memcpy(in+len-loop,tmp,loop);void bytetobit(bool *out,const char *in,int bits) for(int i=0;i(i%8)&1;void bittobyte(char *out,const bool *in,int bits)memset(out,0,(bits+7)/8);for(int i=0;ibits;i+)outi/8|=ini(i%8);void main()string str;puts(*DES*);coutstr;/getline(cin,str);printf(n);char key8;coutplease input your key(8):;for(int p=0;pkeyp;des_setkey(key);int m=str.size();int n=m/8+1;str=str.substr(0,m);int i=0;string aw,mw;for(n;n0;n-)char *str1=new char8;string temp;temp=str.substr(i,8);i=i+8;strcpy(str1,temp.c_str();des_run(str1,str1,encrypt);aw=aw+str1;aw=aw.substr(0,m+6);/m+1-m+6 des_run(str1,str1,decrypt);mw=mw+str1;string temp1;strcpy(str1,temp1.c_str();str1=;temp=;puts(after encrypting:); coutawendl;puts(after decrypting:); coutmwendl;AES算法流程圖:代碼:#include#include#include#define null 0const unsigned char Sbox256 = / forward s-box0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16;const unsigned char ISbox256 = / inverse s-box0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb,0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb,0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e,0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25,0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92,0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06,0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b,0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73,0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e,0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b,0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f,0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef,0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d;static unsigned char AesRcon11*4=0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,0x02, 0x00, 0x00, 0x00,0x04, 0x00, 0x00, 0x00,0x08, 0x00, 0x00, 0x00,0x10, 0x00, 0x00, 0x00,0x20, 0x00, 0x00, 0x00,0x40, 0x00, 0x00, 0x00,0x80, 0x00, 0x00, 0x00,0x1b, 0x00, 0x00, 0x00,0x36, 0x00, 0x00, 0x00;static unsigned char gfmultby01(unsigned char b) return b; static unsigned char gfmultby02(unsigned char b) if (b 0x80) return (unsigned char)(int)(b 1); else return (unsigned char)( (int)(b 1) (int)(0x11B) ); static unsigned char gfmultby03(unsigned char b) return (unsigned char) ( (int)gfmultby02(b) (int)b ); static unsigned char gfmultby09(unsigned char b) return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b) (int)b ); static unsigned char gfmultby0b(unsigned char b) return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b) (int)gfmultby02(b) (int)b ); static unsigned char gfmultby0d(unsigned char b) return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b) (int)gfmultby02(gfmultby02(b) (int)(b) ); static unsigned char gfmultby0e(unsigned char b) return (unsigned char)( (int)gfmultby02(gfmultby02(gfmultby02(b) (int)gfmultby02(gfmultby02(b) (int)gfmultby02(b) ); /密鑰移位函數(shù)unsigned char* RotWord(unsigned char* word)unsigned char* temp = new unsigned char4;temp0 = word1;temp1 = word2;temp2 = word3;temp3 = word0;return temp;unsigned char* SubWord(unsigned char* word)unsigned char* temp = new unsigned char4;for(int j=0;j4;j+)tempj = Sboxwordj; return temp;void chartomatrix(unsigned char*str,unsigned char Base4) int r,c; for(c=0;c4;c+) for(r=0;r4;r+) Baserc=str4 * c+r; void ByteSub(unsigned char a44,unsigned char b44) /字節(jié)轉(zhuǎn)換 int r,c; for(r=0;r4;r+) for(c=0;c4;c+) brc=(Sboxarc); void IvByteSub(unsigned char a4,unsigned char b4) /逆字節(jié)轉(zhuǎn)換 int r,c; for(r=0;r4;r+) for(c=0;c4;c+) brc=ISboxarc;void ShiftRow(unsigned char b4,unsigned char C4) /行變換 int r,c; for(r=0;r4;r+) for(c=0;c4;c+) Crc=br(c+r)%4; void IvShiftRow(unsigned char b4,unsigned char C4) /逆移動(dòng)行變換 int r,c; for(r=0;r4;r+) for(c=0;c4;c+) Crc=br(c+4-r)%4; void MixColumn(unsigned char C4,unsigned char d4) /混合列變換 int c; for(c=0;c4;c+) d0c=(unsigned char)(int)gfmultby02(C0c) (int)gfmultby03(C1c) (int)gfmultby01(C2c) (int)gfmultby01(C3c); for(c=0;c4;c+) d1c=(unsigned char)(int)gfmultby01(C0c) (int)gfmultby02(C1c) (int)gfmultby03(C2c) (int)gfmultby01(C3c); for(c=0;c4;c+) d2c=(unsigned char)(int)gfmultby01(C0c) (int)gfmultby01(C1c) (int)gfmultby02(C2c) (int)gfmultby03(C3c); for(c=0;c4;c+) d3c=(unsigned char)(int)gfmultby03(C0c) (int)gfmultby01(C1c) (int)gfmultby01(C2c) (int)gfmultby02(C3c);void IvMixColumn(unsigned char C4,unsigned char d4) /逆混合列變換 int c; for(c=0;c4;c+) d0c=(unsigned char)(int)gfmultby0e(C0c) (int)gfmultby0b(C1c) (int)gfmultby0d(C2c) (int)gfmultby09(C3c); for(c=0;c4;c+) d1c=(unsigned char)(int)gfmultby09(C0c) (int)gfmultby0e(C1c) (int)gfmultby0b(C2c) (int)gfmultby0d(C3c); for(c=0;c4;c+) d2c=(unsigned char)(int)gfmultby0d(C0c) (int)gfmultby09(C1c) (int)gfmultby0e(C2c) (int)gfmultby0b(C3c); for(c=0;c4;c+) d3c=(unsigned char)(int)gfmultby0b(C0c) (int)gfmultby0d(C1c) (int)gfmultby09(C2c) (int)gfmultby0e(C3c); void AddRoundKey(unsigned char d4,unsigned char key4,unsigned char e4) /加循環(huán)密鑰 int r,c; for(r=0;r4;r+) for(c=0;c4;c+) erc=(unsigned char)(int)drc(int)keyrc); void KeyProducing(unsigned char*key,unsigned char K444) /擴(kuò)展初始密鑰到44列 unsigned char BaseK44=0; chartomatrix(key,BaseK); int r,c; unsigned char *temp=new unsigned char4; for(c=0;c4;+c) for(r=0;r4;+r) Krc=BaseKrc; for(c=4;c44;c+) if(c%4!=0) for(r=0;r4;r+) Krc=(unsigned char)(int)Krc-4 (int)Krc-1); else for(r=0;r4;r+)tempr=Krc-1; temp=SubWord(RotWord(temp); temp0 = (unsigned char)( (int)temp0 (int) AesRconc+0 ); temp1 = (unsigned char)( (int)temp1 (int) AesRconc+1 ); temp2 = (unsigned char)( (int)temp2 (int) AesRconc+2 ); temp3 = (unsigned char)( (int)temp3 (int) AesRconc+3 ); for(r=0;r4;r+)Krc=(unsigned char)(int)Krc-4 tempr); void Encode(unsigned char *Mwen,unsigned char K44,unsigned char*out) unsigned char BaseM44=0; int round,r,c; unsigned char Ki44=0; unsigned char e44=0,b44=0,C44=0,d44=0; chartomatrix(Mwen,BaseM); for(r=0;r4;r+) for(c=0;c4;c+) Kirc=Krc; /第0個(gè)循環(huán)密鑰 AddRoundKey(BaseM,Ki,e); /ARK,使用第0個(gè)循環(huán)密鑰 for(round=1;round10;round+) ByteSub(e,b); /字節(jié)轉(zhuǎn)換 ShiftRow(b,C); /移動(dòng)行變換 MixColumn(C,d); /混合列變換 for(r=0;r4;r+) for(c=0;c4;c+) Kirc=Kr4*round+c; /產(chǎn)生第round輪循環(huán)的密鑰Ki AddRoundKey(d,Ki,e); /roundth循環(huán)加密 ByteSub(e,b); /第10次循環(huán)加密的移動(dòng)行變換 for(r=0;r4;r+) for(c=0;c4;c+) Kirc=Kr4*10+c; /產(chǎn)生第
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2030年中國高眼魚市場(chǎng)分析及競(jìng)爭(zhēng)策略研究報(bào)告
- 2025至2030年中國紫外線UV爐市場(chǎng)分析及競(jìng)爭(zhēng)策略研究報(bào)告
- 2025至2030年中國單功能城市自行車市場(chǎng)分析及競(jìng)爭(zhēng)策略研究報(bào)告
- 2025至2030年中國高固體份清漆市場(chǎng)分析及競(jìng)爭(zhēng)策略研究報(bào)告
- 2025至2030年中國鉻合金微球市場(chǎng)分析及競(jìng)爭(zhēng)策略研究報(bào)告
- 孝順教育活動(dòng)方案
- 女神節(jié)活動(dòng)電信活動(dòng)方案
- 婚慶公司銷售策劃方案
- 女工團(tuán)體趣味活動(dòng)方案
- 學(xué)會(huì)溝通活動(dòng)方案
- 人教版三年級(jí)語文上冊(cè)期末試卷及答案【完整】
- ptfe膜雨棚施工方案
- 人工智能倫理規(guī)則
- 米亞羅-孟屯河谷風(fēng)景名勝區(qū)旅游基礎(chǔ)設(shè)施建設(shè)項(xiàng)目環(huán)評(píng)報(bào)告
- 婦產(chǎn)科護(hù)理學(xué)教材(課后思考題參考答案)
- 二年級(jí)數(shù)學(xué)無紙化監(jiān)測(cè)試題
- 沖突管理與溝通技巧
- 全同態(tài)加密算法概述
- 電流、電壓指針儀表校驗(yàn)報(bào)告
- 六年級(jí)下冊(cè)英語素材-Unit-6-General-revision-3-知識(shí)點(diǎn)-人教精通版
- BS2000標(biāo)準(zhǔn)操作規(guī)程
評(píng)論
0/150
提交評(píng)論