資源簡介
自己做的一個AES加密解密算法程序,內部核心算法均為自己實現

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
namespace?AES
{
????class?Decryption
????{
????????private?static?char[]?alphabet?={?‘0‘?‘1‘?‘2‘?‘3‘?‘4‘?‘5‘?‘6‘?‘7‘?‘8‘?‘9‘?‘a‘?‘b‘?‘c‘?‘d‘?‘e‘?‘f‘?};
????????public?static?int[]?Getdecryption(string?str?int[]?key)
????????{
????????????int[]?cipherkey?=?new?int[16];
????????????str?=?str.ToLower();
????????????char[]?ch?=?str.ToCharArray();
????????????int[]?cipher=?new?int[str.Length?/?32?16];
????????????int[]?plian?=?new?int[str.Length?/?32?16];
????????????int[]?plaintext?=?new?int[16];
????????????StringBuilder?s?=?new?StringBuilder(100000);
????????????for?(int?i?=?0;?i?????????????{
????????????????for?(int?j?=?3;?j?>=?0;?j--)
????????????????{
????????????????????s?=?s.Append(Decryption.GetNum(ch[i])?>>?j?&?1);
????????????????}
????????????}
????????????for?(int?i?=?0;?i?????????????{
????????????????for?(int?j?=?0;?j?16;?j++)
????????????????????cipher[i?j]?=?Convert.ToInt32(s.ToString(j?*?8?+?i?*?128?8)?2);
????????????}
????????????EncryptionForm?encryForm?=?new?EncryptionForm();
????????????encryForm.Show();
????????????for?(int?i?=0;?i ????????????{
????????????????for?(int?h?=?0;?h?16;?h++)
????????????????{
????????????????????cipherkey[h]?=?key[key.GetLength(0)-1?h];
????????????????????plaintext[h]?=?cipher[i?h];
????????????????}
????????????????encryForm.SetText(“密鑰:“?cipherkey);
????????????????plaintext?=?AddRoundKey(plaintext?cipherkey);
????????????????encryForm.SetText(“InvAddRoundKey:“plaintext);
????????????????encryForm.Set();
????????????????for?(int?j?=?key.GetLength(0)-2;?j>0;?j--)
????????????????{
????????????????????for?(int?h?=?0;?h?16;?h++)
????????????????????{
????????????????????????cipherkey[h]?=?key[j?h];
????????????????????}
????????????????????for?(int?h?=?0;?h?????????????????????{
????????????????????????plaintext[h]?=?SubBytes.GetByteSub(plaintext[h]);
????????????????????}
????????????????????encryForm.SetText(“InvSubBytes:“?plaintext);
????????????????????plaintext?=?InvShiftRows(plaintext);
????????????????????encryForm.SetText(“InvShiftRows:“?plaintext);
????????????????????plaintext?=?MixColumn.InvMixColumn(plaintext);
????????????????????encryForm.SetText(“InvMixColumn:“?plaintext);
????????????????????encryForm.SetText(“輪密鑰:“?cipherkey);
????????????????????plaintext?=?AddRoundKey(plaintext?cipherkey);
????????????????????encryForm.SetText(“InvAddRoundKey:“?plaintext);
????????????????????encryForm.Set();
????????????????}
????????????????for?(int?h?=?0;?h?16;?h++)
????????????????{
????????????????????cipherkey[h]?=?key[0?h];
????????????????}
????????????????for?(int?h?=?0;?h?????????????????{
????????????????????plaintext[h]?=?SubBytes.GetByteSub(plaintext[h]);
????????????????}
?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4592??2009-10-26?18:38??AES中文\AES\AES.csproj
?????文件??????14458??2009-10-26?18:38??AES中文\AES\AES.ico
?????文件??????98304??2009-12-19?19:41??AES中文\AES\bin\Debug\AES.exe
?????文件?????108032??2009-12-19?19:41??AES中文\AES\bin\Debug\AES.pdb
????.......??????5632??2009-10-26?18:38??AES中文\AES\bin\Debug\AES.vshost.exe
?????文件?????516234??2009-10-26?18:38??AES中文\AES\bin\Debug\IrisSkin2.DLL
?????文件??????15899??2009-10-26?18:38??AES中文\AES\bin\Debug\MP10.ssk
?????文件???????4655??2009-10-26?18:38??AES中文\AES\Decryption.cs
?????文件???????4080??2009-10-27?14:57??AES中文\AES\Encryption.cs
?????文件???????1307??2009-10-26?18:38??AES中文\AES\EncryptionForm.cs
?????文件???????2992??2009-10-26?18:38??AES中文\AES\EncryptionForm.Designer.cs
?????文件??????27800??2009-10-26?18:38??AES中文\AES\EncryptionForm.resx
?????文件???????2674??2009-10-27?14:59??AES中文\AES\KeyExpansion.cs
?????文件???????1341??2009-10-26?18:38??AES中文\AES\KeyExpansionForm.cs
?????文件???????2934??2009-10-26?18:38??AES中文\AES\KeyExpansionForm.Designer.cs
?????文件??????27800??2009-10-26?18:38??AES中文\AES\KeyExpansionForm.resx
?????文件??????11007??2009-12-19?19:41??AES中文\AES\MainForm.cs
?????文件??????19629??2009-12-19?19:41??AES中文\AES\MainForm.Designer.cs
?????文件??????28198??2009-12-19?19:41??AES中文\AES\MainForm.resx
?????文件???????6164??2009-10-26?18:38??AES中文\AES\MixColumn.cs
?????文件???????2808??2009-12-19?19:41??AES中文\AES\obj\AES.csproj.FileListAbsolute.txt
?????文件???????1039??2009-12-19?19:41??AES中文\AES\obj\Debug\AES.csproj.GenerateResource.Cache
?????文件??????15024??2009-10-26?18:38??AES中文\AES\obj\Debug\AES.EncryptionForm.resources
?????文件??????98304??2009-12-19?19:41??AES中文\AES\obj\Debug\AES.exe
?????文件??????15024??2009-10-26?18:38??AES中文\AES\obj\Debug\AES.KeyExpansionForm.resources
?????文件??????15024??2009-12-19?19:41??AES中文\AES\obj\Debug\AES.MainForm.resources
?????文件?????108032??2009-12-19?19:41??AES中文\AES\obj\Debug\AES.pdb
?????文件????????180??2009-10-26?19:14??AES中文\AES\obj\Debug\AES.Properties.Resources.resources
?????文件???????9842??2009-10-26?19:14??AES中文\AES\obj\Debug\ResolveAssemblyReference.cache
?????文件????????465??2009-10-26?18:38??AES中文\AES\Program.cs
............此處省略23個文件信息
- 上一篇:RDLC動態生成官方
- 下一篇:C#五子棋源代碼wuziqi
評論
共有 條評論