Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / SHA512Cng.cs / 1305376 / SHA512Cng.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 SHA-512 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA512Cng : SHA512 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA512Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha512, 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 SHA-512 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA512Cng : SHA512 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA512Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha512, 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
- ScrollData.cs
- XmlSerializer.cs
- AnnouncementEndpoint.cs
- ProxyWebPartManager.cs
- RenderOptions.cs
- RegexCompiler.cs
- DistinctQueryOperator.cs
- OrderedDictionary.cs
- DataGridViewAutoSizeModeEventArgs.cs
- SiteMapSection.cs
- DelegatedStream.cs
- ValueQuery.cs
- FormatterServices.cs
- ToolStripScrollButton.cs
- GeometryHitTestResult.cs
- ExpandCollapsePattern.cs
- EtwProvider.cs
- RuleInfoComparer.cs
- Localizer.cs
- XmlBuffer.cs
- storepermissionattribute.cs
- WorkflowQueue.cs
- StreamMarshaler.cs
- CategoriesDocument.cs
- InstanceStore.cs
- FrameworkTemplate.cs
- AssociationType.cs
- Decimal.cs
- Pair.cs
- NamespaceCollection.cs
- ReferenceConverter.cs
- Size.cs
- ResourceDisplayNameAttribute.cs
- DynamicRenderer.cs
- SelectionProviderWrapper.cs
- TextEndOfParagraph.cs
- DragStartedEventArgs.cs
- ConvertersCollection.cs
- autovalidator.cs
- MSHTMLHostUtil.cs
- EventWaitHandleSecurity.cs
- SplitterPanel.cs
- Point3D.cs
- HashMembershipCondition.cs
- MiniAssembly.cs
- SharedDp.cs
- ScrollEventArgs.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- XmlPreloadedResolver.cs
- SystemTcpConnection.cs
- ArraySortHelper.cs
- SQLBytes.cs
- WebServiceTypeData.cs
- Properties.cs
- BaseCodePageEncoding.cs
- SqlCacheDependencySection.cs
- LineSegment.cs
- TransactionWaitAsyncResult.cs
- XmlDataLoader.cs
- DCSafeHandle.cs
- SeparatorAutomationPeer.cs
- MulticastDelegate.cs
- HttpCookie.cs
- UICuesEvent.cs
- IndentedTextWriter.cs
- HttpRawResponse.cs
- SoapRpcServiceAttribute.cs
- SchemeSettingElementCollection.cs
- SymbolTable.cs
- EnumerableCollectionView.cs
- AttributeData.cs
- ProcessHostFactoryHelper.cs
- AssemblyNameProxy.cs
- ControlEvent.cs
- MarkupObject.cs
- TextEncodedRawTextWriter.cs
- WebDescriptionAttribute.cs
- ListenerElementsCollection.cs
- WebSysDefaultValueAttribute.cs
- Base64Stream.cs
- ThrowOnMultipleAssignment.cs
- ActiveXHelper.cs
- HwndAppCommandInputProvider.cs
- MediaElement.cs
- DictionarySectionHandler.cs
- TrackingValidationObjectDictionary.cs
- PeerNodeTraceRecord.cs
- XmlSchemaParticle.cs
- DbProviderFactory.cs
- RenderDataDrawingContext.cs
- Menu.cs
- ModelPerspective.cs
- MultipleViewPattern.cs
- RawTextInputReport.cs
- ListBoxItem.cs
- RuleSettings.cs
- DataGridrowEditEndingEventArgs.cs
- ConfigurationManager.cs
- OracleString.cs
- GridEntryCollection.cs