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
- ProcessHost.cs
- DisplayMemberTemplateSelector.cs
- Root.cs
- DataGridClipboardHelper.cs
- TemplateControl.cs
- ForEachAction.cs
- RtfToken.cs
- StructuredCompositeActivityDesigner.cs
- LicenseProviderAttribute.cs
- InputLanguageSource.cs
- StyleReferenceConverter.cs
- x509store.cs
- XmlComment.cs
- ModelVisual3D.cs
- XhtmlTextWriter.cs
- SiteMapDataSourceView.cs
- InputManager.cs
- HMACSHA512.cs
- Pair.cs
- HttpStreamXmlDictionaryWriter.cs
- ScriptHandlerFactory.cs
- FloaterParagraph.cs
- RegexCompiler.cs
- ApplicationFileParser.cs
- WebOperationContext.cs
- AdapterUtil.cs
- FileSystemInfo.cs
- ClientEventManager.cs
- DataTemplateSelector.cs
- ProtectedConfigurationSection.cs
- DataGridViewAdvancedBorderStyle.cs
- FixUp.cs
- WpfPayload.cs
- IPipelineRuntime.cs
- HideDisabledControlAdapter.cs
- WizardSideBarListControlItemEventArgs.cs
- Translator.cs
- HtmlInputFile.cs
- RegexBoyerMoore.cs
- QueryContinueDragEventArgs.cs
- HtmlInputHidden.cs
- Attributes.cs
- WindowsEditBoxRange.cs
- Peer.cs
- InputBuffer.cs
- FixedTextSelectionProcessor.cs
- ThreadExceptionEvent.cs
- ByteStorage.cs
- XPathSelectionIterator.cs
- ContextStack.cs
- DesignSurface.cs
- DataGridViewDesigner.cs
- PreApplicationStartMethodAttribute.cs
- ArrangedElementCollection.cs
- httpserverutility.cs
- CodeArgumentReferenceExpression.cs
- WindowsIdentity.cs
- MultiPageTextView.cs
- DocumentPageViewAutomationPeer.cs
- ContextMarshalException.cs
- AutomationFocusChangedEventArgs.cs
- XmlSortKeyAccumulator.cs
- SystemResources.cs
- FunctionDescription.cs
- HotSpotCollection.cs
- StylusPointPropertyInfoDefaults.cs
- WeakRefEnumerator.cs
- ListControlStringCollectionEditor.cs
- Thumb.cs
- TabItemAutomationPeer.cs
- ValidationPropertyAttribute.cs
- DialogWindow.cs
- HtmlTernaryTree.cs
- AuthenticationModuleElement.cs
- SapiRecognizer.cs
- CompressionTransform.cs
- ImageBrush.cs
- PanelContainerDesigner.cs
- DataGridColumnEventArgs.cs
- ZipIOExtraField.cs
- PagerSettings.cs
- FileDialog_Vista.cs
- RestClientProxyHandler.cs
- SettingsPropertyValueCollection.cs
- SignatureToken.cs
- CultureTableRecord.cs
- HtmlElementCollection.cs
- TraceData.cs
- LineBreakRecord.cs
- FlowDocumentScrollViewer.cs
- CodeParameterDeclarationExpression.cs
- DbProviderServices.cs
- FillRuleValidation.cs
- SourceElementsCollection.cs
- GridItem.cs
- SmtpNetworkElement.cs
- Rect3D.cs
- SafeCloseHandleCritical.cs
- NavigationService.cs
- WrappedIUnknown.cs