utils: tal_hexstr() helper.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-05-03 10:59:20 +09:30
parent 6f2cb72c27
commit 9eabab78ab
6 changed files with 27 additions and 13 deletions

9
utils.c Normal file
View File

@@ -0,0 +1,9 @@
#include "utils.h"
#include <ccan/str/hex/hex.h>
char *tal_hexstr(const tal_t *ctx, const void *data, size_t len)
{
char *str = tal_arr(ctx, char, hex_str_size(len));
hex_encode(data, len, str, hex_str_size(len));
return str;
}