public static HashAlgorithm GetHashAlgorithm(string hashAlgorithm)
{
switch (hashAlgorithm)
{
case "SHA1":
return SHA1.Create();
case "SHA256":
return SHA256.Create();
case "SHA512":
return SHA512.Create();
default:
throw new NotSupportedException(hashAlgorithm);
}
}
}