Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / MD5Cng.cs / 1305376 / MD5Cng.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== using System; using System.Diagnostics.Contracts; namespace System.Security.Cryptography { ////// Wrapper around the BCrypt implementation of the MD5 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class MD5Cng : MD5 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] 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); } //// // [System.Security.SecurityCritical] protected override void Dispose(bool disposing) { try { if (disposing) { m_hashAlgorithm.Dispose(); } } finally { base.Dispose(disposing); } } //// // [System.Security.SecurityCritical] public override void Initialize() { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.Initialize(); } //// // [System.Security.SecurityCritical] protected override void HashCore(byte[] array, int ibStart, int cbSize) { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.HashCore(array, ibStart, cbSize); } //// // [System.Security.SecurityCritical] protected override byte[] HashFinal() { Contract.Assert(m_hashAlgorithm != null); return m_hashAlgorithm.HashFinal(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== using System; using System.Diagnostics.Contracts; namespace System.Security.Cryptography { ///// /// Wrapper around the BCrypt implementation of the MD5 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class MD5Cng : MD5 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] 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); } //// // [System.Security.SecurityCritical] protected override void Dispose(bool disposing) { try { if (disposing) { m_hashAlgorithm.Dispose(); } } finally { base.Dispose(disposing); } } //// // [System.Security.SecurityCritical] public override void Initialize() { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.Initialize(); } //// // [System.Security.SecurityCritical] protected override void HashCore(byte[] array, int ibStart, int cbSize) { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.HashCore(array, ibStart, cbSize); } //// // [System.Security.SecurityCritical] protected override byte[] HashFinal() { Contract.Assert(m_hashAlgorithm != null); return m_hashAlgorithm.HashFinal(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.//
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextElement.cs
- QueryOutputWriter.cs
- PersonalizationStateQuery.cs
- ActivationServices.cs
- PropertiesTab.cs
- NotCondition.cs
- AdapterUtil.cs
- BufferedReadStream.cs
- AuthorizationRule.cs
- ToolStripHighContrastRenderer.cs
- XmlReturnWriter.cs
- MergeFailedEvent.cs
- SecUtil.cs
- ElementNotAvailableException.cs
- GridViewEditEventArgs.cs
- DbParameterCollectionHelper.cs
- ProtectedConfigurationSection.cs
- SafeEventHandle.cs
- querybuilder.cs
- ConfigXmlReader.cs
- StreamMarshaler.cs
- MemoryRecordBuffer.cs
- RuleConditionDialog.cs
- MailMessage.cs
- WebPartHelpVerb.cs
- DirectoryInfo.cs
- CannotUnloadAppDomainException.cs
- bindurihelper.cs
- InstalledFontCollection.cs
- LayoutEngine.cs
- GatewayDefinition.cs
- CodeExpressionStatement.cs
- BitmapMetadata.cs
- LinqExpressionNormalizer.cs
- EntityUtil.cs
- TargetControlTypeAttribute.cs
- ItemCollection.cs
- CompileLiteralTextParser.cs
- StandardMenuStripVerb.cs
- SafeFileMappingHandle.cs
- ProtocolViolationException.cs
- ListSortDescriptionCollection.cs
- SqlUdtInfo.cs
- RawTextInputReport.cs
- WindowsClaimSet.cs
- _DomainName.cs
- ClientBuildManagerCallback.cs
- LayoutManager.cs
- Token.cs
- IPAddress.cs
- BaseContextMenu.cs
- ProtocolElementCollection.cs
- PathTooLongException.cs
- DeclaredTypeElementCollection.cs
- Positioning.cs
- HttpHostedTransportConfiguration.cs
- ValueUtilsSmi.cs
- EventHandlers.cs
- PermissionSetEnumerator.cs
- GridViewRowCollection.cs
- Internal.cs
- DisplayNameAttribute.cs
- sqlcontext.cs
- ServiceElement.cs
- RepeatInfo.cs
- DataObjectPastingEventArgs.cs
- LineGeometry.cs
- StateItem.cs
- UIElementAutomationPeer.cs
- WorkflowMessageEventArgs.cs
- FactoryMaker.cs
- DataGridViewCheckBoxCell.cs
- ExpressionBuilder.cs
- SessionEndingCancelEventArgs.cs
- CheckBoxAutomationPeer.cs
- RemoveStoryboard.cs
- XPathException.cs
- GacUtil.cs
- ScriptManagerProxy.cs
- GroupItemAutomationPeer.cs
- ReadOnlyPermissionSet.cs
- XmlUtf8RawTextWriter.cs
- HttpCacheVary.cs
- OracleCommandSet.cs
- XmlDigitalSignatureProcessor.cs
- HttpCapabilitiesEvaluator.cs
- FormatVersion.cs
- XmlNamespaceDeclarationsAttribute.cs
- MailFileEditor.cs
- ProcessInfo.cs
- ToolStripOverflowButton.cs
- SetStateEventArgs.cs
- TypedElement.cs
- FontNamesConverter.cs
- SqlDataSourceStatusEventArgs.cs
- SqlVisitor.cs
- DescendantOverDescendantQuery.cs
- MetafileHeader.cs
- TagPrefixAttribute.cs
- QueryStringHandler.cs