From 43d12f9f2b61d4d342bd0c3d1afb90734f7acb89 Mon Sep 17 00:00:00 2001 From: Douglas Engels <douglas.engels@fu-berlin.de> Date: Tue, 10 Mar 2020 15:26:09 +0100 Subject: [PATCH] Added bintohexfunc --- enzevalos_iphone/c/openssl-helpers.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/enzevalos_iphone/c/openssl-helpers.c b/enzevalos_iphone/c/openssl-helpers.c index e71e96ed..cb073ca8 100644 --- a/enzevalos_iphone/c/openssl-helpers.c +++ b/enzevalos_iphone/c/openssl-helpers.c @@ -469,3 +469,17 @@ void deallocate_str_arr(char **arr, int len) free(arr); } +char *bin_to_hex ( unsigned char *bin, int len) +{ + unsigned char buf[3]; + char *res = malloc(2*len+1); + for (int i =0;i<len;i++) + { + sprintf(buf, "%02x", bin[i]); + res[i*2]=buf[0]; + res[i*2+1]=buf[1]; + } + res[len*2]=0; + return res; +} + -- GitLab