<PackageReference Include="System.Text.Json" Version="10.0.0-preview.1.25080.5" />

HexConverter

static class HexConverter
using System.Runtime.CompilerServices; namespace System { internal static class HexConverter { public unsafe static ReadOnlySpan<byte> CharToHexLookup => new ReadOnlySpan<byte>(&global::<PrivateImplementationDetails>.21244F82B210125632917591768F6BF22EB6861F80C6C25A25BD26DFB580EA7B, 256); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int FromChar(int c) { ReadOnlySpan<byte> charToHexLookup = CharToHexLookup; if (c < charToHexLookup.Length) { charToHexLookup = CharToHexLookup; return charToHexLookup[c]; } return 255; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsHexChar(int c) { if (IntPtr.Size == 8) { ulong num = (uint)(c - 48); long num2 = -17875860044349952 << (int)num; ulong num3 = num - 64; return (num2 & (long)num3) < 0; } return FromChar(c) != 255; } } }