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
- wmiprovider.cs
- XXXOnTypeBuilderInstantiation.cs
- BindingElementCollection.cs
- SqlConnectionFactory.cs
- FactoryId.cs
- ActivityDesignerAccessibleObject.cs
- DbgCompiler.cs
- VirtualPathProvider.cs
- ToolStripSettings.cs
- XPathDocumentIterator.cs
- TableParaClient.cs
- ReadOnlyAttribute.cs
- CredentialCache.cs
- AnnotationResourceChangedEventArgs.cs
- JavaScriptObjectDeserializer.cs
- HtmlInputText.cs
- ArcSegment.cs
- Peer.cs
- IdleTimeoutMonitor.cs
- BasicCellRelation.cs
- DetailsViewPagerRow.cs
- FigureHelper.cs
- TemplateInstanceAttribute.cs
- GeneralTransform.cs
- InternalConfigHost.cs
- FileLogRecord.cs
- SafeNativeMethods.cs
- AsyncOperation.cs
- HijriCalendar.cs
- EncodingNLS.cs
- SByteConverter.cs
- WorkflowMessageEventHandler.cs
- ResourceAttributes.cs
- CreateCardRequest.cs
- TargetException.cs
- HttpClientCertificate.cs
- XmlSchemas.cs
- WebPartEditorOkVerb.cs
- Separator.cs
- Attributes.cs
- ProxyGenerator.cs
- ConstructorBuilder.cs
- PropertiesTab.cs
- RemotingConfiguration.cs
- FileController.cs
- WorkflowMarkupElementEventArgs.cs
- FlowLayoutPanel.cs
- InputProcessorProfilesLoader.cs
- BrowserCapabilitiesFactoryBase.cs
- ObjectContext.cs
- ValueCollectionParameterReader.cs
- OdbcConnectionFactory.cs
- DispatcherExceptionFilterEventArgs.cs
- ClrProviderManifest.cs
- EmissiveMaterial.cs
- ExeConfigurationFileMap.cs
- RenderOptions.cs
- FormViewDeleteEventArgs.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- AttributeTable.cs
- CallContext.cs
- BitmapCacheBrush.cs
- StringStorage.cs
- ContractMethodInfo.cs
- WebControlsSection.cs
- XmlSchemas.cs
- SvcMapFileLoader.cs
- OdbcRowUpdatingEvent.cs
- CompiledXpathExpr.cs
- EntitySqlQueryBuilder.cs
- EndpointIdentityConverter.cs
- DbDataAdapter.cs
- Base64Stream.cs
- safesecurityhelperavalon.cs
- DataExpression.cs
- ObjectViewEntityCollectionData.cs
- TextServicesLoader.cs
- DataGridViewCellValidatingEventArgs.cs
- ScrollContentPresenter.cs
- MsmqIntegrationChannelListener.cs
- CodeExpressionStatement.cs
- XmlKeywords.cs
- Root.cs
- SqlTriggerAttribute.cs
- LazyLoadBehavior.cs
- InitializingNewItemEventArgs.cs
- PolicyManager.cs
- EventLogEntryCollection.cs
- SafeBitVector32.cs
- ItemChangedEventArgs.cs
- UserControlBuildProvider.cs
- CodeSnippetStatement.cs
- Axis.cs
- MenuItem.cs
- IndexedString.cs
- IssuedSecurityTokenParameters.cs
- ChangeInterceptorAttribute.cs
- FlowLayout.cs
- MetadataElement.cs
- GridSplitterAutomationPeer.cs