<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.1" />

Org.BouncyCastle.Utilities.Encoders.Hex

public sealed class Hex
Class to decode and encode Hex.
namespace Org.BouncyCastle.Utilities.Encoders { public sealed class Hex { public static string ToHexString(byte[] data); public static string ToHexString(byte[] data, bool upperCase); public static string ToHexString(byte[] data, int off, int length); public static string ToHexString(byte[] data, int off, int length, bool upperCase); public static byte[] Encode(byte[] data); public static byte[] Encode(byte[] data, int off, int length); public static int Encode(byte[] data, Stream outStream); public static int Encode(byte[] data, int off, int length, Stream outStream); public static byte[] Decode(byte[] data); public static byte[] Decode(string data); public static int Decode(string data, Stream outStream); public static byte[] DecodeStrict(string str); public static byte[] DecodeStrict(string str, int off, int len); } }