本文整理汇总了C++中phex函数的典型用法代码示例。如果您正苦于以下问题:C++ phex函数的具体用法?C++ phex怎么用?C++ phex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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");
}
示例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(" ");
//}
}
}
示例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");
}
示例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");
}
}
示例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
}
示例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");
}
}
示例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");
}
}
示例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;
}
示例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");
}
}
示例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");
}
}
示例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");
}
}
示例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");
}
示例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();
}
示例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");
}