1f9f00f4a0fd0bf3a1a8840fe661a6f28e9d4a96
galt
  Wed Feb 13 15:11:47 2013 -0800
adding capability to run md5sum against an entire file
diff --git src/lib/hex.c src/lib/hex.c
new file mode 100644
index 0000000..059338f
--- /dev/null
+++ src/lib/hex.c
@@ -0,0 +1,28 @@
+/* Handy hexidecimal functions
+ *   If you don't want to use printf
+ */
+
+#include "common.h"
+
+char nibbleToHex(char n)
+/* convert nibble to hexidecimal character. 0 <= n <= 15. */
+{
+return n + ( n <= 9 ? '0' : 'A' );
+}
+
+void byteToHex(unsigned char n, char *hex)
+/* convert byte to hexidecimal characters. 0 <= n <= 255. */
+{
+*hex++ = nibbleToHex(n & 0xf);
+*hex++ = nibbleToHex(n >> 4);
+}
+
+char *byteToHexString(unsigned char n)
+/* convert byte to hexidecimal string. 0 <= n <= 255. */
+{
+char hex[3];
+byteToHex(n, hex);
+hex[2] = 0;
+return cloneString(hex);
+}
+