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

C++ phex函数代码示例

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

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



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

示例1: main

int main(void)
{
	
	//256
    uint8_t key[] = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
                      0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4 };
    uint8_t in[]  = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a};
    uint8_t out[16];
	
	for(int i = 0; i < 16; i++)
	{
		out[i] = in[i];
	}
	phex(out,16);
	
    struct AES_ctx ctx;
    AES_init_ctx(&ctx, key);
    AES_ECB_encrypt(&ctx, in);
	phex(in,16);
	AES_init_ctx(&ctx, key);
	AES_ECB_decrypt(&ctx, in);
	phex(out,16);


    return 0;
}
开发者ID:drmilhous,项目名称:Academic,代码行数:26,代码来源:main.c


示例2: usb_keyboard_print_report

void usb_keyboard_print_report(report_keyboard_t *report)
{
    if (!debug_keyboard) return;
    print("keys: ");
    for (int i = 0; i < REPORT_KEYS; i++) { phex(report->keys[i]); print(" "); }
    print(" mods: "); phex(report->mods); print("\n");
}
开发者ID:moparisthebest,项目名称:tmk_keyboard,代码行数:7,代码来源:usb_keyboard.c


示例3: parse_macro

void parse_macro(char* line){
	uint8_t action, length, i, j = 0;
	if(memcmp(line,"[MACRO_",7)==0){
		macro_idx = line[7] - '0' - 1;
	} else { 
		ptr = line;
		j=0;
		while((token = strtok_r(ptr, ",", &rest)) != NULL) {
			ptr2 = token;
			i = length = action = 0;
			while((token2 = strtok_r(ptr2, ":", &rest2)) != NULL) {
				if(i==0){
					length = atoi(token2);
				} else if(i == 1){
					action = lookup_id(token2);
				}
				i++;
				ptr2 = rest2;
			}
			phex(action); phex(length); print("\n");
			macro_steps[macro_idx][(j*2)] = action;
			macro_steps[macro_idx][(j*2)+1] = length;
			ptr = rest;
			j++;
		}
		macro_sizes[macro_idx] = j;
		//for(j=0;j<macro_sizes[macro_idx];){
		//	phex(j);phex(macro_steps[macro_idx][j++]); phex(macro_steps[macro_idx][j++]);print(" ");
		//}
	}
}
开发者ID:myhackit,项目名称:firmware,代码行数:31,代码来源:macro.c


示例4: usb_mouse_print

void usb_mouse_print(int8_t x, int8_t y, int8_t wheel_v, int8_t wheel_h, uint8_t buttons) {
    if (!debug_mouse) return;
    print("usb_mouse[btn|x y v h]: ");
    phex(buttons); print("|");
    phex(x); print(" ");
    phex(y); print(" ");
    phex(wheel_v); print(" ");
    phex(wheel_h); print("\n");
}
开发者ID:0mark,项目名称:tmk_keyboard,代码行数:9,代码来源:usb_mouse.c


示例5: debug_print

void debug_print(void) {
  debug_counter++;
  if(debug_counter > 100) {
    debug_counter = 0;
    for(uint8_t i = 0; i < 7; i++)
      phex(queue[i]);
    print("\n");
    for(uint8_t k = 0; k < NUMBER_OF_KEYS; k++)
      phex(key[k].bounce);
    print("\n");
  }
}
开发者ID:gioele,项目名称:costar_keyboard,代码行数:12,代码来源:main.c


示例6: ffDoTimeout

static NOINLINE void ffDoTimeout(void)
{
	++ff_timeoutCount;
#ifdef DEBUG
	print("bad flip flop status : ");
	phex(ff_step);
	phex(io_read(0x9));
	print(" timeout count : ");
	phex(ff_timeoutCount);
	print("\n");
#endif	
}
开发者ID:eframp,项目名称:p600fw,代码行数:12,代码来源:tuner.c


示例7: action_function

void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
{
    print("action_function called\n");
    print("id  = "); phex(id); print("\n");
    print("opt = "); phex(opt); print("\n");
    if (id == TEENSY_KEY) {
        clear_keyboard();
        print("\n\nJump to bootloader... ");
        _delay_ms(250);
        bootloader_jump(); // should not return
        print("not supported.\n");
    }
}
开发者ID:knight2142,项目名称:nefarious-parakeet,代码行数:13,代码来源:keymap_ergodox_ez.c


示例8: test_decrypt_cbc

static void test_decrypt_cbc(void)
{
  // Example "simulating" a smaller buffer...

  uint8_t key[] = { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x61, 0x62, 0x63, 0x64, 0x65, 0x0a };
  uint8_t iv[]  = { 0x4b, 0xb2, 0x77, 0x87, 0x77, 0xb8, 0x8b, 0xe0, 0xf8, 0x53, 0x4b, 0x7b, 0xd5, 0xba, 0x91, 0x30 };
  /*uint8_t in[]  = { 0x28, 0x93, 0x77, 0xc4, 0x9f, 0x3e, 0xd4, 0x9a, 0x1e, 0x85, 0x84, 0x58, 0x6b, 0x40, 0x23, 0xf8,
					0xff, 0xbd, 0x21, 0x0f, 0x2a, 0x62, 0xe5, 0x4e, 0x6e, 0x89, 0xad, 0x96, 0xee, 0x2e, 0xf2, 0xb9,
                    0x73, 0xbe, 0xd6, 0xb8, 0xe3, 0xc1, 0x74, 0x3b, 0x71, 0x16, 0xe6, 0x9e, 0x22, 0x22, 0x95, 0x16, 
                    0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09, 0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7 };
  uint8_t out[] = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
                    0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
                    0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
                    0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 };
	*/ 
  char in[32] = "1234567890abcdef";
	char out[64] = {0};
 uint8_t buffer[64] = {0};

int j;
  for ( j = 16; j<32; j++)
{
	in[j] = 0x10;
}

  printf("xtx CBC encrypt: \n");
  AES128_CBC_encrypt_buffer(buffer+0, in+0,  32, key, iv);
  phex(buffer);
  //AES128_CBC_decrypt_buffer(buffer+16, in+16, 16, 0, 0);
  phex(buffer+16);
  //AES128_CBC_decrypt_buffer(buffer+32, in+32, 16, 0, 0);
  //AES128_CBC_decrypt_buffer(buffer+48, in+48, 16, 0, 0);

  printf("xtx  CBC encrypt: \n");
  int i;
      for(i = 0; i < 4; ++i)
    {
        //AES128_CBC_decrypt_buffer(buffer + (i*16), in+(i*16), 16, key, iv);
        //phex(buffer + (i*16));
    }
    printf("\n");

  if(0 == strncmp((char*) out, (char*) buffer, 64))
  {
    printf("SUCCESS!\n");
  }
  else
  {
    printf("FAILURE!\n");
  }
}
开发者ID:xutianxi,项目名称:hls_segmenter_aes,代码行数:51,代码来源:test.c


示例9: assert

bool TCPConnection::write(uint8_t *buf, int len) {
	if (stopped) {
		return false;
	}

	assert(buf);
	assert(len > 0);

	boost::shared_array<uint8_t> bufCpy(new uint8_t[len]);

	memcpy(bufCpy.get(), buf, len);
	pendingWrites.increment();
	beetle.writers.schedule(getId(), [this, bufCpy, len] {
		uint8_t bufLen = len;
		if (SSL_write_all(ssl, &bufLen, 1) != 1 || SSL_write_all(ssl, bufCpy.get(), len) != len) {
			if (debug_socket) {
				std::stringstream ss;
				ss << "socket write failed : " << strerror(errno);
				pdebug(ss.str());
			}
			stopInternal();
		} else {
			if (debug_socket) {
				pdebug("wrote " + std::to_string(len) + " bytes to " + getName());
				phex(bufCpy.get(), len);
			}
		}
		pendingWrites.decrement();
	});
	return true;
}
开发者ID:helena-project,项目名称:beetle,代码行数:31,代码来源:TCPConnection.cpp


示例10: matrix_print

void matrix_print(void) {
  print("\nr/c 0123456789ABCDEF\n");
  for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
    phex(row); print(": ");
    pbin_reverse16(matrix_get_row(row));
    print("\n");
  }
}
开发者ID:0xdec,项目名称:qmk_firmware,代码行数:8,代码来源:matrix.c


示例11: matrix_print

void matrix_print(void)
{
    print("\nr/c 01234567\n");
    for (uint8_t row = 0; row < matrix_rows(); row++) {
        phex(row); print(": ");
        pbin_reverse(matrix_get_row(row));
        print("\n");
    }
}
开发者ID:Flight310,项目名称:tmk_keyboard,代码行数:9,代码来源:matrix.c


示例12: matrix_print

void matrix_print(void) {
  print_matrix_header();

  for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
    phex(row); print(": ");
    print_matrix_row(row);
    print("\n");
  }
}
开发者ID:UnderSampled,项目名称:qmk_firmware,代码行数:9,代码来源:custom_matrix_helper.c


示例13: m0110_init

void m0110_init(void)
{
    uint8_t data;
    idle();
    _delay_ms(1000);

    // Model Number
    // M0110 : 0x09  00001001 : model number 4 (100)
    // M0110A: 0x0B  00001011 : model number 5 (101)
    // M0110 & M0120: ???
    m0110_send(M0110_MODEL);
    data = m0110_recv();
    print("m0110_init model: "); phex(data); print("\n");

    m0110_send(M0110_TEST);
    data = m0110_recv();
    print("m0110_init test: "); phex(data); print("\n");
}
开发者ID:mihow,项目名称:tmk_keyboard,代码行数:18,代码来源:m0110.c


示例14: ps2_host_recv

/* get data received by interrupt */
uint8_t ps2_host_recv(void)
{
    if (ps2_error) {
        print("x");
        phex(ps2_error);
        ps2_host_send(0xFE);    // request to resend
        ps2_error = PS2_ERR_NONE;
    }
    idle();
    return pbuf_dequeue();
}
开发者ID:WonjoonLee,项目名称:tmk_keyboard,代码行数:12,代码来源:ps2.c


示例15: mousekey_debug

static void mousekey_debug(void)
{
    if (!debug_mouse) return;
    print("mousekey [btn|x y v h](rep/acl): [");
    phex(mouse_report.buttons); print("|");
    print_decs(mouse_report.x); print(" ");
    print_decs(mouse_report.y); print(" ");
    print_decs(mouse_report.v); print(" ");
    print_decs(mouse_report.h); print("](");
    print_dec(mousekey_repeat); print("/");
    print_dec(mousekey_accel); print(")\n");
}
开发者ID:mikelduffy,项目名称:qmk_firmware,代码行数:12,代码来源:mousekey.c


示例16: matrix_print

void matrix_print() {

    print( "\nr/c 0123456789ABCDEFGHI\n" );

    for ( uint8_t row = 0; row < MATRIX_ROWS; row++ ) {

        phex( row );
        print( ": " );
        xprintf( "%019lb", bitrev32( matrix_get_row( row ) ) >> 13 );
        print( "\n" );
    }
}
开发者ID:mtl,项目名称:tmk_keyboard,代码行数:12,代码来源:matrix.c


示例17: test_encrypt_ecb_verbose

static void test_encrypt_ecb_verbose(void)
{
    // Example of more verbose verification

    uint8_t i, buf[64], buf2[64];

    // 128bit key
    uint8_t key[16] =        { (uint8_t) 0x2b, (uint8_t) 0x7e, (uint8_t) 0x15, (uint8_t) 0x16, (uint8_t) 0x28, (uint8_t) 0xae, (uint8_t) 0xd2, (uint8_t) 0xa6, (uint8_t) 0xab, (uint8_t) 0xf7, (uint8_t) 0x15, (uint8_t) 0x88, (uint8_t) 0x09, (uint8_t) 0xcf, (uint8_t) 0x4f, (uint8_t) 0x3c };
    // 512bit text
    uint8_t plain_text[64] = { (uint8_t) 0x6b, (uint8_t) 0xc1, (uint8_t) 0xbe, (uint8_t) 0xe2, (uint8_t) 0x2e, (uint8_t) 0x40, (uint8_t) 0x9f, (uint8_t) 0x96, (uint8_t) 0xe9, (uint8_t) 0x3d, (uint8_t) 0x7e, (uint8_t) 0x11, (uint8_t) 0x73, (uint8_t) 0x93, (uint8_t) 0x17, (uint8_t) 0x2a,
                               (uint8_t) 0xae, (uint8_t) 0x2d, (uint8_t) 0x8a, (uint8_t) 0x57, (uint8_t) 0x1e, (uint8_t) 0x03, (uint8_t) 0xac, (uint8_t) 0x9c, (uint8_t) 0x9e, (uint8_t) 0xb7, (uint8_t) 0x6f, (uint8_t) 0xac, (uint8_t) 0x45, (uint8_t) 0xaf, (uint8_t) 0x8e, (uint8_t) 0x51,
                               (uint8_t) 0x30, (uint8_t) 0xc8, (uint8_t) 0x1c, (uint8_t) 0x46, (uint8_t) 0xa3, (uint8_t) 0x5c, (uint8_t) 0xe4, (uint8_t) 0x11, (uint8_t) 0xe5, (uint8_t) 0xfb, (uint8_t) 0xc1, (uint8_t) 0x19, (uint8_t) 0x1a, (uint8_t) 0x0a, (uint8_t) 0x52, (uint8_t) 0xef,
                               (uint8_t) 0xf6, (uint8_t) 0x9f, (uint8_t) 0x24, (uint8_t) 0x45, (uint8_t) 0xdf, (uint8_t) 0x4f, (uint8_t) 0x9b, (uint8_t) 0x17, (uint8_t) 0xad, (uint8_t) 0x2b, (uint8_t) 0x41, (uint8_t) 0x7b, (uint8_t) 0xe6, (uint8_t) 0x6c, (uint8_t) 0x37, (uint8_t) 0x10 };

    memset(buf, 0, 64);
    memset(buf2, 0, 64);

    // print text to encrypt, key and IV
    printf("ECB encrypt verbose:\n\n");
    printf("plain text:\n");
    for(i = (uint8_t) 0; i < (uint8_t) 4; ++i)
    {
        phex(plain_text + i * (uint8_t) 16);
    }
    printf("\n");

    printf("key:\n");
    phex(key);
    printf("\n");

    // print the resulting cipher as 4 x 16 byte strings
    printf("ciphertext:\n");
    for(i = 0; i < 4; ++i)
    {
        AES128_ECB_encrypt(plain_text + (i*16), key, buf+(i*16));
        phex(buf + (i*16));
    }
    printf("\n");
}
开发者ID:xutianxi,项目名称:hls_segmenter_aes,代码行数:39,代码来源:test.c


示例18: tuneCV

static LOWERCODESIZE void tuneCV(p600CV_t oscCV, p600CV_t ampCV)
{
#ifdef DEBUG		
	print("\ntuning ");phex(oscCV);print("\n");
#endif
	int8_t isOsc,i;
	
	// init
	
	tuner.currentCV=oscCV;
	isOsc=(oscCV<pcFil1);

	// open VCA

	sh_setCV(ampCV,UINT16_MAX,0);
	
	// tune

	if (isOsc)
	{
		for(i=TUNER_OSC_NTH_C_LO;i<=TUNER_OSC_NTH_C_HI;++i)
			if (tuneOffset(oscCV,i,12*(TUNER_OSC_NTH_C_LO-2),TUNER_OSC_PRECISION))
				break;

		// extrapolate for octaves that aren't directly tunable
		
		for(i=TUNER_OSC_NTH_C_LO-1;i>=0;--i)
			settings.tunes[i][oscCV]=(uint32_t)2*settings.tunes[i+1][oscCV]-settings.tunes[i+2][oscCV];

		for(i=TUNER_OSC_NTH_C_HI+1;i<TUNER_OCTAVE_COUNT;++i)
			settings.tunes[i][oscCV]=(uint32_t)2*settings.tunes[i-1][oscCV]-settings.tunes[i-2][oscCV];
	}
	else
	{
		for(i=TUNER_FIL_NTH_C_LO;i<=TUNER_FIL_NTH_C_HI;++i)
			if (tuneOffset(oscCV,i,12*(TUNER_FIL_NTH_C_LO-1),TUNER_FIL_PRECISION))
				break;

		for(i=TUNER_FIL_NTH_C_LO-1;i>=0;--i)
			settings.tunes[i][oscCV]=(uint32_t)2*settings.tunes[i+1][oscCV]-settings.tunes[i+2][oscCV];

		for(i=TUNER_FIL_NTH_C_HI+1;i<TUNER_OCTAVE_COUNT;++i)
			settings.tunes[i][oscCV]=(uint32_t)2*settings.tunes[i-1][oscCV]-settings.tunes[i-2][oscCV];
	}
	
	// close VCA

	sh_setCV(ampCV,0,0);
	sh_update();
}
开发者ID:eframp,项目名称:p600fw,代码行数:50,代码来源:tuner.c


示例19: vusb_transfer_keyboard

/* transfer keyboard report from buffer */
void vusb_transfer_keyboard(void)
{
    if (usbInterruptIsReady()) {
        if (kbuf_head != kbuf_tail) {
            usbSetInterrupt((void *)&kbuf[kbuf_tail], sizeof(report_keyboard_t));
            kbuf_tail = (kbuf_tail + 1) % KBUF_SIZE;
            if (debug_keyboard) {
                print("V-USB: kbuf["); pdec(kbuf_tail); print("->"); pdec(kbuf_head); print("](");
                phex((kbuf_head < kbuf_tail) ? (KBUF_SIZE - kbuf_tail + kbuf_head) : (kbuf_head - kbuf_tail));
                print(")\n");
            }
        }
    }
}
开发者ID:82times,项目名称:qmk_firmware,代码行数:15,代码来源:vusb.c


示例20: flash_checkId

char flash_checkId(void)
{
	unsigned char mfg,dev;
	
	flash_command(0x90);
	
	SET_ADDR(0);
	
	mfg=flash_getData();
	print("mfg ");
	phex(mfg);
	print(" dev ");

	SET_ADDR(1);

	dev=flash_getData();
	phex(dev);
	print("\n");

	flash_command(0xf0);
	
	return (mfg==0x9d) && (dev==0x1d || dev==0x2d);
}
开发者ID:amuntner,项目名称:rx5usb,代码行数:23,代码来源:flash_pmc29f002.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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