diff uptools/libcoding/hexencode.c @ 361:ae2556e256a4

uptools/libcoding: implemented function for generating hex strings
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 04 Mar 2018 23:11:51 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uptools/libcoding/hexencode.c	Sun Mar 04 23:11:51 2018 +0000
@@ -0,0 +1,21 @@
+/*
+ * This module contains the function for generating hex strings.
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+
+make_hex_string(inbuf, len, outbuf)
+	u_char *inbuf;
+	unsigned len;
+	char *outbuf;
+{
+	char *dp = outbuf;
+	unsigned n;
+
+	for (n = 0; n < len; n++) {
+		sprintf(dp, "%02X", inbuf[n]);
+		dp += 2;
+	}
+	*dp = '\0';
+}