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
- LocalizableResourceBuilder.cs
- CodeSnippetTypeMember.cs
- Pair.cs
- TransactionBehavior.cs
- _LoggingObject.cs
- ListViewSelectEventArgs.cs
- OuterGlowBitmapEffect.cs
- WpfKnownMemberInvoker.cs
- FixUpCollection.cs
- CommonRemoteMemoryBlock.cs
- COM2ICategorizePropertiesHandler.cs
- CommonProperties.cs
- ContainerCodeDomSerializer.cs
- Attribute.cs
- Point.cs
- AnimationException.cs
- InputReferenceExpression.cs
- DataGridCaption.cs
- SemaphoreSecurity.cs
- ShutDownListener.cs
- SortedDictionary.cs
- TTSEngineProxy.cs
- Visitor.cs
- SourceItem.cs
- DeclarativeCatalogPart.cs
- TextViewBase.cs
- ProgressChangedEventArgs.cs
- SqlBulkCopyColumnMapping.cs
- WCFServiceClientProxyGenerator.cs
- HandlerBase.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- BlockUIContainer.cs
- UnsafeNativeMethods.cs
- ObjectPropertyMapping.cs
- NameValuePair.cs
- RulePatternOps.cs
- SqlUtils.cs
- SqlStatistics.cs
- FileDataSourceCache.cs
- BufferBuilder.cs
- Button.cs
- ProviderSettingsCollection.cs
- WS2007FederationHttpBindingElement.cs
- Model3DGroup.cs
- TemplateField.cs
- ClientBuildManagerCallback.cs
- EntityWrapperFactory.cs
- SqlConnectionPoolProviderInfo.cs
- ParameterCollection.cs
- SiteMapProvider.cs
- FileSecurity.cs
- SmiContextFactory.cs
- TextParaLineResult.cs
- mediaclock.cs
- PublisherIdentityPermission.cs
- WmlSelectionListAdapter.cs
- QilStrConcat.cs
- AssociationTypeEmitter.cs
- MarginCollapsingState.cs
- DrawingContextDrawingContextWalker.cs
- HyperLinkField.cs
- UnicodeEncoding.cs
- XsltArgumentList.cs
- SimpleWebHandlerParser.cs
- AnimationStorage.cs
- AutomationElementCollection.cs
- DetailsViewInsertedEventArgs.cs
- SQLDecimal.cs
- DocumentPage.cs
- TableRowGroup.cs
- RunWorkerCompletedEventArgs.cs
- SettingsPropertyIsReadOnlyException.cs
- ObjectView.cs
- RadioButtonRenderer.cs
- InertiaTranslationBehavior.cs
- GridViewRowEventArgs.cs
- XPathSelfQuery.cs
- ADMembershipProvider.cs
- DataPager.cs
- HttpsTransportBindingElement.cs
- DbParameterCollectionHelper.cs
- ListBoxItemAutomationPeer.cs
- Material.cs
- StylusCollection.cs
- IconConverter.cs
- FixedSOMPageElement.cs
- TextEvent.cs
- ComponentCollection.cs
- InsufficientMemoryException.cs
- _NegoState.cs
- RootCodeDomSerializer.cs
- AccessDataSource.cs
- DecimalAnimationUsingKeyFrames.cs
- DataGridViewColumn.cs
- XmlBinaryReader.cs
- EventSinkActivity.cs
- EntitySetBaseCollection.cs
- StringCollection.cs
- PersonalizationState.cs
- OdbcEnvironmentHandle.cs