[System.Runtime.InteropServices.ComVisible(true)]
public abstract class MD5 : HashAlgorithm
{
protected MD5()
{
HashSizeValue = 128;
}
new static public MD5 Create()
{
return Create("System.Security.Cryptography.MD5");
}
new static public MD5 Create(String algName)
{
return (MD5)CryptoConfig.CreateFromName(algName);
}
}
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public sealed class MD5Cng : MD5
{
private BCryptHashAlgorithm m_hashAlgorithm;
public MD5Cng()
{
Contract.Ensures(m_hashAlgorithm != null);
if (CryptoConfig.AllowOnlyFipsAlgorithms)
{
throw new InvalidOperationException(SR.GetString(SR.Cryptography_NonCompliantFIPSAlgorithm));
}
m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.MD5, BCryptNative.ProviderName.MicrosoftPrimitiveProvider);
}
protected override void Dispose(bool disposing)
{
try
{
if (disposing)
{
m_hashAlgorithm.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
}