c656295e8e186c77de7c45a34aa5d0f85b1d7265 galt Thu Jan 11 18:13:39 2018 -0800 fixing description of hex function. diff --git src/lib/hex.c src/lib/hex.c index e5f8aa7..4dd8c4c 100644 --- src/lib/hex.c +++ src/lib/hex.c @@ -32,31 +32,31 @@ byteToHex(n, hex); hex[2] = 0; return cloneString(hex); } /* And the reverse functions: */ char hexToNibble(char n) /* convert hexidecimal character to nibble. 0-9a-f. */ { return n - ( n <= '9' ? '0' : ('a'-10) ); } unsigned char hexToByte(char *hex) -/* convert byte to hexidecimal characters. 0 <= n <= 255. */ +/* convert hexidecimal characters to unsigned char. */ { unsigned char n = hexToNibble(*hex++); n <<= 4; n += hexToNibble(*hex++); return n; } void hexBinaryString(unsigned char *in, int inSize, char *out, int outSize) /* Convert possibly long binary string to hex string. * Out size needs to be at least 2x inSize+1 */ { assert(inSize * 2 +1 <= outSize); while (--inSize >= 0) {