[System.Runtime.InteropServices.ComVisible(true)]
public abstract class SHA1 : HashAlgorithm
{
protected SHA1()
{
HashSizeValue = 160;
}
new static public SHA1 Create()
{
return Create("System.Security.Cryptography.SHA1");
}
new static public SHA1 Create(String hashName)
{
return (SHA1)CryptoConfig.CreateFromName(hashName);
}
}
[System.Runtime.InteropServices.ComVisible(true)]
public class SHA1Managed : SHA1
{
public SHA1Managed()
{
#if FEATURE_CRYPTO
if (CryptoConfig.AllowOnlyFipsAlgorithms)
throw new InvalidOperationException(Environment.GetResourceString("Cryptography_NonCompliantFIPSAlgorithm"));
Contract.EndContractBlock();
#endif // FEATURE_CRYPTO
_stateSHA1 = new uint[5];
_buffer = new byte[64];
_expandedBuffer = new uint[80];
InitializeState();
}
}
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public sealed class SHA1Cng : SHA1
{
private BCryptHashAlgorithm m_hashAlgorithm;
public SHA1Cng()
{
Contract.Ensures(m_hashAlgorithm != null);
m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha1, BCryptNative.ProviderName.MicrosoftPrimitiveProvider);
}
protected override void Dispose(bool disposing)
{
try
{
if (disposing)
{
m_hashAlgorithm.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
}