- 博客(0)
- 资源 (6)
空空如也
EMV TLV查询分析器
比如:6F4D8407A0000003330101A542500B50424F43204372656469748701019F38069F33039F4E145F2D087A68656E667264659F1101019F120F4341524420494D4147452030303031BF0C059F4D020B0A,
可以如下分析:6F 4D …
试用一下便知,很好用的。
2015-04-17
算法的C语言实现
int main()
{
unsigned char key[16] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
unsigned char input[16] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
unsigned char output[16];
sm4_context ctx;
unsigned long i;
//encrypt standard testing vector
sm4_setkey_enc(&ctx,key);
sm4_crypt_ecb(&ctx,1,16,input,output);
for(i=0;i<16;i++)
printf("x ", output[i]);
printf("\n");
//decrypt testing
sm4_setkey_dec(&ctx,key);
sm4_crypt_ecb(&ctx,0,16,output,output);
for(i=0;i<16;i++)
printf("x ", output[i]);
printf("\n");
//decrypt 1M times testing vector based on standards.
i = 0;
sm4_setkey_enc(&ctx,key);
while (i<1000000)
{
sm4_crypt_ecb(&ctx,1,16,input,input);
i++;
}
for(i=0;i<16;i++)
printf("x ", input[i]);
printf("\n");
return 0;
}
2015-04-17
SM3算法C诘言实现
int main( int argc, char *argv[] )
{
unsigned char *input = "abc";
int ilen = 3;
unsigned char output[32];
int i;
sm3_context ctx;
printf("Message:\n");
printf("%s\n",input);
sm3(input, ilen, output);
printf("Hash:\n ");
for(i=0; i<32; i++)
{
printf("x",output[i]);
if (((i+1) % 4 ) == 0) printf(" ");
}
printf("\n");
printf("Message:\n");
for(i=0; i < 16; i++)
printf("abcd");
printf("\n");
sm3_starts( &ctx );
for(i=0; i < 16; i++)
sm3_update( &ctx, "abcd", 4 );
sm3_finish( &ctx, output );
memset( &ctx, 0, sizeof( sm3_context ) );
printf("Hash:\n ");
for(i=0; i<32; i++)
{
printf("x",output[i]);
if (((i+1) % 4 ) == 0) printf(" ");
}
printf("\n");
//getch(); //VS2008
2015-04-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人