【文件属性】:
文件名称:aes加密算法自己调试过了
文件大小:9KB
文件格式:C
更新时间:2013-06-30 08:43:05
aes 加密
#include
#include
//xtime用于混合列变换
#define xtime(x) ((x<<1)^(((x>>7)&1)*0x1b))
//密钥的长度为128bit,轮数Nr为10
int Nk=4;
int Nr=10;
char RoundKey[240];//轮密钥
char Key[32];//主密钥
//S-盒
int sbox[256]=
{
0x63,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,