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
- SoapAttributeOverrides.cs
- UdpAnnouncementEndpoint.cs
- ToolStripItemBehavior.cs
- ObjectCache.cs
- SelectionRangeConverter.cs
- XmlSerializerObjectSerializer.cs
- Automation.cs
- InternalConfigRoot.cs
- ToggleProviderWrapper.cs
- CodeDOMUtility.cs
- AggregateNode.cs
- Polygon.cs
- CheckPair.cs
- Symbol.cs
- LocatorBase.cs
- DataGridViewControlCollection.cs
- DBSqlParserColumn.cs
- WindowsGraphics.cs
- ListViewItem.cs
- SessionIDManager.cs
- DesignSurfaceServiceContainer.cs
- HtmlInputSubmit.cs
- cookiecollection.cs
- HighlightVisual.cs
- BamlStream.cs
- StdValidatorsAndConverters.cs
- DropShadowBitmapEffect.cs
- StateWorkerRequest.cs
- Symbol.cs
- ConfigurationLocationCollection.cs
- MsmqReceiveParameters.cs
- BuildResult.cs
- WCFServiceClientProxyGenerator.cs
- ConfigXmlText.cs
- ServiceDescription.cs
- CngKeyCreationParameters.cs
- OutputScope.cs
- Panel.cs
- Schema.cs
- TableParagraph.cs
- StorageAssociationTypeMapping.cs
- JsonReaderWriterFactory.cs
- LZCodec.cs
- FunctionDescription.cs
- XhtmlBasicImageAdapter.cs
- _TransmitFileOverlappedAsyncResult.cs
- TypeConverterHelper.cs
- DynamicObjectAccessor.cs
- XmlEncApr2001.cs
- SafeArrayTypeMismatchException.cs
- FixedPosition.cs
- XmlDataImplementation.cs
- SessionEndingCancelEventArgs.cs
- HostProtectionException.cs
- SplineKeyFrames.cs
- XmlLangPropertyAttribute.cs
- ItemList.cs
- TransformPattern.cs
- DrawListViewSubItemEventArgs.cs
- FormViewCommandEventArgs.cs
- PageContent.cs
- XappLauncher.cs
- ArcSegment.cs
- SerializationFieldInfo.cs
- CharEntityEncoderFallback.cs
- PersonalizablePropertyEntry.cs
- Utilities.cs
- ObjectListComponentEditor.cs
- ProcessHostConfigUtils.cs
- DisplayNameAttribute.cs
- GeometryDrawing.cs
- WindowsListView.cs
- HWStack.cs
- RequestQueryParser.cs
- AlternateView.cs
- ContentAlignmentEditor.cs
- WpfWebRequestHelper.cs
- DataGridViewSelectedColumnCollection.cs
- SchemaMerger.cs
- DocumentCollection.cs
- CodeThrowExceptionStatement.cs
- HttpListenerElement.cs
- ComponentTray.cs
- HtmlLiteralTextAdapter.cs
- AutoResetEvent.cs
- Dictionary.cs
- HtmlElementErrorEventArgs.cs
- RegistryKey.cs
- InkSerializer.cs
- BrushMappingModeValidation.cs
- OdbcConnectionPoolProviderInfo.cs
- DelegateCompletionCallbackWrapper.cs
- FormParameter.cs
- SqlAliasesReferenced.cs
- GregorianCalendar.cs
- _ListenerAsyncResult.cs
- VersionedStream.cs
- Win32Exception.cs
- HtmlShim.cs
- Quad.cs