本文整理汇总了C++中dump_hex函数的典型用法代码示例。如果您正苦于以下问题:C++ dump_hex函数的具体用法?C++ dump_hex怎么用?C++ dump_hex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dump_hex函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lan_send
static void
lan_send(lan_data_t *lan,
struct iovec *data, int vecs,
void *addr, int addr_len)
{
struct msghdr msg;
lan_addr_t *l = addr;
int rv;
if (debug) {
int left, i;
lanserv_log(DEBUG, NULL, "Sending message to:\n ");
dump_hex(&l->addr, l->addr_len, 16);
lanserv_log(DEBUG, NULL, "\nMsg:\n ");
left = 16;
for (i=0; i<vecs; i++) {
left = dump_hex(data[i].iov_base, data[i].iov_len, left);
}
lanserv_log(DEBUG, NULL, "\n");
}
msg.msg_name = &(l->addr);
msg.msg_namelen = l->addr_len;
msg.msg_iov = data;
msg.msg_iovlen = vecs;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = 0;
rv = sendmsg(l->xmit_fd, &msg, 0);
if (rv) {
/* FIXME - log an error. */
}
}
开发者ID:ystk,项目名称:debian-openipmi,代码行数:34,代码来源:lanserv.c
示例2: diff_records
void diff_records( token_mod_link** differences,
tglobal* global_original, tglobal* global_updated,
tfixed* fixed_original, tfixed* fixed_updated,
tlog* log_original, tlog* log_updated,
bool print_diff_info ) {
token_mod_link* diff_pair = NULL;
/* We may want to print the timestamps of the records
* being compared in order to differentiate them, in fact
* this is an essential part of the process...
*/
while( diff_pair = pop_tm_link( differences ) ) {
printf( "Difference found on token [%d]\n",
diff_pair->original ?
(unsigned short)diff_pair->original->token :
diff_pair->modified ?
(unsigned short)diff_pair->modified->token :
(unsigned short)-1 );
printf( "Original:\n" );
if ( diff_pair->original ) {
dump_hex( diff_pair->original->buffer,
diff_pair->original->length,
(size_t)DUMP_BYTES,
(size_t)16 );
} else {
printf( "NULL\n" );
}
printf( "Modified:\n" );
if ( diff_pair->modified ) {
dump_hex( diff_pair->modified->buffer,
diff_pair->modified->length,
(size_t)DUMP_BYTES,
(size_t)16 );
} else {
printf( "NULL\n" );
}
}
printf( "Global configuration modifications:\n" );
if ( !diff_global( global_original, global_updated, print_diff_info ) ) {
printf( " None.\n" );
}
printf( "Fixed configuration modifications:\n" );
if ( !diff_fixed( fixed_original, fixed_updated, print_diff_info ) ) {
printf( " None.\n" );
}
printf( "Log configuration modifications:\n" );
if ( !diff_log( log_original, log_updated, print_diff_info ) ) {
printf( " None.\n" );
}
}
开发者ID:jandog8990,项目名称:asl-station-processor,代码行数:55,代码来源:ocfdiff.c
示例3: main
int main(void)
{
uint8_t ct1[32], pt1[32], pt2[32], key[64];
int klen, plen, clen, i, j;
serpent_key_t skey;
serpent_blk ct2;
uint32_t *p;
printf("\nserpent-256 test\n");
for (i = 0; i<sizeof(keys) / sizeof(char*); i++) {
clen = hex2bin(ct1, cipher[i]);
plen = hex2bin(pt1, plain[i]);
klen = hex2bin(key, keys[i]);
/* set key */
memset(&skey, 0, sizeof(skey));
p = (uint32_t*)&skey.x[0][0];
serpent_set_encrypt_key(&skey, key);
printf("\nkey=");
for (j = 0; j<sizeof(skey) / sizeof(serpent_subkey_t) * 4; j++) {
if ((j % 8) == 0)
putchar('\n');
printf("%08X ", p[j]);
}
/* encrypt */
memcpy(ct2.b, pt1, SERPENT_BLOCK_SIZE);
printf("\n\n");
dump_hex("plaintext", ct2.b, 16);
serpent_encrypt(pt1,ct2.b, &skey);
dump_hex("ciphertext", ct2.b, 16);
if (memcmp(ct1, ct2.b, clen) == 0) {
printf("\nEncryption OK");
serpent_decrypt(ct2.b,pt1, &skey);
if (memcmp(pt1, ct2.b, plen) == 0) {
printf("\nDecryption OK");
dump_hex("plaintext", ct2.b, 16);
}
else {
printf("\nDecryption failed");
}
}
else {
printf("\nEncryption failed");
}
}
return 0;
}
开发者ID:zsdev2015,项目名称:GmSSL,代码行数:55,代码来源:serpenttest.c
示例4: check_results
static void check_results (const cl_uint num_devices, gpu_ctx_t *gpu_ctxs)
{
static uint64_t total = 0;
for (cl_uint device_id = 0; device_id < num_devices; device_id++)
{
gpu_ctx_t *gpu_ctx = &gpu_ctxs[device_id];
if (gpu_ctx->num_cached == 0) continue;
const size_t size_results = gpu_ctx->num_threads * sizeof (uint32_t);
gc_clEnqueueReadBuffer (gpu_ctx->command_queue, gpu_ctx->d_results, CL_TRUE, 0, size_results, gpu_ctx->h_results, 0, NULL, NULL);
for (uint32_t thread = 0; thread < gpu_ctx->num_threads; thread++)
{
if (gpu_ctx->h_results[thread] != 0xffffffff)
{
uint32_t gid = gpu_ctx->h_results[thread];
fprintf (stdout, "\nGPU #%2d: ALARM! Candidate number %u cracked the hash! Hex dump following:\n\n", device_id, gid);
dump_hex (stdout, gpu_ctx->plains_buf[gid], gpu_ctx->plains_len[gid]);
FILE *fd = fopen (POTFILE, "ab");
if (fd) // ignore error
{
fprintf (fd, "\nGPU #%2d: ALARM! Candidate number %u cracked the hash! Hex dump following:\n\n", device_id, gid);
dump_hex (fd, gpu_ctx->plains_buf[gid], gpu_ctx->plains_len[gid]);
fclose (fd);
}
exit (0);
}
}
const uint32_t num_cached = gpu_ctx->num_cached;
total += num_cached;
float ms;
timer_get (gpu_ctx->timer, ms);
if (ms == 0) continue;
float speed = (num_cached / ms) * 1000;
printf ("GPU #%2d: %u candidates in %u ms [%u/s] - Total = %llu...\n", device_id, num_cached, (uint32_t) ms, (uint32_t) speed, (long long unsigned int) total);
}
}
开发者ID:jsteube,项目名称:oclGaussCrack,代码行数:54,代码来源:oclGaussCrack.c
示例5: ccsrp_component_equal
CC_INLINE bool
ccsrp_component_equal(char *label, ccsrp_ctx_t srp, cc_unit *a, cc_unit *b) {
bool retval = ccn_cmp(ccsrp_ctx_n(srp), a, b) == 0;
if(!retval) {
size_t bytes_n = ccsrp_ctx_sizeof_n(srp);
cc_printf("ccsrp_test_calculations: mismatch for %s:\n", label);
cc_printf("\t");
dump_hex((void *) a, bytes_n);
cc_printf("\t");
dump_hex((void *) b, bytes_n);
cc_printf("\n");
}
return retval;
}
开发者ID:randombit,项目名称:hacrypto,代码行数:14,代码来源:ccsrp_test_calculations.c
示例6: thex_dump_dime_records
static void
thex_dump_dime_records(const pslist_t *records)
{
const pslist_t *iter;
PSLIST_FOREACH(records, iter) {
const struct dime_record *record = iter->data;
g_assert(record);
dump_hex(stderr, "THEX DIME record type",
dime_record_type(record), dime_record_type_length(record));
dump_hex(stderr, "THEX DIME record ID",
dime_record_id(record), dime_record_id_length(record));
}
}
开发者ID:luciomarinelli,项目名称:gtk-gnutella,代码行数:15,代码来源:thex_download.c
示例7: thex_dump_dime_records
static void
thex_dump_dime_records(const GSList *records)
{
const GSList *iter;
for (iter = records; NULL != iter; iter = g_slist_next(iter)) {
const struct dime_record *record;
record = iter->data;
g_assert(record);
dump_hex(stderr, "THEX DIME record type",
dime_record_type(record), dime_record_type_length(record));
dump_hex(stderr, "THEX DIME record ID",
dime_record_id(record), dime_record_id_length(record));
}
}
开发者ID:MrJoe,项目名称:gtk-gnutella,代码行数:16,代码来源:thex_download.c
示例8: pack_unpack_datatype
static int pack_unpack_datatype( void* send_data, ompi_datatype_t *datatype, int count,
void* recv_data,
checker_t validator, void* validator_arg)
{
MPI_Aint position = 0, buffer_size;
void* buffer;
int error;
error = ompi_datatype_pack_external_size("external32",
count, datatype, &buffer_size);
if( MPI_SUCCESS != error ) goto return_error_code;
buffer = (void*)malloc(buffer_size);
if( NULL == buffer ) { error = MPI_ERR_UNKNOWN; goto return_error_code; }
error = ompi_datatype_pack_external("external32", (void*)send_data, count, datatype,
buffer, buffer_size, &position);
if( MPI_SUCCESS != error ) goto return_error_code;
if( 0 != validator(send_data, buffer, datatype, count, validator_arg) ) {
printf("Error during pack external. Bailing out\n");
return -1;
}
printf("packed %ld bytes into a %ld bytes buffer ", position, buffer_size); dump_hex(buffer, position); printf("\n");
position = 0;
error = ompi_datatype_unpack_external("external32", buffer, buffer_size, &position,
recv_data, count, datatype);
if( MPI_SUCCESS != error ) goto return_error_code;
free(buffer);
return_error_code:
return (error == MPI_SUCCESS ? 0 : -1);
}
开发者ID:00datman,项目名称:ompi,代码行数:34,代码来源:external32.c
示例9: main
/*
* === FUNCTION ======================================================================
* Name: main
* Description:
* =====================================================================================
*/
int main(int argc, char *argv[])
{
if (argc != 2)
{
printf("Usage: HexDump file \n");
return 1;
}
FILE *file = fopen(argv[1], "rb");
if (!file)
{
printf("Can't open the file.\n");
return 2;
}
char str[640000];
int len = 0;
char d[17] ; d[16]=0;
unsigned int bytes = 0;
while (bytes = fread(d, 1, 16, file))
{
memcpy(str+len,d,bytes);
printf("%s",d);
len += bytes;
}
printf("len = %d\n",len);
dump_hex(str,len);
fclose(file);
return 0;
}
开发者ID:togear,项目名称:tools,代码行数:39,代码来源:dump_hex.c
示例10: huge_tth_extract32
bool
huge_tth_extract32(const char *buf, size_t len, struct tth *tth,
const gnutella_node_t *n)
{
if (len != TTH_BASE32_SIZE)
goto bad;
if (TTH_RAW_SIZE != base32_decode(tth->data, sizeof tth->data, buf, len))
goto bad;
return TRUE;
bad:
if (GNET_PROPERTY(share_debug)) {
if (is_printable(buf, len)) {
g_warning("%s has bad TTH (len=%u): %.*s",
gmsg_node_infostr(n),
(unsigned) len,
(int) MIN(len, (size_t) INT_MAX),
buf);
} else {
g_warning("%s has bad TTH (len=%u",
gmsg_node_infostr(n), (unsigned) len);
if (len)
dump_hex(stderr, "Base32 TTH", buf, len);
}
}
return FALSE;
}
开发者ID:lucab,项目名称:gtk-gnutella,代码行数:29,代码来源:huge.c
示例11: WriteFdExactly
bool WriteFdExactly(int fd, const void* buf, size_t len) {
const char* p = reinterpret_cast<const char*>(buf);
int r;
#if ADB_TRACE
D("writex: fd=%d len=%d: ", fd, (int)len);
if (ADB_TRACING) {
dump_hex(reinterpret_cast<const unsigned char*>(buf), len);
}
#endif
while (len > 0) {
r = adb_write(fd, p, len);
if (r == -1) {
D("writex: fd=%d error %d: %s\n", fd, errno, strerror(errno));
if (errno == EAGAIN) {
adb_sleep_ms(1); // just yield some cpu time
continue;
} else if (errno == EPIPE) {
D("writex: fd=%d disconnected\n", fd);
errno = 0;
return false;
} else {
return false;
}
} else {
len -= r;
p += r;
}
}
return true;
}
开发者ID:AOSP-JF,项目名称:platform_system_core,代码行数:32,代码来源:adb_io.cpp
示例12: writex
int writex(int fd, const void *ptr, size_t len)
{
char *p = (char*)ptr;
int r;
#if ADB_TRACE
D("writex: fd=%d len=%d: ", fd, (int)len);
dump_hex((const unsigned char *)ptr, len);
#endif
while (len > 0) {
r = adb_write(fd, p, len);
if (r > 0) {
len -= r;
p += r;
}
else {
if (r < 0) {
D("writex: fd=%d error %d: %s\n", fd, errno, strerror(errno));
if (errno == EINTR)
continue;
if (errno == EAGAIN) {
adb_sleep_ms(1); // just yield some cpu time
continue;
}
}
else {
D("writex: fd=%d disconnected\n", fd);
}
return -1;
}
}
return 0;
}
开发者ID:ZT-,项目名称:Adb,代码行数:33,代码来源:transport.cpp
示例13: update_dump
void update_dump()
{
if(hex_dlg != NULL)
dump_hex();
if(text_dlg != NULL)
dump_text();
}
开发者ID:fujii,项目名称:ebview,代码行数:7,代码来源:dump.c
示例14: DumpCobol
void DumpCobol(BYTE level)
{
BYTE ch;
StdOutPrintf(L"\tLevel = %2d", level & 0x7f);
if (level & 0x80) {
StdOutPuts(L"(Group)");
}
loop:
// check next byte of type string
ch = getbyte();
if ((ch & 0xfe) == 0xc0) {
// output linkage informatioon byte
DumpCobLinkage (ch);
if (Leaf_pos < Leaf_bytes) {
ch = getbyte();
}
goto loop;
}
if (Leaf_pos <= Leaf_bytes) {
if ((ch & 0xe0) == 0xe0) {
// output OCCURS subscript information
DumpCobOccurs (ch);
goto loop;
}
}
if (Leaf_pos <= Leaf_bytes) {
DumpCobItem (ch);
}
dump_hex((Leaf_bytes - Leaf_pos), true);
StdOutPuts(L"\n");
}
开发者ID:9176324,项目名称:microsoft-pdb,代码行数:33,代码来源:type6.cpp
示例15: readx
int readx(int fd, void *ptr, size_t len)
{
char *p = ptr;
int r;
#if ADB_TRACE
int len0 = len;
#endif
D("readx: %d %p %d\n", fd, ptr, (int)len);
while(len > 0) {
r = adb_read(fd, p, len);
if(r > 0) {
len -= r;
p += r;
} else {
D("readx: %d %d %s\n", fd, r, strerror(errno));
if((r < 0) && (errno == EINTR)) continue;
return -1;
}
}
#if ADB_TRACE
D("readx: %d ok: ", fd);
dump_hex( ptr, len0 );
#endif
return 0;
}
开发者ID:AnahiAramayo,项目名称:rxwen-blog-stuff,代码行数:26,代码来源:transport.c
示例16: server_recv_cb
/*
*
* xsocks UDP Response
* +------+----------+----------+----------+
* | ATYP | DST.ADDR | DST.PORT | DATA |
* +------+----------+----------+----------+
* | 1 | Variable | 2 | Variable |
* +------+----------+----------+----------+
*
*/
static void
server_recv_cb(uv_udp_t *handle, ssize_t nread, const uv_buf_t *buf, const struct sockaddr *addr, unsigned flags) {
if (nread > 0) {
struct client_context *client = handle->data;
reset_timer(client);
int mlen = nread - PRIMITIVE_BYTES;
uint8_t *m = (uint8_t *)buf->base;
int rc = crypto_decrypt(m, (uint8_t *)buf->base, nread);
if (rc) {
logger_log(LOG_ERR, "invalid packet");
dump_hex(buf->base, nread, "server recv");
goto err;
}
m -= 3;
mlen += 3;
memcpy(m, "\x0\x0\x0", 3); // RSV + FRAG
forward_to_client(client, m , mlen);
return;
} else {
goto err;
}
err:
free(buf->base - 3);
}
开发者ID:nsdown,项目名称:xsocks-1,代码行数:40,代码来源:xsocks_udprelay.c
示例17: ReadFdExactly
bool ReadFdExactly(int fd, void* buf, size_t len) {
char* p = reinterpret_cast<char*>(buf);
#if ADB_TRACE
size_t len0 = len;
#endif
D("readx: fd=%d wanted=%zu\n", fd, len);
while (len > 0) {
int r = adb_read(fd, p, len);
if (r > 0) {
len -= r;
p += r;
} else if (r == -1) {
D("readx: fd=%d error %d: %s\n", fd, errno, strerror(errno));
return false;
} else {
D("readx: fd=%d disconnected\n", fd);
errno = 0;
return false;
}
}
#if ADB_TRACE
D("readx: fd=%d wanted=%zu got=%zu\n", fd, len0, len0 - len);
if (ADB_TRACING) {
dump_hex(reinterpret_cast<const unsigned char*>(buf), len0);
}
#endif
return true;
}
开发者ID:AOSP-JF,项目名称:platform_system_core,代码行数:32,代码来源:adb_io.cpp
示例18: Dump_specific_section
void Dump_specific_section( uint sect, const uint_8 *data, uint len )
/*******************************************************************/
{
sort_tables();
switch( sect ) {
case DW_DEBUG_ABBREV:
dump_abbrevs( data, len );
break;
case DW_DEBUG_INFO:
dump_info( data, len );
break;
case DW_DEBUG_ARANGES:
dump_aranges( data, len );
break;
case DW_DEBUG_LINE:
Dump_lines( data, len );
break;
case DW_DEBUG_REF:
dump_ref( data, len );
break;
case DW_DEBUG_PUBNAMES:
dump_pubnames( data, len );
break;
default:
dump_hex( data, len );
break;
}
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:28,代码来源:wsect.c
示例19: dump_osec
/*
* d u m p _ o s e c
*
* Dump object file section.
*
* Returns: OK Success
* FAILED Invalid arguments
*/
int dump_osec(long addrfirst, long addrlast, int sec, int full)
{
long int addrcount;
/* check that all offsets are valid */
addrcount = o_sectab[sec].os_flen;
if (addrfirst > o_sectab[sec].os_flen || addrlast > o_sectab[sec].os_flen) {
fprintf(stderr, "Invalid %s address range 0x%08.8lu to 0x%08.8lu\n",
o_secnam[sec], addrfirst, addrlast);
return(FAILED);
}
else {
if (opt_l)
addrcount = addrlast + 1;
addrcount = addrcount - addrfirst;
(void) fseek(objfp, o_sectab[sec].os_foff, SEEK_SET);
fprintf(stdout, "\n%s%s:\n", full ? "Disassembled " : "", o_secnam[sec]);
if (full)
(void) dump_odata(objfp, addrfirst, addrcount, sec);
else
(void) dump_hex(objfp, addrfirst, addrcount);
return(OK);
}
/* NOTREACHED */
}
开发者ID:bfeng,项目名称:mipc,代码行数:33,代码来源:diso.c
示例20: mem_dump
/*
****************************************************************
* Imprime DUMP da memória *
****************************************************************
*/
void
mem_dump (void)
{
char area[32];
int i;
for (EVER)
{
printf ("\nDê o endereço inicial: ");
gets (area);
if (area[0] == 'n') /* EOF */
return;
i = strtol (area, (const char **)NULL, 0);
if (i == -1) /* EOF */
return;
for (EVER)
{
dump_hex ((char *)i, BLSZ, i);
printf ("Continua? (s): ");
if (askyesno (1) <= 0)
break;
i += BLSZ;
}
}
} /* end mem_dump */
开发者ID:marioaugustorama,项目名称:tropix-kernel,代码行数:38,代码来源:dump.c
注:本文中的dump_hex函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论