Hex Encode and Decode in C

Introduction A very common task when working with binary data in C is, converting it to and from Hex. It’s unfortunate that C doesn’t provide a standard function that can take care of this for us. However, it’s pretty easy to implement a set of functions to handle it. Hex encoding is always twice the size of binary. Since hex is base 16 we can take any unsigned char value 0-255 and represent it in two hex digits, 0x00-0xFF....

September 24, 2017 · John