//Hex bytes may be seperated by 0 or more whitespace characters.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
internal static class Util
{
internal static byte[] HexStringToBytes(string input)
{
if (input == null)
return null;
List bytes = new List();
foreach (string hexSubstring in input.Split(' ', '\t', '\n'))
{
Debug.Assert(hexSubstring.Length % 2 == 0, "hexSubstring.Length % 2 == 0");
for (int i = 0; i < hexSubstring.Length; i += 2)
{
bytes.Add(Byte.Parse(hexSubstring.Substring(i, 2), NumberStyles.HexNumber));
}
}
return bytes.ToArray();
}
}