1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
int main()
{
aes_context ctx;
CHAR *input = "Sample text abc";
CHAR *out;
CHAR *secret_key = "secret key";
BYTE* buf = (BYTE*)malloc(16);
BYTE* key = (BYTE*)malloc(32);
memset(buf,0,16);
memset(key,0,32);
memcpy( buf, input, 16);
memcpy( key, secret_key, 32);
aes_set_key( &ctx, key, 256);
aes_encrypt( &ctx, buf, buf );
out=(CHAR*)buf;
MessageBox(0, out, "Encrypted text", MB_OK);
aes_decrypt( &ctx, buf, buf );
out=(CHAR*)buf;
MessageBox(0, out, "Decrypted text", MB_OK);
return 0;
}
|