summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 252f566dee..717285babe 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -234,22 +234,6 @@ void set_uint32(char *cp, uint32_t v)
}
#endif
-/** Encode the first <b>fromlen</b> bytes stored at <b>from</b> in hexidecimal;
- * write the result as a NUL-terminated string to <b>to</b>. <b>to</b> must
- * have at least (2*fromlen)+1 bytes of free space.
- */
-void hex_encode(const char *from, int fromlen, char *to)
-{
- const unsigned char *fp = from;
- static const char TABLE[] = "0123456789abcdef";
- tor_assert(from && fromlen>=0 && to);
- while (fromlen--) {
- *to++ = TABLE[*fp >> 4];
- *to++ = TABLE[*fp & 7];
- ++fp;
- }
- *to = '\0';
-}
/** Return a pointer to a NUL-terminated hexidecimal string encoding
* the first <b>fromlen</b> bytes of <b>from</b>. (fromlen must be \<= 32.) The
@@ -261,7 +245,7 @@ const char *hex_str(const char *from, int fromlen)
static char buf[65];
if (fromlen>(sizeof(buf)-1)/2)
fromlen = (sizeof(buf)-1)/2;
- hex_encode(from,fromlen,buf);
+ base16_encode(buf,64,from,fromlen);
return buf;
}