You might try iterating over the strings with isxdigit() function which will only consider hex digits 0-9 and a-f/A-F, (case doesn't matter).
Then convert each char digit returned by isxdigit on each iteration.
See the man page, string chars must be unsigned char so you might have to cast...something like:
isxdigit((unsigned char)inputStr[i])
in a loop.