资源简介
用MFC实现AES算法的基本加解密。(可用作计算机专业的学科课程设计,学安全的童鞋都懂的~)
代码片段和文件信息
#include “StdAfx.h“
#include “(AES加解密).h“
#include
#include
#include
byte in[4][Nb]; //in数组用于读入需要或解密的数据
byte key[4][Nk]; //key数组用于读入初始密钥
byte w[Nr+1][Nk][4]; //w数组用于保存所有扩展后的密钥
//S盒
byte S_box[256]=
{
0x630x7c0x770x7b0xf20x6b0x6f0xc50x300x010x670x2b0xfe0xd70xab0x76\
0xca0x820xc90x7d0xfa0x590x470xf00xad0xd40xa20xaf0x9c0xa40x720xc0\
0xb70xfd0x930x260x360x3f0xf70xcc0x340xa50xe50xf10x710xd80x310x15\
0x040xc70x230xc30x180x960x050x9a0x070x120x800xe20xeb0x270xb20x75\
0x090x830x2c0x1a0x1b0x6e0x5a0xa00x520x3b0xd60xb30x290xe30x2f0x84\
0x530xd10x000xed0x200xfc0xb10x5b0x6a0xcb0xbe0x390x4a0x4c0x580xcf\
0xd00xef0xaa0xfb0x430x4d0x330x850x450xf90x020x7f0x500x3c0x9f0xa8\
0x510xa30x400x8f0x920x9d0x380xf50xbc0xb60xda0x210x100xff0xf30xd2\
0xcd0x0c0x130xec0x5f0x970x440x170xc40xa70x7e0x3d0x640x5d0x190x73\
0x600x810x4f0xdc0x220x2a0x900x880x460xee0xb80x140xde0x5e0x0b0xdb\
0xe00x320x3a0x0a0x490x060x240x5c0xc20xd30xac0x620x910x950xe40x79\
0xe70xc80x370x6d0x8d0xd50x4e0xa90x6c0x560xf40xea0x650x7a0xae0x08\
0xba0x780x250x2e0x1c0xa60xb40xc60xe80xdd0x740x1f0x4b0xbd0x8b0x8a\
0x700x3e0xb50x660x480x030xf60x0e0x610x350x570xb90x860xc10x1d0x9e\
0xe10xf80x980x110x690xd90x8e0x940x9b0x1e0x870xe90xce0x550x280xdf\
0x8c0xa10x890x0d0xbf0xe60x420x680x410x990x2d0x0f0xb00x540xbb0x16
};
//逆S盒
byte InvS_box[256] =
{0x520x090x6a0xd50x300x360xa50x380xbf0x400xa30x9e0x810xf30xd70xfb\
0x7c0xe30x390x820x9b0x2f0xff0x870x340x8e0x430x440xc40xde0xe90xcb\
0x540x7b0x940x320xa60xc20x230x3d0xee0x4c0x950x0b0x420xfa0xc30x4e\
0x080x2e0xa10x660x280xd90x240xb20x760x5b0xa20x490x6d0x8b0xd10x25\
0x720xf80xf60x640x860x680x980x160xd40xa40x5c0xcc0x5d0x650xb60x92\
0x6c0x700x480x500xfd0xed0xb90xda0x5e0x150x460x570xa70x8d0x9d0x84\
0x900xd80xab0x000x8c0xbc0xd30x0a0xf70xe40x580x050xb80xb30x450x06\
0xd00x2c0x1e0x8f0xca0x3f0x0f0x020xc10xaf0xbd0x030x010x130x8a0x6b\
0x3a0x910x110x410x4f0x670xdc0xea0x970xf20xcf0xce0xf00xb40xe60x73\
0x960xac0x740x220xe70xad0x350x850xe20xf90x370xe80x1c0x750xdf0x6e\
0x470xf10x1a0x710x1d0x290xc50x890x6f0xb70x620x0e0xaa0x180xbe0x1b\
0xfc0x560x3e0x4b0xc60xd20x790x200x9a0xdb0xc00xfe0x780xcd0x5a0xf4\
0x1f0xdd0xa80x330x880x070xc70x310xb10x120x100x590x270x800xec0x5f\
0x600x510x7f0xa90x190xb50x4a0x0d0x2d0xe50x7a0x9f0x930xc90x9c0xef\
0xa00xe00x3b0x4d0xae0x2a0xf50xb00xc80xeb0xbb0x3c0x830x530x990x61\
0x170x2b0x040x7e0xba0x770xd60x260xe10x690x140x630x550x210x0c0x7d
};
//表alog[256]是生成元表示到多项式的映射表。使用的生成元为x+1
byte alog[256] =
{0x01
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 15763 2011-11-22 15:14 AES加解密\(AES加解密).cpp
文件 896 2011-11-22 15:14 AES加解密\(AES加解密).h
文件 21788 2011-11-22 15:14 AES加解密\AES加解密.APS
文件 1501 2011-11-22 15:14 AES加解密\AES加解密.clw
文件 2039 2011-11-22 15:14 AES加解密\AES加解密.cpp
文件 4262 2011-11-22 15:14 AES加解密\AES加解密.dsp
文件 526 2011-11-22 15:14 AES加解密\AES加解密.dsw
文件 1309 2011-11-22 15:14 AES加解密\AES加解密.h
文件 41984 2011-11-22 15:17 AES加解密\AES加解密.ncb
文件 48640 2011-11-22 15:17 AES加解密\AES加解密.opt
文件 1360 2011-11-22 15:16 AES加解密\AES加解密.plg
文件 6085 2011-11-22 15:14 AES加解密\AES加解密.rc
文件 7462 2011-11-22 15:14 AES加解密\AES加解密DLG.cpp
文件 1437 2011-11-22 15:14 AES加解密\AES加解密DLG.h
文件 25550 2011-11-22 15:16 AES加解密\Debug\(AES加解密).obj
文件 6558 2011-11-22 15:16 AES加解密\Debug\(AES加解密).sbr
文件 2158656 2011-11-22 15:16 AES加解密\Debug\AES加解密.exe
文件 2511152 2011-11-22 15:16 AES加解密\Debug\AES加解密.ilk
文件 13294 2011-11-22 15:16 AES加解密\Debug\AES加解密.obj
文件 6837064 2011-11-22 15:16 AES加解密\Debug\AES加解密.pch
文件 3605504 2011-11-22 15:16 AES加解密\Debug\AES加解密.pdb
文件 8996 2011-11-22 15:16 AES加解密\Debug\AES加解密.res
文件 2351 2011-11-22 15:16 AES加解密\Debug\AES加解密.sbr
文件 39799 2011-11-22 15:16 AES加解密\Debug\AES加解密Dlg.obj
文件 6679 2011-11-22 15:16 AES加解密\Debug\AES加解密Dlg.sbr
文件 105545 2011-11-22 15:16 AES加解密\Debug\StdAfx.obj
文件 1361548 2011-11-22 15:16 AES加解密\Debug\StdAfx.sbr
文件 205824 2011-11-22 15:16 AES加解密\Debug\vc60.idb
文件 364544 2011-11-22 15:16 AES加解密\Debug\vc60.pdb
文件 3615 2011-11-22 15:14 AES加解密\ReadMe.txt
............此处省略17个文件信息
评论
共有 条评论