mirror of
https://github.com/samba-team/samba.git
synced 2025-12-16 00:23:52 +03:00
committed by
Gerald (Jerry) Carter
parent
6504900f1f
commit
702372b343
@@ -244,6 +244,22 @@ _PUBLIC_ void hex_encode(const unsigned char *buff_in, size_t len, char **out_he
|
|||||||
slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]);
|
slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* talloc version of hex_encode()
|
||||||
|
*/
|
||||||
|
_PUBLIC_ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char *hex_buffer;
|
||||||
|
|
||||||
|
hex_buffer = talloc_array(mem_ctx, char, (len*2)+1);
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]);
|
||||||
|
|
||||||
|
return hex_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set a string value, allocing the space for the string
|
Set a string value, allocing the space for the string
|
||||||
**/
|
**/
|
||||||
|
|||||||
Reference in New Issue
Block a user