in UProveCrypto/HashFunction.cs [43:80]
public HashFunction(String hashAlgorithm)
{
if (hashAlgorithm == null)
{
throw new ArgumentNullException("hashAlgorithm");
}
#if NETFX_CORE
hash = HashAlgorithmProvider.OpenAlgorithm(hashAlgorithm.Replace("-", "")).CreateHash();
#else // NETFX_CORE
#if SILVERLIGHT
if (hashAlgorithm.Equals("SHA", StringComparison.OrdinalIgnoreCase) ||
hashAlgorithm.Equals("SHA1", StringComparison.OrdinalIgnoreCase) ||
hashAlgorithm.Equals("System.Security.Cryptography.SHA1", StringComparison.OrdinalIgnoreCase) ||
hashAlgorithm.Equals("http://www.w3.org/2000/09/xmldsig#sha1", StringComparison.OrdinalIgnoreCase))
{
hash = new SHA1Managed();
}
else if (hashAlgorithm.Equals("SHA256", StringComparison.OrdinalIgnoreCase) ||
hashAlgorithm.Equals("SHA-256", StringComparison.OrdinalIgnoreCase) ||
hashAlgorithm.Equals("System.Security.Cryptography.SHA256", StringComparison.OrdinalIgnoreCase) ||
hashAlgorithm.Equals("http://www.w3.org/2001/04/xmlenc#sha256", StringComparison.OrdinalIgnoreCase))
{
hash = new SHA256Managed();
}
else
{
hash = null;
}
#else
hash = HashAlgorithm.Create(hashAlgorithm);
#endif // SILVERLIGHT
#endif // NETFX_CORE
if (hash == null)
{
throw new ArgumentException("Unsupported hash algorithm: " + hashAlgorithm);
}
}