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
- ThicknessConverter.cs
- AutomationPatternInfo.cs
- CodeTypeMember.cs
- DeferredTextReference.cs
- SpecialTypeDataContract.cs
- Vector3DAnimationBase.cs
- Single.cs
- HttpHandlersSection.cs
- LiteralTextParser.cs
- EntityAdapter.cs
- ListControl.cs
- SqlCharStream.cs
- Token.cs
- ClusterRegistryConfigurationProvider.cs
- SizeConverter.cs
- ReferenceService.cs
- DataError.cs
- EnumValAlphaComparer.cs
- Location.cs
- RadioButton.cs
- TextTreeTextNode.cs
- ColumnTypeConverter.cs
- ClientOperationFormatterProvider.cs
- PropertiesTab.cs
- EventListenerClientSide.cs
- HttpPostedFile.cs
- PeerNearMe.cs
- PlatformNotSupportedException.cs
- LocalizabilityAttribute.cs
- ObfuscateAssemblyAttribute.cs
- MasterPageBuildProvider.cs
- ChtmlTextBoxAdapter.cs
- WebPartHeaderCloseVerb.cs
- AlphaSortedEnumConverter.cs
- SqlErrorCollection.cs
- _Win32.cs
- Partitioner.cs
- DesignerPerfEventProvider.cs
- GB18030Encoding.cs
- RotateTransform.cs
- SecurityContext.cs
- TypeInfo.cs
- SoapServerMessage.cs
- DeviceContexts.cs
- RenderDataDrawingContext.cs
- TableLayoutSettings.cs
- DataServiceQueryException.cs
- SizeLimitedCache.cs
- HttpStaticObjectsCollectionBase.cs
- PersistChildrenAttribute.cs
- OutputCacheSettings.cs
- ReadingWritingEntityEventArgs.cs
- embossbitmapeffect.cs
- TypeUnloadedException.cs
- ConfigurationConverterBase.cs
- DataControlImageButton.cs
- ModulesEntry.cs
- SqlDataAdapter.cs
- Model3DGroup.cs
- DSASignatureDeformatter.cs
- ObjectDataSourceDisposingEventArgs.cs
- ObjectQuery.cs
- TypeValidationEventArgs.cs
- GroupBoxAutomationPeer.cs
- TemplatePagerField.cs
- Hash.cs
- VisualStyleElement.cs
- WebServiceClientProxyGenerator.cs
- CatalogPartChrome.cs
- IgnoreFlushAndCloseStream.cs
- TransformedBitmap.cs
- PrintDialog.cs
- SspiNegotiationTokenProvider.cs
- Ref.cs
- HttpCookiesSection.cs
- PropertyItem.cs
- DynamicRenderer.cs
- WindowsGraphics2.cs
- HttpPostedFileBase.cs
- followingsibling.cs
- XmlSchemaAnnotation.cs
- ChannelPoolSettingsElement.cs
- PieceDirectory.cs
- ServicesUtilities.cs
- _SslSessionsCache.cs
- ResourceExpression.cs
- TransformerTypeCollection.cs
- Deserializer.cs
- CompilerHelpers.cs
- RunWorkerCompletedEventArgs.cs
- VScrollProperties.cs
- SharedPerformanceCounter.cs
- DataGridViewCellEventArgs.cs
- XmlNamespaceMappingCollection.cs
- EntityDataSourceSelectingEventArgs.cs
- ConfigurationManagerHelper.cs
- PropagatorResult.cs
- SystemEvents.cs
- SqlRowUpdatingEvent.cs
- WeakHashtable.cs