public static void Main()
string[] hexStringsToCheck = { "04fc72cf11fa64e6db9c0675ccdae758", "64E6DB9C0675CCDAE758", " ", "32 ", "said", "ad", "a0f25", "-4", "", null };
foreach (var text in hexStringsToCheck)
Console.WriteLine("Is Hex: '" + text + "' (" + text.Length + " chars)");
Console.WriteLine("Is *not* Hex: (null)");
Console.WriteLine("Is *not* Hex: '" + text + "' (" + text.Length + " chars)");
public static bool IsHex(string hexString)
if ((hexString ?? string.Empty).Length == 0)
if (hexString.Length > 0 && hexString.Length <= 32)
hexString = hexString.PadLeft(32, '0');
isHex = Guid.TryParse(hexString, out guid);
throw new NotImplementedException("Use some other way to check the hex string!");