From 34b1367373aee57c2a21ec9a993e715c62c37620 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 1 Dec 2004 16:51:37 +0000 Subject: r4027: add a useful function for debugging metze (This used to be commit 41b1ba53fc201b7b9f9d806dccef6258b2a1d157) --- source4/lib/data_blob.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source4') 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; +} -- cgit