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
- EditorPartChrome.cs
- util.cs
- GradientSpreadMethodValidation.cs
- PackageStore.cs
- TextTreeObjectNode.cs
- CacheMemory.cs
- ScriptReferenceEventArgs.cs
- ExpressionBuilder.cs
- XmlUtil.cs
- ServiceNameCollection.cs
- WebCategoryAttribute.cs
- TextEffectCollection.cs
- TraceHandler.cs
- SettingsPropertyValue.cs
- DataGridViewCellParsingEventArgs.cs
- XmlStringTable.cs
- IBuiltInEvidence.cs
- EventMap.cs
- TaskFileService.cs
- _ShellExpression.cs
- ReadWriteObjectLock.cs
- ConfigXmlSignificantWhitespace.cs
- PropertyPathWorker.cs
- AttributeSetAction.cs
- CorruptingExceptionCommon.cs
- TransformGroup.cs
- CodeDirectoryCompiler.cs
- ClientRuntimeConfig.cs
- BinaryParser.cs
- ScriptingSectionGroup.cs
- CheckBoxField.cs
- AddInIpcChannel.cs
- ObjectItemAttributeAssemblyLoader.cs
- DelayDesigner.cs
- NegationPusher.cs
- SRef.cs
- PrintDialog.cs
- SQLDateTimeStorage.cs
- GlyphRunDrawing.cs
- SafeViewOfFileHandle.cs
- SqlInternalConnectionTds.cs
- DocumentPageTextView.cs
- KeyValuePairs.cs
- XmlSignificantWhitespace.cs
- Misc.cs
- ContainerFilterService.cs
- StylusSystemGestureEventArgs.cs
- PathNode.cs
- TimeManager.cs
- DesignBindingConverter.cs
- LinqDataSourceDeleteEventArgs.cs
- RadioButtonFlatAdapter.cs
- ConnectionManagementElementCollection.cs
- BamlLocalizabilityResolver.cs
- validationstate.cs
- CellConstantDomain.cs
- Catch.cs
- GenericFlowSwitchHelper.cs
- RequestNavigateEventArgs.cs
- BaseDataBoundControl.cs
- StringUtil.cs
- WasNotInstalledException.cs
- KeyboardNavigation.cs
- ItemsPresenter.cs
- SymbolTable.cs
- RowUpdatingEventArgs.cs
- InternalConfigHost.cs
- Oci.cs
- NameSpaceExtractor.cs
- XmlAttributeOverrides.cs
- EntryWrittenEventArgs.cs
- CheckBoxFlatAdapter.cs
- FullTextLine.cs
- _DisconnectOverlappedAsyncResult.cs
- StringWriter.cs
- DataViewManager.cs
- XmlAnyElementAttributes.cs
- ColorConvertedBitmap.cs
- _AutoWebProxyScriptWrapper.cs
- IdnElement.cs
- WhitespaceSignificantCollectionAttribute.cs
- StaticContext.cs
- SmiEventSink_Default.cs
- ReferentialConstraint.cs
- WebPartCollection.cs
- DiagnosticTraceSource.cs
- HtmlCommandAdapter.cs
- FontStyle.cs
- EdmItemCollection.OcAssemblyCache.cs
- ResourceAttributes.cs
- HttpPostProtocolImporter.cs
- Control.cs
- VerticalAlignConverter.cs
- CodeSubDirectoriesCollection.cs
- ArrangedElementCollection.cs
- DuplicateWaitObjectException.cs
- FlagsAttribute.cs
- CommandLibraryHelper.cs
- AddInServer.cs
- DataFieldCollectionEditor.cs