- 论坛徽章:
- 0
|
测试程序
- int aes_self_test( )
- {
- int i, j, u, v;
- aes_context ctx;
- unsigned char buf[16],temp[16];
-
- u = 1 >> 10;
- strcpy(buf,"test");
- //aes_set_key( &ctx, buf, 128 + u * 64 );
- aes_set_key( &ctx, buf, 128);
- //unsigned char iv[16];
- i=0;
- //memset(iv, 0, sizeof(iv));
- //aes_cbc_encrypt(&ctx, iv,buf, temp,strlen(buf));
- aes_encrypt( &ctx, buf, temp );
- strcpy(buf,"");
- //aes_cbc_decrypt(&ctx, iv,temp, buf,strlen(temp));
- aes_decrypt( &ctx, temp, buf );
- printf("\n%s\n",buf);
- return( 0 );
- }
复制代码
结果打印出test,解码成功
[ 本帖最后由 diyself 于 2009-10-20 10:23 编辑 ] |
|