src/Keeg.Crypto/Common/Utils.cs
/// <summary>
/// Converts a hex string to an equivalent byte array.
/// </summary>
/// <param name="hexString">String representing the hex to be conveted.</param>
/// <returns>A <see cref="byte[]"/> array converted from the provided hex string.</returns>
/// <exception cref="ArgumentException">The input must have an even number of characters.</exception>
Converts a hex string to an equivalent byte array.
Converts a hex string to an equivalent byte array .
internal static byte[] HexToBytes(string hexString)
        {
            if ((hexString.Length & 1) != 0)
            {
                throw new ArgumentException("Input must have even number of characters", nameof(hexString));
            }
            int length = hexString.Length / 2;
            byte[] ret = new byte[length];
            int high, low;
            for (int i = 0, j = 0; i < length; i++)
            {
                high = ParseNybble(hexString[j++]);
                low = ParseNybble(hexString[j++]);
                ret[i] = (byte)((high << 4) | low);
            }
            return ret;
        }
internal static byte [ ] HexToBytes ( string hexString ) { if ( ( hexString . Length & 1 ) != 0 ) { throw new ArgumentException ( " " , nameof ( hexString ) ) ; } int length = hexString . Length / 2 ; byte [ ] ret = new byte [ length ] ; int high , low ; for ( int i = 0 , j = 0 ; i < length ; i ++ ) { high = ParseNybble ( hexString [ j ++ ] ) ; low = ParseNybble ( hexString [ j ++ ] ) ; ret [ i ] = ( byte ) ( ( high << 4 ) | low ) ; } return ret ; }
Converts a hex string to an equivalent byte array.
Converts a hex string to an equivalent byte array .
A  array converted from the provided hex string.
A array converted from the provided hex string .
The input must have an even number of characters.
The input must have an even number of characters .
hexString
string
String representing the hex to be conveted.
String representing the hex to be conveted .