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

C++ cli_putstr_P函数代码示例

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

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



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

示例1: 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_P(PSTR("\r\n** AES192-CMAC-0-TEST **"));

	cli_putstr_P(PSTR("\r\n  key:   "));
	cli_hexdump(key, 192/8);
	r = bcal_cmac_init(&aes192_desc, key, 192, &ctx);
	cli_putstr_P(PSTR("\r\n  init = 0x"));
	cli_hexdump(&r, 1);
	if(r)
		return;
	bcal_cmac(tag, 16, plain, 0*8, &ctx);
	cli_putstr_P(PSTR("\r\n  tag:     "));
	cli_hexdump_block(tag, 2, 4, 16);
	bcal_cmac_free(&ctx);
}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:36,代码来源:main-aes-test.c


示例2: test_mul_simple

// -3d1d 6db7 8251 f371 * -7a18 3791 d18b b7c5 = 1d25ce4fdf93390f8d6c709f4d711cf5
// -20538248dece6d29068d * 400b1411b874f81394c6 = -81646b193d95136a6fedb73cee6d30c39fb950e
// -BC8B 7D53 4921 853D * 0DDA 6044 00CE DDE6   =  -a33eb0c5847db8837589c22db395dce
void test_mul_simple(void){
	bigint_t a, b, c;

//	uint8_t a_b[10] = {0x8d, 0x06, 0x29, 0x6d, 0xce, 0xde, 0x48, 0x82, 0x53, 0x20};
//	uint8_t b_b[10] = {0xc6, 0x94, 0x13, 0xf8, 0x74, 0xb8, 0x11, 0x14, 0x0b, 0x40};
	uint8_t a_b[8] = {0x3d, 0x85, 0x21, 0x49, 0x53, 0x7d, 0x8b, 0xbc};
	uint8_t b_b[8] = {0xe6, 0xdd, 0xce, 0x00, 0x44, 0x60, 0xda, 0x0d};

	uint8_t c_b[16];
	a.wordv=a_b;
	b.wordv=b_b;
	c.wordv=c_b;
	a.length_B = 8;
	b.length_B = 8;
	a.info=0x80;
	bigint_adjust(&a);
	bigint_adjust(&b);
	bigint_mul_s(&c, &a, &b);
	cli_putstr_P(PSTR("\r\n test: "));
	bigint_print_hex(&a);
	cli_putstr_P(PSTR(" * "));
	bigint_print_hex(&b);
	cli_putstr_P(PSTR(" = "));
	bigint_print_hex(&c);
}
开发者ID:EwanLu,项目名称:chipwhisperer,代码行数:28,代码来源:main-bigint-test.c


示例3: testrun_performance_shabea

void testrun_performance_shabea(void){
	uint64_t t;
	char str[16];
	uint8_t key[32], data[32];
	
	calibrateTimer();
	print_overhead();
	
	memset(key,  0, 32);
	memset(data, 0, 32);
	
	startTimer(1);
	shabea256(data, key, 256, 1, 16);
	t = stopTimer();
	cli_putstr_P(PSTR("\r\n\tencrypt time: "));
	ultoa((unsigned long)t, str, 10);
	cli_putstr(str);
	
	
	startTimer(1);
	shabea256(data, key, 256, 0, 16);
	t = stopTimer();
	cli_putstr_P(PSTR("\r\n\tdecrypt time: "));
	ultoa((unsigned long)t, str, 10);
	cli_putstr(str);
	
	cli_putstr_P(PSTR("\r\n"));
}
开发者ID:nerilex,项目名称:avr-crypto-lib,代码行数:28,代码来源:main-shabea-test.c


示例4: 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();
	uint8_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_P(PSTR("\r\n\r\n=== DSA QUICK TEST ==="));
	for(i=0; i<8; ++i){
		cli_putstr_P(PSTR("\r\n"));
		cli_putc('1'+i);
		cli_putstr_P(PSTR(": message: "));
		if (i){
			cli_hexdump(message, i);
		}else{
			cli_putstr_P(PSTR("<empty>"));
		}
		cli_putstr_P(PSTR("\r\n computing signature ... "));
		dsa_sign_message(&dsa_sig, message, i*8, &sha1_desc, &dsa_ctx, random8);
		dsa_print_signature(&dsa_sig);
		cli_putstr_P(PSTR("\r\n base64:\r\n--- SIGNATURE ---\r\n "));
		dsa_print_signature_b64(&dsa_sig);
		cli_putstr_P(PSTR("\r\n verifying signature ... "));
		t = dsa_verify_message(&dsa_sig, message, i*8, &sha1_desc, &dsa_ctx);
		cli_putstr_P(PSTR("\r\n verification: "));
		if(t==DSA_SIGNATURE_OK){
			cli_putstr_P(PSTR("[PASS]"));
		}else{
			cli_putstr_P(PSTR("[FAIL]"));
		}
	}
}
开发者ID:Sergoi,项目名称:avr-crypto-lib,代码行数:34,代码来源:main-dsa-test.c


示例5: shavs_setalgo

void shavs_setalgo(char *param){
	param = strstrip(param);
	if(param[1]=='\0'){ /* single letter specified */
		uint8_t i, option = param[0] - 'a';

		if(!shavs_algolist){
			fputs_P(PSTR("\nERROR: shavs_algolist not set!"), shavs_out_file);
			return;
		}
		for(i=0; i<=option; ++i){
			if((void*)pgm_read_word(&(shavs_algolist[i]))==NULL){
				fputs_P(PSTR("\r\nERROR: invalid selection!"), shavs_out_file);
				return;
			}
		}
		shavs_algo=(hfdesc_t*)pgm_read_word(&(shavs_algolist[option]));
	} else { /* name specifyed */
		hfdesc_t *t=NULL;
		uint8_t i=0;
		while((t=(hfdesc_t*)pgm_read_word(&(shavs_algolist[i]))) &&
		       strcasecmp_P(param, (void*)pgm_read_word(&(t->name))))
			++i;
		if(t){
			shavs_algo=t;
		}else{
		    fprintf_P(shavs_out_file, PSTR("\nERROR: could not find \"%s\"!"), param);
			cli_putstr_P(PSTR("\r\nERROR: could not find \""));
			cli_putstr(param);
			cli_putstr_P(PSTR("\"!"));
		}
	}
}
开发者ID:nerilex,项目名称:avr-crypto-lib,代码行数:32,代码来源:shavs.c


示例6: testrun_performance_entropium

void testrun_performance_entropium(void){
	uint64_t t;
	char str[16];
	uint8_t data[32];
	
	calibrateTimer();
	print_overhead();
	
	startTimer(1);
	entropium_addEntropy(128, data);
	t = stopTimer();
	cli_putstr_P(PSTR("\r\n\tadd entropy time: "));
	ultoa((unsigned long)t, str, 10);
	cli_putstr(str);
	
	
	startTimer(1);
	entropium_getRandomBlock(data);
	t = stopTimer();
	cli_putstr_P(PSTR("\r\n\tget random time:  "));
	ultoa((unsigned long)t, str, 10);
	cli_putstr(str);
	
	cli_putstr_P(PSTR("\r\n"));
}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:25,代码来源:main-entropium-test.c


示例7: testrun_nist_vectors

void testrun_nist_vectors(void){
	uint8_t key[10];
	uint8_t data[8];
	uint8_t i;

	cli_putstr_P(PSTR("\r\n\r\n=== NIST vectors run 1 ==="));
	memset(key, 0, 10);
	for(i=0; i<64; ++i){
		memset(data, 0, 8);
		data[i>>3] |= 0x80 >> (i & 7);
		cli_putstr_P(PSTR("\r\n round: 0x"));
		cli_hexdump_byte(i);
		test_enc(data, key);
	}

	cli_putstr_P(PSTR("\r\n\r\n=== NIST vectors run 2 ==="));
	memset(data, 0, 8);
	for(i=0; i<80; ++i){
                memset(key, 0, 10);
                key[i>>3] |= 0x80 >> (i & 7);
                cli_putstr_P(PSTR("\r\n round: 0x"));
                cli_hexdump_byte(i);
                test_enc(data, key);
        }
}
开发者ID:nerilex,项目名称:avr-crypto-lib,代码行数:25,代码来源:main-skipjack-test.c


示例8: read_bigint

uint8_t read_bigint(bigint_t *a, char *prompt){
	uint16_t read_length, actual_length;
	uint8_t off;
	uint8_t *buffer;
	char read_int_str[18];
	cli_putstr(prompt);
	cli_putstr_P(PSTR("\r\n  length: "));
	cli_getsn(read_int_str, 16);
	read_length = own_atou(read_int_str);
	off = (sizeof(bigint_word_t) - (read_length % sizeof(bigint_word_t))) % sizeof(bigint_word_t);
	buffer = malloc(((read_length + sizeof(bigint_word_t) - 1) / sizeof(bigint_word_t)) * sizeof(bigint_word_t));
	if(!buffer){
		cli_putstr_P(PSTR("\r\nERROR: OOM!"));
		return 2;
	}
	cli_putstr_P(PSTR("\r\n  data: "));
	memset(buffer, 0, sizeof(bigint_word_t));
	actual_length = read_os(buffer + off, read_length, NULL);
	if(actual_length != read_length){
		cli_putstr_P(PSTR("\r\nERROR: unexpected end of data!"));
		free(buffer);
		return 1;
	}
	a->wordv = (bigint_word_t*)buffer;
	a->length_W = (read_length + sizeof(bigint_word_t) - 1) / sizeof(bigint_word_t);
	a->info = 0;
	bigint_changeendianess(a);
	bigint_adjust(a);
	return 0;
}
开发者ID:nerilex,项目名称:avr-crypto-lib,代码行数:30,代码来源:main-rsaes_pkcs1v15-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_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


示例11: testrun_nessie_des

void testrun_nessie_des(const char* param){
	if(!param){
		bcal_nessie_multiple(algolist);
	}else{
		uint8_t i=0;
		bcdesc_t* ptr;
		for(;;){
			ptr = (bcdesc_t*)pgm_read_word(&algolist[i++]);
			if(ptr == NULL){
				cli_putstr_P(PSTR("\r\nunknown algorithm: "));
				cli_putstr(param);
				cli_putstr_P(PSTR("\r\navailable algorithms are:"));
				i = 0;
				while((ptr = (bcdesc_t*)pgm_read_word(&algolist[i++]))){
					cli_putstr_P(PSTR("\r\n\t"));
					cli_putstr_P((const char*)pgm_read_word(&ptr->name));
				}
				return;
			}
			if(!strcmp_P(param, (const char*)pgm_read_word(&ptr->name))){
				bcal_nessie(ptr);
				return;
			}
		}
	}
}
开发者ID:EwanLu,项目名称:chipwhisperer,代码行数:26,代码来源:main-des-test.c


示例12: testrun_performance_rabbit

void testrun_performance_rabbit(void){
	uint64_t t;
	char str[16];
	uint8_t key[16];
	rabbit_ctx_t ctx;

	calibrateTimer();
	print_overhead();

	memset(key,  0, 16);

	startTimer(1);
	rabbit_init(key, 128, NULL, &ctx);
	t = stopTimer();
	cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
	ultoa((unsigned long)t, str, 10);
	cli_putstr(str);

	startTimer(1);
	rabbit_gen(&ctx);
	t = stopTimer();
	cli_putstr_P(PSTR("\r\n\tencrypt time: "));
	ultoa((unsigned long)t, str, 10);
	cli_putstr(str);

	cli_putstr_P(PSTR("\r\n"));
}
开发者ID:Sergoi,项目名称:avr-crypto-lib,代码行数:27,代码来源:main-rabbit-test.c


示例13: test_gcdext_simple

void test_gcdext_simple(void){
	bigint_t a, b, c, d, e;

	uint8_t a_b[5] = {0x71, 0x07, 0x00, 0x09, 0x16};
	uint8_t b_b[5] = {0x72, 0x7D, 0x57, 0xAC, 0X6F};
	uint8_t c_b[6], d_b[6], e_b[6];
	a.wordv=a_b;
	a.length_B = 5;
	a.info=0x00;
	bigint_adjust(&a);
	b.wordv=b_b;
	b.length_B = 5;
	b.info=0x00;
	bigint_adjust(&b);
	c.wordv = c_b;
	d.wordv = d_b;
	e.wordv = e_b;
	bigint_gcdext(&c, &d, &e, &a, &b);
	cli_putstr_P(PSTR("\r\n test: gcd( "));
	bigint_print_hex(&a);
	cli_putstr_P(PSTR(", "));
	bigint_print_hex(&b);
	cli_putstr_P(PSTR(") => a =  "));
	bigint_print_hex(&d);
	cli_putstr_P(PSTR("; b =  "));
	bigint_print_hex(&e);
	cli_putstr_P(PSTR("; gcd =  "));
	bigint_print_hex(&c);
}
开发者ID:EwanLu,项目名称:chipwhisperer,代码行数:29,代码来源:main-bigint-test.c


示例14: 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_P(key,   modes_key,   16);
	memcpy_P(plain, modes_plain, 64);

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

	cli_putstr_P(PSTR("\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_P(PSTR("\r\n  init = 0x"));
		cli_hexdump(&r, 1);
		cli_putstr_P(PSTR("\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_P(PSTR("\r\n  tag:     "));
		cli_hexdump_block(tag, 128/8, 4, 16);
		bcal_cmac_free(&ctx);
	}
}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:29,代码来源:main-aes-test.c


示例15: 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_P(PSTR("\r\n** AES128-CMAC-72-TEST **"));

	cli_putstr_P(PSTR("\r\n  key:   "));
	cli_hexdump(key, 128/8);
	r = bcal_cmac_init(&aes128_desc, key, 128, &ctx);
	cli_putstr_P(PSTR("\r\n  init = 0x"));
	cli_hexdump(&r, 1);
	cli_putstr_P(PSTR("\r\n  message: "));
	cli_hexdump_block(plain, 18, 4, 16);
	if(r)
		return;
	bcal_cmac(tag, 16, plain, 18*8, &ctx);
	cli_putstr_P(PSTR("\r\n  tag:     "));
	cli_hexdump_block(tag, 2, 4, 16);
	bcal_cmac_free(&ctx);
}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:38,代码来源:main-aes-test.c


示例16: testrun_performance_grain

void testrun_performance_grain(void) {
    uint64_t t;
    char str[16];
    uint8_t key[10], iv[8];
    grain_ctx_t ctx;

    calibrateTimer();
    print_overhead();

    memset(key,  0, 10);
    memset(iv,  0, 8);

    startTimer(1);
    grain_init(key, iv, &ctx);
    t = stopTimer();
    cli_putstr_P(PSTR("\r\n\tctx-gen time: "));
    ultoa((unsigned long)t, str, 10);
    cli_putstr(str);

    startTimer(1);
    grain_enc(&ctx);
    t = stopTimer();
    cli_putstr_P(PSTR("\r\n\tencrypt time: "));
    ultoa((unsigned long)t, str, 10);
    cli_putstr(str);

    cli_putstr_P(PSTR("\r\n"));
}
开发者ID:firebitsbr,项目名称:chipwhisperer,代码行数:28,代码来源:main-grain-test.c


示例17: testrun_stdtest_ubi256

/*****************************************************************************
 *  additional validation-functions											 *
 *****************************************************************************/
void testrun_stdtest_ubi256(uint16_t outsize){
	ubi256_ctx_t ctx;
	skein_config_t conf;
	uint64_t iv[4];
	
	cli_putstr_P(PSTR("\r\n\r\nTest vectors for UBI (256 bits):"));
	memset(&conf, 0, sizeof(skein_config_t));

	ubi256_init(&ctx, &conf, UBI_TYPE_CFG);
	conf.schema[0] = 'S';
	conf.schema[1] = 'H';
	conf.schema[2] = 'A';
	conf.schema[3] = '3';
	conf.version = 1;
	conf.out_length = outsize;
	ubi256_lastBlock(&ctx, &conf, 256);
	ubi256_ctx2hash(iv, &ctx);
		
	cli_putstr_P(PSTR("\r\nIV: "));
	cli_hexdump_rev(&(iv[0]), 8);
	cli_putstr_P(PSTR("    "));
	cli_hexdump_rev(&(iv[1]), 8);
	cli_putstr_P(PSTR("    "));
	cli_hexdump_rev(&(iv[2]), 8);
	cli_putstr_P(PSTR("    "));
	cli_hexdump_rev(&(iv[3]), 8);
}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:30,代码来源:main-ubi-test.c


示例18: test_reduce_bigint

void test_reduce_bigint(void){
	bigint_t a, b;
	cli_putstr_P(PSTR("\r\nreduce test\r\n"));
	for(;;){
		cli_putstr_P(PSTR("\r\nenter a:"));
		if(bigint_read_hex_echo(&a)){
			cli_putstr_P(PSTR("\r\n end reduce test"));
			return;
		}
		cli_putstr_P(PSTR("\r\nenter b:"));
		if(bigint_read_hex_echo(&b)){
			free(a.wordv);
			cli_putstr_P(PSTR("\r\n end reduce test"));
			return;
		}
		cli_putstr_P(PSTR("\r\n "));
		bigint_print_hex(&a);
		cli_putstr_P(PSTR(" % "));
		bigint_print_hex(&b);
		cli_putstr_P(PSTR(" = "));
		bigint_reduce(&a, &b);
		bigint_print_hex(&a);
		cli_putstr_P(PSTR("\r\n"));
		free(a.wordv);
		free(b.wordv);
	}
}
开发者ID:EwanLu,项目名称:chipwhisperer,代码行数:27,代码来源:main-bigint-test.c


示例19: test_reduce_bigint

void test_reduce_bigint(void){
	bigint_t a, b, c;
	cli_putstr_P(PSTR("\r\nreduce test\r\n"));
	for (;;) {
		cli_putstr_P(PSTR("\r\nenter a:"));
		if (bigint_read_hex_echo(&a, 0)) {
			cli_putstr_P(PSTR("\r\n end reduce test"));
			return;
		}
		cli_putstr_P(PSTR("\r\nenter b:"));
		if (bigint_read_hex_echo(&b, 0)) {
			free(a.wordv);
			cli_putstr_P(PSTR("\r\n end reduce test"));
			return;
		}
		cli_putstr_P(PSTR("\r\n "));
		bigint_print_hex(&a);
		cli_putstr_P(PSTR(" % "));
		bigint_print_hex(&b);
		cli_putstr_P(PSTR(" = "));
		memset(&c, 0, sizeof(c));
		bigint_divide(NULL, &c, &a, &b);
		bigint_print_hex(&c);
		cli_putstr_P(PSTR("\r\n"));
        bigint_free(&c);
        bigint_free(&b);
		bigint_free(&a);
	}
}
开发者ID:nerilex,项目名称:avr-crypto-lib,代码行数:29,代码来源:main-bigint2-test.c


示例20: cubehash256_test0

void cubehash256_test0(void){
	cubehash_ctx_t ctx;
	uint8_t hash[32];
	cubehash256_init(&ctx);
	cli_putstr_P(PSTR("\r\ninit done "));
	cubehash_lastBlock(&ctx, NULL, 0);
	cli_putstr_P(PSTR("\r\nlastblock done "));
	cubehash256_ctx2hash(hash, &ctx);
	cli_putstr_P(PSTR("\r\nhash = "));
	cli_hexdump(hash, 32);
}
开发者ID:kailiu-bupt2005,项目名称:Arduino-and-XBee-based-secure-home-automation,代码行数:11,代码来源:main-cubehash-test.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ cli_shutdown函数代码示例发布时间:2022-05-30
下一篇:
C++ cli_print函数代码示例发布时间: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