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
- CellLabel.cs
- PostBackOptions.cs
- TreeIterator.cs
- ListBindableAttribute.cs
- WebResourceUtil.cs
- SystemKeyConverter.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- PrivilegeNotHeldException.cs
- DocumentSchemaValidator.cs
- PenThreadPool.cs
- DeploymentSection.cs
- ConfigurationStrings.cs
- RunWorkerCompletedEventArgs.cs
- ParentQuery.cs
- CodeIterationStatement.cs
- ResolveRequestResponseAsyncResult.cs
- FileRecordSequence.cs
- ToolStripGrip.cs
- __TransparentProxy.cs
- WindowsFormsHost.cs
- BitmapEffectCollection.cs
- AutomationElement.cs
- Baml2006ReaderFrame.cs
- ExtenderProvidedPropertyAttribute.cs
- CrossAppDomainChannel.cs
- XmlBinaryReader.cs
- TableAdapterManagerHelper.cs
- AdornedElementPlaceholder.cs
- IgnoreSection.cs
- IWorkflowDebuggerService.cs
- OracleBoolean.cs
- WebPartMinimizeVerb.cs
- TreeWalkHelper.cs
- Char.cs
- StringKeyFrameCollection.cs
- CodeTryCatchFinallyStatement.cs
- DataGridRelationshipRow.cs
- MsmqIntegrationBindingElement.cs
- MultiSelector.cs
- IChannel.cs
- TableAdapterManagerMethodGenerator.cs
- CodeAttributeDeclaration.cs
- PrePrepareMethodAttribute.cs
- SoapInteropTypes.cs
- IsolatedStorageException.cs
- CompositeDataBoundControl.cs
- DefaultValueConverter.cs
- UnsafeNativeMethods.cs
- StateMachineSubscriptionManager.cs
- OutputCacheSettingsSection.cs
- mediaclock.cs
- SvcMapFileLoader.cs
- WebZone.cs
- CaseInsensitiveHashCodeProvider.cs
- SizeValueSerializer.cs
- LicFileLicenseProvider.cs
- WebSysDescriptionAttribute.cs
- ICspAsymmetricAlgorithm.cs
- SQLBoolean.cs
- ProviderIncompatibleException.cs
- ExpressionBuilderCollection.cs
- AvTrace.cs
- MasterPageBuildProvider.cs
- DataGridLengthConverter.cs
- MediaEntryAttribute.cs
- ProtocolsConfigurationHandler.cs
- SqlTopReducer.cs
- TrackingStringDictionary.cs
- HiddenFieldPageStatePersister.cs
- PeerApplicationLaunchInfo.cs
- IApplicationTrustManager.cs
- TemplatePartAttribute.cs
- TextLineBreak.cs
- TraceContextRecord.cs
- HandlerBase.cs
- cookieexception.cs
- HttpResponseInternalWrapper.cs
- WindowsListViewScroll.cs
- OrderPreservingMergeHelper.cs
- IUnknownConstantAttribute.cs
- ContentElement.cs
- TypeSystem.cs
- NodeFunctions.cs
- ExceptionAggregator.cs
- SignedPkcs7.cs
- Missing.cs
- DocumentsTrace.cs
- QuaternionKeyFrameCollection.cs
- AdapterUtil.cs
- mansign.cs
- X509Chain.cs
- DelegateArgumentValue.cs
- BitSet.cs
- MonthCalendar.cs
- MetadataArtifactLoaderResource.cs
- CompilerErrorCollection.cs
- ForeignKeyConstraint.cs
- MissingSatelliteAssemblyException.cs
- AttributeUsageAttribute.cs
- BindingWorker.cs