hexchar_to_byte
byte = hexchar_to_byte(buf[2 * i]) << 4;
byte += hexchar_to_byte(buf[2 * i + 1]);
static unsigned char hexchar_to_byte(unsigned char c);