Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / SHA256CryptoServiceProvider.cs / 1305376 / SHA256CryptoServiceProvider.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== using System; using System.Diagnostics.Contracts; namespace System.Security.Cryptography { ////// Wrapper around the CAPI implementation of the SHA-256 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA256CryptoServiceProvider : SHA256 { private CapiHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA256CryptoServiceProvider() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new CapiHashAlgorithm(CapiNative.ProviderNames.MicrosoftEnhancedRsaAes, CapiNative.ProviderType.RsaAes, CapiNative.AlgorithmId.Sha256); } //// // [System.Security.SecurityCritical] protected override void Dispose(bool disposing) { try { if (disposing) { m_hashAlgorithm.Dispose(); } } finally { base.Dispose(disposing); } } ///// /// Reset the hash algorithm to begin hashing a new set of data /// //// [System.Security.SecurityCritical] public override void Initialize() { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.Initialize(); } ///// /// Hash a block of data /// //// [System.Security.SecurityCritical] protected override void HashCore(byte[] array, int ibStart, int cbSize) { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.HashCore(array, ibStart, cbSize); } ///// /// Complete the hash, returning its value /// //// [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 CAPI implementation of the SHA-256 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA256CryptoServiceProvider : SHA256 { private CapiHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA256CryptoServiceProvider() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new CapiHashAlgorithm(CapiNative.ProviderNames.MicrosoftEnhancedRsaAes, CapiNative.ProviderType.RsaAes, CapiNative.AlgorithmId.Sha256); } //// // [System.Security.SecurityCritical] protected override void Dispose(bool disposing) { try { if (disposing) { m_hashAlgorithm.Dispose(); } } finally { base.Dispose(disposing); } } ///// /// Reset the hash algorithm to begin hashing a new set of data /// //// [System.Security.SecurityCritical] public override void Initialize() { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.Initialize(); } ///// /// Hash a block of data /// //// [System.Security.SecurityCritical] protected override void HashCore(byte[] array, int ibStart, int cbSize) { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.HashCore(array, ibStart, cbSize); } ///// /// Complete the hash, returning its value /// //// [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
- TextServicesContext.cs
- UnsafeNativeMethods.cs
- EventListener.cs
- DataGridPageChangedEventArgs.cs
- GuidelineCollection.cs
- XmlSchemaObjectTable.cs
- FixedSOMPageElement.cs
- _NegoState.cs
- TextEndOfSegment.cs
- ContainerSelectorGlyph.cs
- InkPresenter.cs
- Utils.cs
- webproxy.cs
- RemotingException.cs
- InvalidPropValue.cs
- CommonObjectSecurity.cs
- WindowsRichEdit.cs
- Region.cs
- DependencyPropertyChangedEventArgs.cs
- ToolStripSeparator.cs
- CombinedTcpChannel.cs
- WebPartCollection.cs
- GlyphElement.cs
- HtmlAnchor.cs
- StateMachineSubscription.cs
- NumericExpr.cs
- ActivationServices.cs
- DataGridViewRowsAddedEventArgs.cs
- UIElement.cs
- DataGridViewCheckBoxColumn.cs
- GlobalizationSection.cs
- NullableBoolConverter.cs
- ApplicationException.cs
- TextTreeInsertElementUndoUnit.cs
- TagNameToTypeMapper.cs
- DataGridViewComboBoxColumnDesigner.cs
- RSAPKCS1SignatureDeformatter.cs
- DBCSCodePageEncoding.cs
- EmptyEnumerator.cs
- RoutedEventArgs.cs
- SspiNegotiationTokenProviderState.cs
- XmlReaderDelegator.cs
- StylusPoint.cs
- ModuleConfigurationInfo.cs
- ApplicationServiceHelper.cs
- GridViewHeaderRowPresenter.cs
- SessionState.cs
- SqlProviderUtilities.cs
- WebServiceTypeData.cs
- Attributes.cs
- FlowLayoutSettings.cs
- WebPartsPersonalizationAuthorization.cs
- SkipStoryboardToFill.cs
- Column.cs
- NGCSerializationManager.cs
- TrimSurroundingWhitespaceAttribute.cs
- XmlSchemaSimpleContentRestriction.cs
- ContractNamespaceAttribute.cs
- ClientRolePrincipal.cs
- TcpAppDomainProtocolHandler.cs
- Error.cs
- PropertyInformationCollection.cs
- ResourceManager.cs
- XhtmlBasicCommandAdapter.cs
- RuleEngine.cs
- Currency.cs
- LocalizableAttribute.cs
- MostlySingletonList.cs
- XMLSyntaxException.cs
- FontFaceLayoutInfo.cs
- BindingGraph.cs
- sqlcontext.cs
- ProcessHostFactoryHelper.cs
- StyleSheetComponentEditor.cs
- SafeFileMappingHandle.cs
- __ConsoleStream.cs
- SkipStoryboardToFill.cs
- BitmapSource.cs
- NativeCppClassAttribute.cs
- AndCondition.cs
- UniqueSet.cs
- TreeNodeStyle.cs
- SectionInformation.cs
- FunctionQuery.cs
- HtmlInputHidden.cs
- WebPartConnectionCollection.cs
- documentsequencetextview.cs
- ManipulationDelta.cs
- ICollection.cs
- SelectionWordBreaker.cs
- ContentHostHelper.cs
- CurrentChangingEventManager.cs
- Column.cs
- ProgressChangedEventArgs.cs
- Vector3DKeyFrameCollection.cs
- TraceSwitch.cs
- NamespaceDecl.cs
- HttpListenerException.cs
- ApplicationTrust.cs
- OrderPreservingSpoolingTask.cs