MD5

[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); } } }

 

posted @ 2016-11-03 22:13  茗::流  阅读(153)  评论(0)    收藏  举报
如有雷同,纯属参考。如有侵犯你的版权,请联系我。