is_hex implementation