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
- CodeEventReferenceExpression.cs
- BufferedGraphicsManager.cs
- SessionPageStateSection.cs
- OletxTransactionManager.cs
- DBConnectionString.cs
- WebPartManagerInternals.cs
- DesignerDataSchemaClass.cs
- WindowsRichEdit.cs
- SignedXml.cs
- MouseCaptureWithinProperty.cs
- ResourceDefaultValueAttribute.cs
- CodeDirectoryCompiler.cs
- TextParaLineResult.cs
- WebPartZoneBase.cs
- DirectionalLight.cs
- ThreadAbortException.cs
- TextElementAutomationPeer.cs
- MSAANativeProvider.cs
- DbConnectionHelper.cs
- XslVisitor.cs
- GetIndexBinder.cs
- CheckBoxField.cs
- ButtonStandardAdapter.cs
- OrderByExpression.cs
- Choices.cs
- SslStream.cs
- Interlocked.cs
- AttributeProviderAttribute.cs
- XmlBinaryReader.cs
- ExpressionList.cs
- HttpCachePolicy.cs
- StyleCollection.cs
- TraceInternal.cs
- BitHelper.cs
- xdrvalidator.cs
- OverflowException.cs
- TextEditorTables.cs
- ADMembershipUser.cs
- ImpersonationContext.cs
- StateItem.cs
- GeometryDrawing.cs
- SqlServices.cs
- XmlIterators.cs
- HttpModuleActionCollection.cs
- RegexFCD.cs
- ValueUtilsSmi.cs
- SiteMapPath.cs
- SettingsBindableAttribute.cs
- Input.cs
- Exceptions.cs
- FormatControl.cs
- TdsParserStaticMethods.cs
- ManifestSignatureInformation.cs
- CommandEventArgs.cs
- Column.cs
- HttpCapabilitiesSectionHandler.cs
- DataGridViewColumnEventArgs.cs
- BlockCollection.cs
- ListControlConvertEventArgs.cs
- DesignTimeTemplateParser.cs
- Convert.cs
- ByteStorage.cs
- ProcessInputEventArgs.cs
- CacheAxisQuery.cs
- TextElementEnumerator.cs
- PackagePartCollection.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- Source.cs
- StretchValidation.cs
- DbExpressionVisitor_TResultType.cs
- BitmapEffectGeneralTransform.cs
- Effect.cs
- ThreadPool.cs
- assemblycache.cs
- WorkflowPageSetupDialog.cs
- Pair.cs
- CategoryNameCollection.cs
- CacheEntry.cs
- CustomTrackingRecord.cs
- _Semaphore.cs
- QueryPageSettingsEventArgs.cs
- StateManagedCollection.cs
- Stacktrace.cs
- UnsafeNativeMethodsCLR.cs
- ViewManager.cs
- ProcessThread.cs
- CollectionViewGroupRoot.cs
- WebBrowserProgressChangedEventHandler.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- ClientScriptManager.cs
- MonthCalendarDesigner.cs
- UriTemplateEquivalenceComparer.cs
- UriSchemeKeyedCollection.cs
- RowToFieldTransformer.cs
- IdentityReference.cs
- SafeNativeMethodsOther.cs
- FrameworkTextComposition.cs
- ConsoleTraceListener.cs
- PriorityQueue.cs
- TypedAsyncResult.cs