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
- MaskedTextBoxTextEditor.cs
- MouseActionValueSerializer.cs
- UpdatePanelTrigger.cs
- IndexOutOfRangeException.cs
- FormViewRow.cs
- SqlDataSourceStatusEventArgs.cs
- Rotation3DAnimationBase.cs
- SamlSubject.cs
- ButtonFlatAdapter.cs
- AliasedSlot.cs
- ReferenceService.cs
- UnauthorizedWebPart.cs
- Tablet.cs
- Shape.cs
- nulltextcontainer.cs
- SolidColorBrush.cs
- DragEventArgs.cs
- UidManager.cs
- BuildProvider.cs
- IntPtr.cs
- SerializationHelper.cs
- CodeSnippetStatement.cs
- List.cs
- ReferenceConverter.cs
- StrokeNode.cs
- AdjustableArrowCap.cs
- HttpHandlerActionCollection.cs
- AuthenticatingEventArgs.cs
- PeerContact.cs
- SoapHeader.cs
- InputLanguageCollection.cs
- TextEditorThreadLocalStore.cs
- XmlObjectSerializer.cs
- PriorityItem.cs
- WorkflowTransactionService.cs
- AutoCompleteStringCollection.cs
- Condition.cs
- PageAsyncTaskManager.cs
- MexNamedPipeBindingCollectionElement.cs
- TraceSource.cs
- PeerNameRecord.cs
- XmlValidatingReaderImpl.cs
- AppDomainFactory.cs
- ConfigurationElementProperty.cs
- AdministrationHelpers.cs
- SafeArrayRankMismatchException.cs
- StructuredType.cs
- SQLInt16.cs
- TextBoxBase.cs
- ProfileEventArgs.cs
- StyleTypedPropertyAttribute.cs
- XsltContext.cs
- CodeGen.cs
- SiteOfOriginContainer.cs
- FactoryGenerator.cs
- FocusWithinProperty.cs
- ActivationServices.cs
- XmlSchemaAll.cs
- GenericUriParser.cs
- SynchronizationContext.cs
- PowerStatus.cs
- StandardCommandToolStripMenuItem.cs
- TickBar.cs
- NGCSerializer.cs
- ProtocolInformationReader.cs
- EntityDataSourceStatementEditorForm.cs
- WorkingDirectoryEditor.cs
- unsafenativemethodstextservices.cs
- BrowserTree.cs
- DataTableClearEvent.cs
- TemplateBuilder.cs
- PolyBezierSegmentFigureLogic.cs
- FullTrustAssembliesSection.cs
- Paragraph.cs
- MsmqIntegrationProcessProtocolHandler.cs
- BindingListCollectionView.cs
- SmiEventSink_Default.cs
- EncodingNLS.cs
- ResourceAttributes.cs
- XmlMtomWriter.cs
- XLinq.cs
- QueryContinueDragEvent.cs
- SqlTriggerAttribute.cs
- DocumentPageView.cs
- ValidatorCollection.cs
- OrderedEnumerableRowCollection.cs
- WeakReference.cs
- RemoteWebConfigurationHostServer.cs
- DataSpaceManager.cs
- TypeSystem.cs
- RectangleGeometry.cs
- SoapExtension.cs
- TreeSet.cs
- SessionStateUtil.cs
- ScriptIgnoreAttribute.cs
- Base64Decoder.cs
- FileSystemEnumerable.cs
- InlineUIContainer.cs
- AppendHelper.cs
- TileBrush.cs