Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / SHA256Cng.cs / 1305376 / SHA256Cng.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-256 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA256Cng : SHA256 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA256Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha256, 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-256 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA256Cng : SHA256 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA256Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha256, 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
- SamlAction.cs
- SeekStoryboard.cs
- _LocalDataStore.cs
- HtmlTable.cs
- SerializationHelper.cs
- ComponentRenameEvent.cs
- ISessionStateStore.cs
- DesignSurfaceEvent.cs
- OuterGlowBitmapEffect.cs
- ToolStripDropDownItem.cs
- ValidatingReaderNodeData.cs
- AsyncPostBackTrigger.cs
- RawStylusInputReport.cs
- ScriptResourceAttribute.cs
- Model3DCollection.cs
- MetadataCache.cs
- ErrorsHelper.cs
- PageThemeCodeDomTreeGenerator.cs
- TextEditorContextMenu.cs
- DesignerAdRotatorAdapter.cs
- TargetControlTypeCache.cs
- CuspData.cs
- DataTableMappingCollection.cs
- DBPropSet.cs
- VirtualDirectoryMapping.cs
- DelegatingTypeDescriptionProvider.cs
- WindowsGraphics2.cs
- dbenumerator.cs
- AudioFormatConverter.cs
- HttpModuleActionCollection.cs
- SelectionRange.cs
- DataRow.cs
- returneventsaver.cs
- HyperLinkField.cs
- Viewport3DVisual.cs
- PathSegment.cs
- StateBag.cs
- ReverseInheritProperty.cs
- RecordManager.cs
- ConsoleCancelEventArgs.cs
- HostElement.cs
- WebPartConnectVerb.cs
- CodeCompiler.cs
- Normalization.cs
- DashStyle.cs
- DataGridCheckBoxColumn.cs
- CharacterHit.cs
- ZoneLinkButton.cs
- TextAnchor.cs
- CharStorage.cs
- SafeLibraryHandle.cs
- WaitHandleCannotBeOpenedException.cs
- EUCJPEncoding.cs
- ResXDataNode.cs
- PageThemeParser.cs
- TextSpan.cs
- RequestQueue.cs
- MenuItemStyleCollection.cs
- AssemblyBuilderData.cs
- coordinatorfactory.cs
- EventManager.cs
- FlowPanelDesigner.cs
- StylusCaptureWithinProperty.cs
- FaultPropagationRecord.cs
- WebScriptEnablingElement.cs
- Bitmap.cs
- StringValueSerializer.cs
- XmlSortKey.cs
- CancellationHandler.cs
- Transform.cs
- sqlstateclientmanager.cs
- WinInetCache.cs
- XPathNode.cs
- MappingItemCollection.cs
- DbExpressionBuilder.cs
- UIElementIsland.cs
- LocalizableAttribute.cs
- DataControlImageButton.cs
- Literal.cs
- ComponentEditorForm.cs
- ConfigXmlText.cs
- SmiMetaData.cs
- CustomValidator.cs
- TabControlAutomationPeer.cs
- NavigationWindow.cs
- ContainerParagraph.cs
- SqlBulkCopyColumnMapping.cs
- RegisteredHiddenField.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- GridErrorDlg.cs
- HostedHttpContext.cs
- ProcessHostServerConfig.cs
- PeerObject.cs
- ReadOnlyCollectionBase.cs
- ReceiveReply.cs
- CompileXomlTask.cs
- TriggerBase.cs
- FormsAuthenticationCredentials.cs
- SecurityDocument.cs
- DefaultAssemblyResolver.cs