From 8b2d10adc0d155a67f3508d906825df8c8694194 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Mon, 18 Dec 2017 01:49:16 +0100 Subject: ptunnel-ng: * source refactoring * base64 encoding/decoding option --- utils.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'utils.c') diff --git a/utils.c b/utils.c index c1cd6aa..21df7a8 100644 --- a/utils.c +++ b/utils.c @@ -49,3 +49,23 @@ double time_as_double(void) { result = (double)tt.tv_sec + ((double)tt.tv_usec / (double)10e5); return result; } + +#if 0 +static const char hextab[] = "0123456789ABCDEF"; + +void print_hexstr(unsigned char *buf, size_t siz) { + char *out = (char *) calloc(3, siz+1); + unsigned char high, low; + + for (size_t i = 0; i < siz; ++i) { + high = (buf[i] & 0xF0) >> 4; + low = buf[i] & 0x0F; + out[i ] = hextab[high]; + out[i+1] = hextab[low]; + out[i+2] = ' '; + } + + printf("%s\n", out); + free(out); +} +#endif -- cgit v1.2.3