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
- CredentialCache.cs
- ConfigurationElement.cs
- SynthesizerStateChangedEventArgs.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- EntitySqlException.cs
- BlobPersonalizationState.cs
- SerializationAttributes.cs
- PackageStore.cs
- Guid.cs
- TypedLocationWrapper.cs
- UIElement3D.cs
- IProvider.cs
- DeflateStreamAsyncResult.cs
- EventHandlingScope.cs
- DeferredBinaryDeserializerExtension.cs
- KeyPressEvent.cs
- RotateTransform.cs
- GCHandleCookieTable.cs
- StylusPointPropertyInfo.cs
- RouteCollection.cs
- ApplicationProxyInternal.cs
- XmlComplianceUtil.cs
- List.cs
- counter.cs
- HtmlInputButton.cs
- TrustManagerPromptUI.cs
- CodeParameterDeclarationExpressionCollection.cs
- oledbmetadatacollectionnames.cs
- ListControlBoundActionList.cs
- XmlQueryOutput.cs
- ADConnectionHelper.cs
- MessageSecurityException.cs
- AttributeUsageAttribute.cs
- documentsequencetextcontainer.cs
- StaticContext.cs
- XmlElementAttribute.cs
- ProgressChangedEventArgs.cs
- PathSegment.cs
- _ChunkParse.cs
- VirtualPath.cs
- Int16.cs
- BulletedListEventArgs.cs
- AssemblyCache.cs
- XmlDocumentType.cs
- DatatypeImplementation.cs
- NTAccount.cs
- WindowsImpersonationContext.cs
- HttpRuntimeSection.cs
- DataGridViewMethods.cs
- WebBodyFormatMessageProperty.cs
- RuntimeHandles.cs
- EUCJPEncoding.cs
- SymbolEqualComparer.cs
- XmlDocumentSchema.cs
- SystemBrushes.cs
- Calendar.cs
- LiteralTextParser.cs
- CqlErrorHelper.cs
- CachedPathData.cs
- Events.cs
- ISCIIEncoding.cs
- FixedSOMTable.cs
- GatewayDefinition.cs
- DbConnectionStringCommon.cs
- ResXResourceWriter.cs
- ResetableIterator.cs
- DataGridViewAutoSizeModeEventArgs.cs
- Msec.cs
- DockAndAnchorLayout.cs
- Activator.cs
- ProfilePropertySettings.cs
- DynamicPropertyReader.cs
- SingleSelectRootGridEntry.cs
- TextServicesCompartmentContext.cs
- DataGridViewRowPostPaintEventArgs.cs
- TrackBarRenderer.cs
- SiteIdentityPermission.cs
- _CommandStream.cs
- HighlightVisual.cs
- RelationshipEndMember.cs
- EntityWithChangeTrackerStrategy.cs
- DesignerDataSourceView.cs
- EventLog.cs
- SQLBoolean.cs
- DefinitionUpdate.cs
- ProgressBarAutomationPeer.cs
- RequestSecurityTokenResponse.cs
- _HelperAsyncResults.cs
- InternalException.cs
- NotConverter.cs
- BackStopAuthenticationModule.cs
- OrderedDictionary.cs
- ErrorFormatter.cs
- ExpressionPrefixAttribute.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- InertiaRotationBehavior.cs
- RoamingStoreFileUtility.cs
- DocumentsTrace.cs
- NodeFunctions.cs
- HighContrastHelper.cs