freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

加密解密論文word格式-資料下載頁

2024-12-06 02:37本頁面

【導讀】密碼學是一門理論性和實用性都很強的課程,也是密碼學課程設(shè)計環(huán)節(jié)應(yīng)占有重。要的地位,密碼技術(shù)為現(xiàn)代電子商務(wù)、網(wǎng)絡(luò)安全等必修之工具;提高學生在應(yīng)用C語言、數(shù)據(jù)結(jié)構(gòu)編寫大型算法的能力;2.綜合設(shè)計條件:WindowsXP操作系統(tǒng),VisualC++軟件。版的軟件開發(fā)環(huán)境中運行并得到正確的結(jié)果。要求學生按教師的要求,認真編寫出DES對稱算法的程。序代碼,并運行出結(jié)果,完成設(shè)計論文。基本原理,并編寫其程序代碼,在VisualC++中調(diào)試。稱密碼算法的工作原理的資料。由IBM公司研制的一種加密算法,并且批準它作為非機要部門使用的數(shù)據(jù)加密標準。DES也是曾被廣泛使用的分組密碼,遍及世界的政府,銀行和標準化組織把DES. 作為安全和論證通信的基礎(chǔ)。DES算法公開是密碼學史上里程碑式的事件。DES算法是分組密鑰,每次處理64位的明文數(shù)據(jù),形成64位的密文。的數(shù),且隨時可更換。此次設(shè)計主要是對DES數(shù)據(jù)加密標準原理和流程的描述,D從初。++語言實現(xiàn)了它的模擬應(yīng)用。

  

【正文】 , //S3 10,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, //S4 7,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, //S5 2,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, //S6 12,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, 武漢工程大學 計算機科學與工程學院 綜合設(shè)計 報告 18 4,3,2,12,9,5,15,10,11,14,1,7,6,0,8,13, //S7 4,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, //S8 13,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 }。 //P換位表 const static char P_Table[32] = { 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 }。 //逆初始置換 IP1表 const static char IPR_Table[64] = { 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 }。 static bool SubKey[16][48]。// 16 圈子密鑰 void Des_Run(char Out[8], char In[8], bool Type) { static bool M[64], Tmp[32], *Li = amp。M[0], *Ri = amp。M[32]。 ByteToBit(M, In, 64)。 Transform(M, M, IP_Table, 64)。 if( Type == ENCRYPT ){ for(int i=0。 i16。 i++) { memcpy(Tmp, Ri, 32)。 F_func(Ri, SubKey[i])。 Xor(Ri, Li, 32)。 memcpy(Li, Tmp, 32)。 } }else{ for(int i=15。 i=0。 i) { memcpy(Tmp, Li, 32)。 武漢工程大學 計算機科學與工程學院 綜合設(shè)計 報告 19 F_func(Li, SubKey[i])。 Xor(Li, Ri, 32)。 memcpy(Ri, Tmp, 32)。 } } Transform(M, M, IPR_Table, 64)。 BitToByte(Out, M, 64)。 } void Des_SetKey(const char Key[8]) { static bool K[64], *KL = amp。K[0], *KR = amp。K[28]。 ByteToBit(K, Key, 64)。 Transform(K, K, PC1_Table, 56)。 for(int i=0。 i16。 i++) { RotateL(KL, 28, LOOP_Table[i])。 RotateL(KR, 28, LOOP_Table[i])。 Transform(SubKey[i], K, PC2_Table, 48)。 } } void F_func(bool In[32], const bool Ki[48]) { static bool MR[48]。 Transform(MR, In, E_Table, 48)。 Xor(MR, Ki, 48)。 S_func(In, MR)。 Transform(In, In, P_Table, 32)。 } void S_func(bool Out[32], const bool In[48]) { for(char i=0,j,k。 i8。 i++,In+=6,Out+=4) { j = (In[0]1) + In[5]。 k = (In[1]3) + (In[2]2) + (In[3]1) + In[4]。 ByteToBit(Out, amp。S_Box[i][j][k], 4)。 } } void Transform(bool *Out, bool *In, const char *Table, int len) { static bool Tmp[256]。 for(int i=0。 ilen。 i++) Tmp[i] = In[ Table[i]1 ]。 memcpy(Out, Tmp, len)。 } void Xor(bool *InA, const bool *InB, int len) { 武漢工程大學 計算機科學與工程學院 綜合設(shè)計 報告 20 for(int i=0。 ilen。 i++) InA[i] ^= InB[i]。 } void RotateL(bool *In, int len, int loop) { static bool Tmp[256]。 memcpy(Tmp, In, loop)。 memcpy(In, In+loop, lenloop)。 memcpy(In+lenloop, Tmp, loop)。 } void ByteToBit(bool *Out, const char *In, int bits) { for(int i=0。 ibits。 i++) Out[i] = (In[i/8](i%8)) amp。 1。 } void BitToByte(char *Out, const bool *In, int bits) { memset(Out, 0, (bits+7)/8)。 for(int i=0。 ibits。 i++) Out[i/8] |= In[i](i%8)。 } void main() { int N,M。// 密鑰設(shè)置 cout請輸入你的密鑰位數(shù) : 。 cinM。 coutendl。 char *key=new char[M]。 char *key1=new char[M]。 cout請輸入密鑰 : 。 key[0]=getch()。 for(int i=0,j=0。iM,jM。i++,j++) { putchar(39。*39。)。key[j]=getch()。 key[i]=key[j]。 } coutendlendl。 cout請輸入明文個數(shù) N: 。 cinN。 char *str =new char[N]。 coutendl。 cout請輸入明文: 。 for(int q=0。qN。q++) { 武漢工程大學 計算機科學與工程學院 綜合設(shè)計 報告 21 str[q]=getch()。putchar(39。*39。)。 } coutendlendl。 Des_SetKey(key)。 Des_Run(str, str, ENCRYPT)。 coutDES算法加密后的密文: 。 for(int a=0。aN。a++) { coutstr[a]。 } coutendlendl。 cout輸入正確解密密碼: 。 key1[0]=getch()。 for(int h=0,k=0。hM,kM。h++,k++) { putchar(39。*39。)。key1[k]=getch()。 key1[h]=key1[k]。 } coutendlendl。 if(*key==*key1) { cout密碼正確! 解密后的明文是 : 。 Des_Run(str, str, DECRYPT)。 for(int p=0。pN。p++) { coutstr[p]。 } coutendlendl。 } else cout密鑰錯誤 !。 }
點擊復制文檔內(nèi)容
研究報告相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1