From 530cc21af3766913d674f90efc8e97ff6602e463 Mon Sep 17 00:00:00 2001 From: Christopher Tarry Date: Fri, 19 Jan 2024 16:35:06 -0500 Subject: [PATCH] replace bin2hex --- src/sia.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/sia.c b/src/sia.c index 057202c..8863966 100644 --- a/src/sia.c +++ b/src/sia.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "blake2b.h" @@ -64,12 +65,7 @@ void deriveAndSign(uint8_t *dst, uint32_t index, const uint8_t *hash) { } void bin2hex(char *dst, const uint8_t *data, uint64_t inlen) { - static uint8_t const hex[] = "0123456789abcdef"; - for (uint64_t i = 0; i < inlen; i++) { - dst[2 * i + 0] = hex[(data[i] >> 4) & 0x0F]; - dst[2 * i + 1] = hex[(data[i] >> 0) & 0x0F]; - } - dst[2 * inlen] = '\0'; + format_hex(data, inlen, dst, inlen * 2 + 1); } void pubkeyToSiaAddress(char *dst, const uint8_t publicKey[static 65]) {