version 1.7.28.1, 2018/05/31 15:34:28
|
version 1.9, 2019/01/23 13:26:28
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004 - 2018 | Copyright 2004 - 2019 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 285 str_Dig2Hex(ait_val_t *digz)
|
Line 285 str_Dig2Hex(ait_val_t *digz)
|
memset(str, 0, AIT_LEN(digz) * 2 + 1); |
memset(str, 0, AIT_LEN(digz) * 2 + 1); |
|
|
for (i = 0, b = AIT_GET_BUF(digz); i < AIT_LEN(digz); i++) { |
for (i = 0, b = AIT_GET_BUF(digz); i < AIT_LEN(digz); i++) { |
|
snprintf(szWork, sizeof szWork, "%02hhX", b[i]); |
|
strncat(str, szWork, 2); |
|
} |
|
|
|
return str; |
|
} |
|
|
|
/* |
|
* str_Dig2Hex2() - Convert from digit array to Hex string |
|
* |
|
* @digz = Digits array |
|
* @diglen = Array length |
|
* return: NULL nothing to do or error; |
|
* !=0 Allocated new converted string (must be e_free()) |
|
*/ |
|
char * |
|
str_Dig2Hex2(u_char * __restrict digz, int diglen) |
|
{ |
|
register int i; |
|
char szWork[3] = { 0, 0, 0 }, *str; |
|
u_char *b; |
|
|
|
if (!digz || !diglen) |
|
return NULL; |
|
|
|
str = e_malloc(diglen * 2 + 1); |
|
if (!str) |
|
return NULL; |
|
else |
|
memset(str, 0, diglen * 2 + 1); |
|
|
|
for (i = 0, b = digz; i < diglen; i++) { |
snprintf(szWork, sizeof szWork, "%02hhX", b[i]); |
snprintf(szWork, sizeof szWork, "%02hhX", b[i]); |
strncat(str, szWork, 2); |
strncat(str, szWork, 2); |
} |
} |