use isxdigit() for checking if a character is a hexadecimal digit