????????????????????????????????????????(?????????????????????????????)????Demo?????AES??????????????????ECB/PKCS5Padding??????С????????
????????????????????key????????md5????????demo??????? C++???????MD5?? ?????????
#ifndef _AES_20140317_H_
#define _AES_20140317_H_
#define Bits128             16
#define Bits192             24
#define Bits256             32
#define ENCRYPT_BLOCK_SIZE  16
#define SUCESS 0
#define TRUE 1
#include "md5.h"
#include <stdio.h>
#include <malloc.h>
typedef unsigned char _u8;
typedef int _int32;
typedef unsigned int _u32;
typedef struct
{
_int32 Nb;
_int32 Nk;
_int32 Nr;
_u8 State[4][4];
_u8 key[32];
_u8 w[16 * 15];
} ctx_aes;
enum AESKeyLength
{
AES_KEY_LENGTH_16 = 16?? AES_KEY_LENGTH_24 = 24?? AES_KEY_LENGTH_32 = 32
};
namespace comm
{
namespace util
{
class AES
{
public:
AES();
~AES()
{
if (Sbox != NULL)
{
delete []Sbox;
Sbox = NULL;
}
if (iSbox != NULL)
{
delete []iSbox;
iSbox = NULL;
}
if (Rcon != NULL)
{
delete []Rcon;
Rcon = NULL;
}
}