20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
-
+
|
/*
* Binary string to hex string
*/
int String_to_Hex(unsigned char* input, int ilen, unsigned char *output, int olen) {
int count = 0;
unsigned char *iptr = input;
unsigned char *optr = &output[0];
const char *hex = "0123456789ABCDEF";
const char *hex = "0123456789abcdef";
for (int i = 0; i < ilen && count < olen - 1; i++, count += 2) {
*optr++ = hex[(*iptr>>4)&0xF];
*optr++ = hex[(*iptr++)&0xF];
}
*optr = 0;
return count;
|