]>
Commit | Line | Data |
---|---|---|
534983d7 | 1 | #include <stdio.h> |
2 | #include <stdint.h> | |
3 | ||
4 | void print_hex(const uint8_t * data, const size_t len) | |
5 | { | |
6 | size_t i; | |
7 | ||
8 | for (i=0; i < len; i++) | |
9 | printf("%02x ", data[i]); | |
10 | ||
11 | printf("\n"); | |
12 | } | |
13 | ||
14 | char * sprint_hex(const uint8_t * data, const size_t len) { | |
15 | static char buf[1024]; | |
16 | char * tmp = buf; | |
17 | size_t i; | |
18 | ||
19 | for (i=0; i < len && i < 1024/3; i++, tmp += 3) | |
20 | sprintf(tmp, "%02x ", data[i]); | |
21 | ||
22 | return buf; | |
23 | } |