Hexadecimal number verification and conversion