diff --git a/enzevalos_iphone/c/openssl-helpers.c b/enzevalos_iphone/c/openssl-helpers.c index e71e96edd6c26ff488471f1c66bc0581b6ffd03f..cb073ca8b440b7ce714355971453ade0b70423da 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; +} +