private static HashAlgorithm GetHashAlgorithm(HashAlgorithmName hashAlgorithm)
{
switch (hashAlgorithm.Name)
{
case "MD5":
return MD5.Create();
case "SHA1":
return SHA1.Create();
case "SHA256":
return SHA256.Create();
case "SHA384":
return SHA384.Create();
case "SHA512":
return SHA512.Create();
default:
throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name);
}
}