diff options
-rw-r--r-- | source4/lib/data_blob.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/lib/data_blob.c b/source4/lib/data_blob.c index c5f15f1271..a4506fee45 100644 --- a/source4/lib/data_blob.c +++ b/source4/lib/data_blob.c @@ -142,3 +142,21 @@ BOOL data_blob_equal(const DATA_BLOB *d1, const DATA_BLOB *d2) return False; } +/******************************************************************* +print the data_blob as hex string +*******************************************************************/ +char *data_blob_hex_string(TALLOC_CTX *mem_ctx, DATA_BLOB *blob) +{ + int i; + char *hex_string; + + hex_string = talloc_array_p(mem_ctx, char, (blob->length*2)+1); + if (!hex_string) { + return NULL; + } + + for (i = 0; i < blob->length; i++) + slprintf(&hex_string[i*2], 3, "%02X", blob->data[i]); + + return hex_string; +} |