• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cli_hexdump函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cli_hexdump函数的典型用法代码示例。如果您正苦于以下问题:C++ cli_hexdump函数的具体用法?C++ cli_hexdump怎么用?C++ cli_hexdump使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cli_hexdump函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: testrun_aes128_cmac72

/*
Klen = 16
Mlen = 18
Tlen = 2
Key = 3250974e306b4b678f914b514d1e90f6
Msg = cf132fd4ebc25fd3866f1a95a6193a1a9cdf
*/
void testrun_aes128_cmac72(void){
	uint8_t key[16]= {
			0x32, 0x50, 0x97, 0x4e, 0x30, 0x6b, 0x4b, 0x67,
			0x8f, 0x91, 0x4b, 0x51, 0x4d, 0x1e, 0x90, 0xf6
	};
	uint8_t tag[2];
	uint8_t plain[18] = {
			0xcf, 0x13, 0x2f, 0xd4, 0xeb, 0xc2, 0x5f, 0xd3,
			0x86, 0x6f, 0x1a, 0x95, 0xa6, 0x19, 0x3a, 0x1a,
			0x9c, 0xdf,
	};
	bcal_cmac_ctx_t ctx;
	uint8_t r;


	cli_putstr("\r\n** AES128-CMAC-72-TEST **");

	cli_putstr("\r\n  key:   ");
	cli_hexdump(key, 128/8);
	r = bcal_cmac_init(&aes128_desc, key, 128, &ctx);
	cli_putstr("\r\n  init = 0x");
	cli_hexdump(&r, 1);
	cli_putstr("\r\n  message: ");
	cli_hexdump_block(plain, 18, 4, 16);
	if(r)
		return;
	bcal_cmac(tag, 16, plain, 18*8, &ctx);
	cli_putstr("\r\n  tag:     ");
	cli_hexdump_block(tag, 2, 4, 16);
	bcal_cmac_free(&ctx);
}
开发者ID:nerilex,项目名称:arm-crypto-lib,代码行数:38,代码来源:main-aes-test.c


示例2: testrun_aes128_ofb

void testrun_aes128_ofb(void){
	uint8_t key[16];
	uint8_t iv[16];
	uint8_t plain[64];

	bcal_ofb_ctx_t ctx;
	uint8_t r;

	memcpy_P(key,   modes_key,   16);
	memcpy_P(iv,    modes_iv,    16);
	memcpy_P(plain, modes_plain, 64);

	cli_putstr_P(PSTR("\r\n** AES128-OFB-TEST **"));
	r = bcal_ofb_init(&aes128_desc, key, 128, &ctx);
	cli_putstr_P(PSTR("\r\n  init = 0x"));
	cli_hexdump(&r, 1);
	cli_putstr_P(PSTR("\r\n  key:   "));
	cli_hexdump(key, 128/8);
	cli_putstr_P(PSTR("\r\n  IV:    "));
	cli_hexdump(iv, 128/8);
	cli_putstr_P(PSTR("\r\n  plaintext:"));
	cli_hexdump_block(plain, 4*128/8, 4, 16);
	if(r)
		return;
	bcal_ofb_encMsg(iv, plain, 4*128, &ctx);
	cli_putstr_P(PSTR("\r\n  ciphertext:  "));
	cli_hexdump_block(plain, 4*128/8, 4, 16);
	bcal_ofb_decMsg(iv, plain, 4*128, &ctx);
	cli_putstr_P(PSTR("\r\n  plaintext:   "));
	cli_hexdump_block(plain, 4*128/8, 4, 16);
	bcal_ofb_free(&ctx);
}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:32,代码来源:main-aes-test.c


示例3: testrun_md5

void testrun_md5(void){
	md5_hash_t hash;
	char* testv[]={
		"", 
		"a", 
		"abc", 
		"message digest", 
		"abcdefghijklmnopqrstuvwxyz", 
		"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 
		"12345678901234567890123456789012345678901234567890123456789012345678901234567890"};
	uint16_t i;
	
	cli_putstr("\r\n=== MD5 test suit ===");
	for(i=0; i<7; ++i){
		cli_putstr("\r\n MD5 (\"");
		cli_putstr(testv[i]);
		cli_putstr("\") = \r\n\t");
		md5(&hash, testv[i], strlen(testv[i])*8);
		cli_hexdump(hash, 16);
	}
	uint8_t buffer[512/8];
	char str[5];
	for(i=505; i<512; ++i){
		memset(buffer, 0, 512/8);
		cli_putstr_P(PSTR("\r\nMD5("));
		utoa(i, str, 10);
		cli_putstr(str);
		cli_putstr_P(PSTR(" zero bits) = "));
		md5(&hash, buffer, i);
		cli_hexdump(hash, 16);
	}
}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:32,代码来源:main-md5-test.c


示例4: cscipher_enc

void cscipher_enc(void* buffer, const cscipher_ctx_t* ctx){
	uint8_t i,j,k;
	uint8_t tmp[8];
	for(i=0; i<8; ++i){
#if DEBUG
		cli_putstr("\r\nDBG: round ");
		cli_hexdump(&i, 1);
		cli_putstr(" buffer:");
		cli_hexdump(buffer, 8);
#endif
		for(j=0; j<3; ++j){
			if(j==0){
				memxor(buffer, ctx->keys[i], 8);
			}else{
				memxor(buffer, round_const+((j==1)?0:8), 8);
			}
			for(k=0; k<4; ++k){
				((uint16_t*)tmp)[k] = m(((uint16_t*)buffer)[k]);
			}
			for(k=0; k<4; ++k){
				((uint8_t*)buffer)[k]   = tmp[2*k];
				((uint8_t*)buffer)[k+4] = tmp[2*k+1];
			}
		}
	}
	memxor(buffer, ctx->keys[8], 8);
}
开发者ID:Astralix,项目名称:ethernut32,代码行数:27,代码来源:cscipher_small.c


示例5: testrun_aes192_cmac0

/*
Count = 0
Klen = 24
Mlen = 0
Tlen = 2
Key = 2b2aaa666be161ed16648e862ac9bd1e317f71bc69e268b5
Msg = 00
*/
void testrun_aes192_cmac0(void){
	uint8_t key[24]= {
			0x2b, 0x2a, 0xaa, 0x66, 0x6b, 0xe1, 0x61, 0xed,
			0x16, 0x64, 0x8e, 0x86, 0x2a, 0xc9, 0xbd, 0x1e,
			0x31, 0x7f, 0x71, 0xbc, 0x69, 0xe2, 0x68, 0xb5
	};
	uint8_t tag[2];
	uint8_t plain[1] = {
			0x00
	};
	bcal_cmac_ctx_t ctx;
	uint8_t r;


	cli_putstr("\r\n** AES192-CMAC-0-TEST **");

	cli_putstr("\r\n  key:   ");
	cli_hexdump(key, 192/8);
	r = bcal_cmac_init(&aes192_desc, key, 192, &ctx);
	cli_putstr("\r\n  init = 0x");
	cli_hexdump(&r, 1);
	if(r)
		return;
	bcal_cmac(tag, 16, plain, 0*8, &ctx);
	cli_putstr("\r\n  tag:     ");
	cli_hexdump_block(tag, 2, 4, 16);
	bcal_cmac_free(&ctx);
}
开发者ID:nerilex,项目名称:arm-crypto-lib,代码行数:36,代码来源:main-aes-test.c


示例6: cscipher_init

void cscipher_init(const void* key, cscipher_ctx_t* ctx){
	uint8_t tmp_key[16], tmp[8];
	uint8_t i,j,k,t=0;
	memcpy(tmp_key, key, 16);
	for(i=0; i<9; ++i){
#if DEBUG
		cli_putstr("\r\nDBG: round ");
		cli_hexdump(&i, 1);
		cli_putstr(" key state:");
		cli_hexdump(tmp_key, 16);
#endif
		memcpy(tmp, tmp_key+(((i&1)==0)?0:8), 8);
		memxor(tmp, ks_const+8*i, 8);
		for(j=0; j<8; ++j){
			tmp[j] = P(tmp[j]);
		}
		for(j=0; j<8; ++j){
			for(k=0; k<8; ++k){
				t<<=1;
				t |= tmp[k]>>7;
				tmp[k]<<=1;
			}
			tmp_key[j+(((i&1)==0)?8:0)] ^= t;
		}
		memcpy(ctx->keys[i], tmp_key+(((i&1)==0)?8:0), 8);
	}
}
开发者ID:Astralix,项目名称:ethernut32,代码行数:27,代码来源:cscipher_small.c


示例7: testrun_aes128_ctr

void testrun_aes128_ctr(void){
	uint8_t key[16];
	uint8_t iv[16];
	uint8_t plain[64];

	bcal_ctr_ctx_t ctx;
	uint8_t r;

	memcpy(key,   modes_key,   16);
	memcpy(iv,    modes_ctriv, 16);
	memcpy(plain, modes_plain, 64);

	cli_putstr("\r\n** AES128-CTR-TEST **");
	r = bcal_ctr_init(&aes128_desc, key, 128, NULL, &ctx);
	cli_putstr("\r\n  init = 0x");
	cli_hexdump(&r, 1);
	cli_putstr("\r\n  key:   ");
	cli_hexdump(key, 128/8);
	cli_putstr("\r\n  IV:    ");
	cli_hexdump(iv, 128/8);
	cli_putstr("\r\n  plaintext:");
	cli_hexdump_block(plain, 4*128/8, 4, 16);
	if(r)
		return;
	bcal_ctr_encMsg(iv, plain, 4*128, &ctx);
	cli_putstr("\r\n  ciphertext:  ");
	cli_hexdump_block(plain, 4*128/8, 4, 16);
	bcal_ctr_decMsg(iv, plain, 4*128, &ctx);
	cli_putstr("\r\n  plaintext:   ");
	cli_hexdump_block(plain, 4*128/8, 4, 16);
	bcal_ctr_free(&ctx);
}
开发者ID:nerilex,项目名称:arm-crypto-lib,代码行数:32,代码来源:main-aes-test.c


示例8: shabal_ctx_dump

void shabal_ctx_dump(shabal_ctx_t *ctx){
	uint8_t i;
	void *p;
	cli_putstr_P(PSTR("\r\n=== shabal ctx dump ===\r\n  size = "));
	i=sizeof(shabal_ctx_t);
	if(i>=100)
		cli_putc('0'+i/100);
	if(i>=10)
		cli_putc('0'+(i/10)%10);
	cli_putc('0'+i%10);
	cli_putstr_P(PSTR("\r\n  a = "));
	cli_hexdump_block(ctx->a, 12*4, 5, 4*8);
	cli_putstr_P(PSTR("\r\n  b_buffer = "));
	cli_hexdump_block(ctx->b_buffer, 12*4, 5, 4*8);
	cli_putstr_P(PSTR("\r\n  c_buffer = "));
	cli_hexdump_block(ctx->c_buffer, 12*4, 5, 4*8);
	if(ctx->b == &(ctx->b_buffer[0]))
		cli_putstr_P(PSTR("\r\nb --> b_buffer"));
	if(ctx->b == &(ctx->c_buffer[0]))
		cli_putstr_P(PSTR("\r\nb --> c_buffer"));
	if(ctx->c == &(ctx->b_buffer[0]))
		cli_putstr_P(PSTR("\r\nc --> b_buffer"));
	if(ctx->c == &(ctx->c_buffer[0]))
		cli_putstr_P(PSTR("\r\nc --> c_buffer"));
	cli_putstr_P(PSTR("\r\n b = "));
	cli_hexdump(&(ctx->b), 2);
	p = ctx->b_buffer;
	cli_putstr_P(PSTR("\r\n b (should) = "));
	cli_hexdump(&p, 2);
	cli_putstr_P(PSTR("\r\n c = "));
	cli_hexdump(&(ctx->c), 2);
	p = ctx->c_buffer;
	cli_putstr_P(PSTR("\r\n c (should) = "));
	cli_hexdump(&p, 2);
}
开发者ID:Sergoi,项目名称:avr-crypto-lib,代码行数:35,代码来源:main-shabal-test.c


示例9: testrun_camellia

/*
128-bit key
key         01 23 45 67 89 ab cd ef fe dc ba 98 76 54 32 10
plaintext   01 23 45 67 89 ab cd ef fe dc ba 98 76 54 32 10
ciphertext  67 67 31 38 54 96 69 73 08 57 06 56 48 ea be 43
*/
void testrun_camellia(void){

  uint8_t data[16] = { 0x01, 0x23, 0x45, 0x67, 
                       0x89, 0xab, 0xcd, 0xef, 
                       0xfe, 0xdc, 0xba, 0x98, 
                       0x76, 0x54, 0x32, 0x10 };

  uint8_t key[16] = { 0x01, 0x23, 0x45, 0x67, 
                       0x89, 0xab, 0xcd, 0xef, 
                       0xfe, 0xdc, 0xba, 0x98, 
                       0x76, 0x54, 0x32, 0x10 };


  camellia128_ctx_t ctx;
  camellia128_init(key, &ctx);
  cli_putstr_P(PSTR("\r\n key:        "));
  cli_hexdump(data, 16);
  cli_putstr_P(PSTR("\r\n plaintext:  "));
  cli_hexdump(data, 16);
  camellia128_enc(data, &ctx);
  cli_putstr_P(PSTR("\r\n ciphertext: "));
  cli_hexdump(data, 16);
  camellia128_dec(data, &ctx);
  cli_putstr_P(PSTR("\r\n decrypted:  "));
  cli_hexdump(data, 16);

}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:33,代码来源:main-camellia-test.c


示例10: testrun_aes128_cmac

void testrun_aes128_cmac(void){
	uint8_t key[16];
	uint8_t tag[16];
	uint8_t plain[64];
	uint16_t length[] = { 0, 128, 320, 512 };
	bcal_cmac_ctx_t ctx;
	uint8_t r,i;

	memcpy(key,   modes_key,   16);
	memcpy(plain, modes_plain, 64);

	cli_putstr("\r\n** AES128-CMAC-TEST **");

	cli_putstr("\r\n  key:   ");
	cli_hexdump(key, 128/8);
	for(i=0; i<4; ++i){
		r = bcal_cmac_init(&aes128_desc, key, 128, &ctx);
		cli_putstr("\r\n  init = 0x");
		cli_hexdump(&r, 1);
		cli_putstr("\r\n  message: ");
		cli_hexdump_block(plain, length[i]/8, 4, 16);
		if(r)
			return;
		bcal_cmac(tag, 128, plain, length[i], &ctx);
		cli_putstr("\r\n  tag:     ");
		cli_hexdump_block(tag, 128/8, 4, 16);
		bcal_cmac_free(&ctx);
	}
}
开发者ID:nerilex,项目名称:arm-crypto-lib,代码行数:29,代码来源:main-aes-test.c


示例11: testencrypt

void testencrypt(uint8_t *block, uint8_t *key){
	cli_putstr("\r\n==testy-encrypt==\r\n key: ");
	cli_hexdump(key,16);
	cli_putstr("\r\n plain: ");
	cli_hexdump(block,32);
	shabea256(block,key,128,1,16);
	cli_putstr("\r\n crypt: ");
	cli_hexdump(block,32);
}
开发者ID:nerilex,项目名称:avr-crypto-lib,代码行数:9,代码来源:main-shabea-test.c


示例12: testdecrypt

void testdecrypt(uint8_t *block, uint8_t *key){
	cli_putstr("\r\n==testy-decrypt==\r\n key: ");
	cli_hexdump(key,10);
	cli_putstr("\r\n crypt: ");
	cli_hexdump(block,8);
	skipjack_dec(block,key);
	cli_putstr("\r\n plain: ");
	cli_hexdump(block,8);
}
开发者ID:nerilex,项目名称:avr-crypto-lib,代码行数:9,代码来源:main-skipjack-test.c


示例13: ctx_dump

 void ctx_dump(const bmw_small_ctx_t* ctx){
 	uint8_t i;
	cli_putstr("\r\n==== ctx dump ====");
	for(i=0; i<16;++i){
		cli_putstr("\r\n h[");
		cli_hexdump(&i, 1);
		cli_putstr("] = ");
		cli_hexdump_rev(&(ctx->h[i]), 4);
	}
	cli_putstr("\r\n counter = ");
	cli_hexdump(&(ctx->counter), 4);
 }
开发者ID:nerilex,项目名称:arm-crypto-lib,代码行数:12,代码来源:bmw_small-asm-cstub.c


示例14: testrun_test_serpent

void testrun_test_serpent(void){
	uint8_t key[32];
	serpent_ctx_t ctx;
	uint8_t i;
	memset(key, 0, 16);
	serpent_init(key, 128, &ctx);
	for(i=0; i<33; ++i){
		cli_putstr_P(PSTR("\r\n subkekey "));	
		cli_hexdump(&i, 1);
		cli_putstr_P(PSTR(" : "));	
		cli_hexdump(ctx.k[i], 16);
	}
}
开发者ID:Sergoi,项目名称:avr-crypto-lib,代码行数:13,代码来源:main-serpent-test.c


示例15: md5_nextBlock

void md5_nextBlock(md5_ctx_t *state, const void* block){
	uint32_t	a[4];
	uint8_t		m,n,i=0;
	/* this requires other mixed sboxes */
#ifdef DEBUG
	cli_putstr("\r\n DBG: md5_nextBlock: block:\r\n");
	cli_hexdump(block, 16);	cli_putstr("\r\n");
	cli_hexdump(block+16, 16);	cli_putstr("\r\n");
	cli_hexdump(block+32, 16);	cli_putstr("\r\n");
	cli_hexdump(block+48, 16);	cli_putstr("\r\n");
#endif	
	
	a[0]=state->a[0];
	a[1]=state->a[1];
	a[2]=state->a[2];
	a[3]=state->a[3];
	
	/* round 1 */
	uint8_t s1t[]={7,12,17,22}; // 1,-1   1,4   2,-1   3,-2
	for(m=0;m<4;++m){
		for(n=0;n<4;++n){
			md5_core(a, &(((uint32_t*)block)[m*4+n]), 4-n, s1t[n],i++,0);
		}
	}
	/* round 2 */
	uint8_t s2t[]={5,9,14,20}; // 1,-3   1,1   2,-2   2,4
	for(m=0;m<4;++m){
		for(n=0;n<4;++n){
			md5_core(a, &(((uint32_t*)block)[(1+m*4+n*5)&0xf]), 4-n, s2t[n],i++,1);
		}
	}
	/* round 3 */
	uint8_t s3t[]={4,11,16,23}; // 0,4   1,3   2,0   3,-1
	for(m=0;m<4;++m){
		for(n=0;n<4;++n){
			md5_core(a, &(((uint32_t*)block)[(5-m*4+n*3)&0xf]), 4-n, s3t[n],i++,2);
		}
	}
	/* round 4 */
	uint8_t s4t[]={6,10,15,21}; // 1,-2   1,2   2,-1   3,-3
	for(m=0;m<4;++m){
		for(n=0;n<4;++n){
			md5_core(a, &(((uint32_t*)block)[(0-m*4+n*7)&0xf]), 4-n, s4t[n],i++,3);
		}
	}
	state->a[0] += a[0];
	state->a[1] += a[1];
	state->a[2] += a[2];
	state->a[3] += a[3];
	state->counter++;
}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:51,代码来源:md5.c


示例16: testrun_nessie2

void testrun_nessie2(void){
	uint16_t i;
	uint8_t j;
	uint8_t data[128], hash[64];
	whirlpool_ctx_t ctx;
	char str[8];
	memset(data, 0, 128);
	cli_putstr_P(PSTR("\r\nMessage digests of strings of 0-bits and length L:"));
	for(i=0; i<1024; ++i){
		cli_putstr_P(PSTR("\r\n    L = "));
		itoa(i, str, 10);
		j=4;
		j-= strlen(str);
		if(j>3){
			j=0;
		}
		while(j--){
			cli_putc(' ');
		}
		cli_putstr(str);
		cli_putstr_P(PSTR(": "));
		whirlpool_init(&ctx);
		whirlpool_lastBlock(&ctx, data, i);
		whirlpool_ctx2hash(hash, &ctx);
		cli_hexdump(hash, 64);
	}
	cli_putstr_P(PSTR("\r\nMessage digests of all 512-bit strings S containing a single 1-bit:"));
	for(i=0; i<512; ++i){
		cli_putstr_P(PSTR("\r\n    S = "));
		data[i/8] = 0x80>>(i&7);
		cli_hexdump(data, 64);
		cli_putstr_P(PSTR(": "));
		whirlpool_init(&ctx);
		whirlpool_lastBlock(&ctx, data, 512);
		whirlpool_ctx2hash(hash, &ctx);
		data[i/8] = 0x00;
		cli_hexdump(hash, 64);
	}
	cli_putstr_P(PSTR("\r\nIterated message digest computation (100000000 times): "));
	uint32_t c;
	memset(hash, 0, 64);
	for(c=0; c<1000000; ++c){
		whirlpool_init(&ctx);
		whirlpool_lastBlock(&ctx, hash, 512);
		whirlpool_ctx2hash(hash, &ctx);
	}
	cli_hexdump(hash, 64);
	cli_putstr_P(PSTR("\r\n/* finish generating testvectors */\r\n"));
}
开发者ID:Sergoi,项目名称:avr-crypto-lib,代码行数:49,代码来源:main-whirlpool-test.c


示例17: quick_test

void quick_test(void){
	dsa_signature_t dsa_sig;
	uint8_t i, t=0, message[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef};
	load_fix_dsa();
	bigint_word_t dsa_sig_s_b[dsa_ctx.domain.q.length_W],
	        dsa_sig_r_b[dsa_ctx.domain.q.length_W];
	dsa_print_ctx(&dsa_ctx);
	dsa_sig.r.wordv = dsa_sig_r_b;
	dsa_sig.s.wordv = dsa_sig_s_b;
	cli_putstr("\r\n\r\n=== DSA QUICK TEST ===");
	for(i=0; i<9; ++i){
		cli_putstr("\r\n");
		cli_putc('1'+i);
		cli_putstr(": message: ");
		if (i){
			cli_hexdump(message, i);
		}else{
			cli_putstr("<empty>");
		}
		cli_putstr("\r\n computing signature ... ");
		dsa_sign_message(&dsa_sig, message, i*8, &sha1_desc, &dsa_ctx, random8);
		dsa_print_signature(&dsa_sig);
		cli_putstr("\r\n base64:\r\n--- SIGNATURE ---\r\n ");
		dsa_print_signature_b64(&dsa_sig);
		cli_putstr("\r\n verifying signature ... ");
		t = dsa_verify_message(&dsa_sig, message, i*8, &sha1_desc, &dsa_ctx);
		cli_putstr("\r\n verification: ");
		if(t==DSA_SIGNATURE_OK){
			cli_putstr("[PASS]");
		}else{
			cli_putstr("[FAIL]");
		}
	}
}
开发者ID:nerilex,项目名称:arm-crypto-lib,代码行数:34,代码来源:main-dsa-test.c


示例18: hexdump128

void hexdump128(void* data){
	uint8_t i;
	for(i=0; i<16; ++i){
		cli_hexdump(data, 1);
		cli_putc(' ');
		data = (uint8_t*)data +1;
	}
}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:8,代码来源:main-camellia-test.c


示例19: testrun_serpent256

void testrun_serpent256(void){
	uint8_t key[32];
	uint8_t data[16];
	serpent_ctx_t ctx;
	memset(key, 0, 32);
	memset(data, 0, 16);
	key[0] = 0x80;
	cli_putstr("\r\n== small test Serpent-256 ==");
	cli_putstr("\r\n  key    = ");
	cli_hexdump(key, 32);
	cli_putstr("\r\n  plain  = ");
	cli_hexdump(data, 16);
	serpent_init(key, 256, &ctx);
	serpent_enc(data, &ctx);
	cli_putstr("\r\n  cipher = ");
	cli_hexdump(data, 16);
}
开发者ID:nerilex,项目名称:arm-crypto-lib,代码行数:17,代码来源:main-serpent-test.c


示例20: testrun_long_cscipher

void testrun_long_cscipher(void){
	uint8_t data[8];
	char str[10];
	uint16_t i;
	uint8_t j;
	uint8_t key[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
					 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 };
	cscipher_ctx_t ctx;
	cli_putstr("\r\n== CS-Cipher test==\r\nkey: ");
	cli_hexdump(key, 16);
	cscipher_init(key, &ctx);
	memset(data, 0, 8);
	cli_putstr("\r\nplain:  ");
	cli_hexdump(data, 8);
	cli_putstr("\r\nencrypting 1,000,000 times:\r\n");
	for(i=0; i<10000;++i){
		for(j=0;j<100;++j){
			cscipher_enc(data, &ctx);
		}
		if(i%128==0){
			sprintf(str, "%d", i);
			cli_putstr("\r\n");
			cli_putstr(str);
			cli_putstr(": ");
		}
		cli_putc('*');

	}
	cli_putstr("\r\ncipher: ");
	cli_hexdump(data, 8);
	cli_putstr("\r\ndecrypting 1,000,000 times:");
	for(i=0; i<10000;++i){
		for(j=0;j<100;++j){
			cscipher_dec(data, &ctx);
		}
		if(i%128==0){
			sprintf(str, "%d", i);
			cli_putstr("\r\n");
			cli_putstr(str);
			cli_putstr(": ");
		}
		cli_putc('*');
	}
	cli_putstr("\r\nplain:  ");
	cli_hexdump(data, 8);
}
开发者ID:nerilex,项目名称:arm-crypto-lib,代码行数:46,代码来源:main-cscipher-test.c



注:本文中的cli_hexdump函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cli_is_error函数代码示例发布时间:2022-05-30
下一篇:
C++ cli_err函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap