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
- Brushes.cs
- DBSqlParserColumnCollection.cs
- EncodingNLS.cs
- SamlSubject.cs
- SmiTypedGetterSetter.cs
- _NativeSSPI.cs
- WebColorConverter.cs
- VirtualizingPanel.cs
- PeerResolverElement.cs
- HMACSHA512.cs
- SvcMapFileLoader.cs
- XmlnsPrefixAttribute.cs
- FaultException.cs
- SetUserLanguageRequest.cs
- RelatedCurrencyManager.cs
- FixedSOMLineRanges.cs
- UnsafePeerToPeerMethods.cs
- CalendarAutoFormatDialog.cs
- CellQuery.cs
- PackageDigitalSignature.cs
- AppSettingsExpressionBuilder.cs
- UrlMappingsModule.cs
- CompilerError.cs
- ListBindableAttribute.cs
- login.cs
- AttributeQuery.cs
- BitmapEffectCollection.cs
- SchemaTableOptionalColumn.cs
- TreeIterator.cs
- _WinHttpWebProxyDataBuilder.cs
- MultitargetUtil.cs
- WindowsTab.cs
- KeyInfo.cs
- DefaultAsyncDataDispatcher.cs
- _SafeNetHandles.cs
- HtmlImage.cs
- BamlCollectionHolder.cs
- CodeMemberProperty.cs
- BoundsDrawingContextWalker.cs
- ProxyElement.cs
- DataPagerFieldCommandEventArgs.cs
- SpellerError.cs
- DataBoundControl.cs
- Claim.cs
- KeyValueInternalCollection.cs
- SecurityTokenResolver.cs
- MSHTMLHostUtil.cs
- BoundColumn.cs
- UnsafeNetInfoNativeMethods.cs
- StandardCommands.cs
- DeploymentSectionCache.cs
- ResourceContainer.cs
- FaultPropagationQuery.cs
- SimpleHandlerFactory.cs
- EntitySqlQueryState.cs
- sqlser.cs
- UTF8Encoding.cs
- StateManagedCollection.cs
- SingleConverter.cs
- Keyboard.cs
- SqlDataSourceQueryConverter.cs
- WindowsListViewItemCheckBox.cs
- WindowsFormsEditorServiceHelper.cs
- CapacityStreamGeometryContext.cs
- ExpressionNode.cs
- DetailsViewDeleteEventArgs.cs
- PresentationTraceSources.cs
- BamlTreeUpdater.cs
- SQLUtility.cs
- ToolStripDropTargetManager.cs
- Rectangle.cs
- SoapParser.cs
- ConstraintManager.cs
- ValidationResults.cs
- LinqDataSourceContextEventArgs.cs
- ObjectSecurityT.cs
- StandardTransformFactory.cs
- XmlSchemaCollection.cs
- CatalogZone.cs
- SqlDataSourceCache.cs
- DateTimeUtil.cs
- ColorTransformHelper.cs
- DefaultTextStoreTextComposition.cs
- UpdateException.cs
- MouseEvent.cs
- XmlSchemaDocumentation.cs
- DataGridViewLinkColumn.cs
- ConvertEvent.cs
- PixelShader.cs
- JsonDeserializer.cs
- DbQueryCommandTree.cs
- PcmConverter.cs
- ButtonAutomationPeer.cs
- ResourcesChangeInfo.cs
- GenerateDerivedKeyRequest.cs
- SHA1.cs
- XsltQilFactory.cs
- HttpListenerException.cs
- SmiEventStream.cs
- AudioLevelUpdatedEventArgs.cs