-/*********************************************************************
- *
- * Function : hex_to_byte
- *
- * Description : Converts two bytes in hex into a single byte
- * with that value. For example '40' is converted
- * into '@'.
- *
- * Based on Werner Koch's _gpgme_hextobyte()
- * in gpgme's conversion.c.
- *
- * Parameters :
- * 1 : hex_sequence = Pointer to the two bytes to convert.
- *
- * Returns : The byte value.
- *
- *********************************************************************/
-static char hex_to_byte(const char *hex_sequence)
-{
- const char *current_position = hex_sequence;
- int value = 0;
-
- do
- {
- const char current_digit = (char)toupper(*current_position);
-
- if ((current_digit >= '0') && (current_digit <= '9'))
- {
- value += current_digit - '0';
- }
- else if ((current_digit >= 'A') && (current_digit <= 'F'))
- {
- value += current_digit - 'A' + 10; /* + 10 for the hex offset */
- }
-
- if (current_position == hex_sequence)
- {
- /*
- * As 0xNM is N * 16**1 + M * 16**0, the value
- * of the first byte has to be multiplied.
- */
- value *= 16;
- }
-
- } while (current_position++ < hex_sequence + 1);
-
- return (char)value;
-
-}
-
-