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
- RawContentTypeMapper.cs
- SingleObjectCollection.cs
- mil_sdk_version.cs
- ProcessModuleCollection.cs
- IndexedGlyphRun.cs
- ALinqExpressionVisitor.cs
- BehaviorEditorPart.cs
- XmlSchemaType.cs
- DesignerView.cs
- GridEntry.cs
- ContextQuery.cs
- EventHandlingScope.cs
- FastEncoderStatics.cs
- ContractSearchPattern.cs
- TransferMode.cs
- ClientScriptManagerWrapper.cs
- TaskFileService.cs
- AutomationPropertyChangedEventArgs.cs
- Blend.cs
- MemberHolder.cs
- UIElementParaClient.cs
- AudioDeviceOut.cs
- FileSystemInfo.cs
- TemplateParser.cs
- StorageMappingFragment.cs
- Int16Converter.cs
- WebPartDeleteVerb.cs
- GeneralTransform3DTo2D.cs
- TypeInfo.cs
- HostDesigntimeLicenseContext.cs
- TagNameToTypeMapper.cs
- OleDbRowUpdatedEvent.cs
- CorrelationResolver.cs
- BlobPersonalizationState.cs
- LinearQuaternionKeyFrame.cs
- AudioDeviceOut.cs
- DWriteFactory.cs
- Missing.cs
- InternalControlCollection.cs
- PaintEvent.cs
- TextureBrush.cs
- MessageFilterException.cs
- ReflectTypeDescriptionProvider.cs
- ObjectHelper.cs
- Queue.cs
- TCPClient.cs
- HandleRef.cs
- CodePrimitiveExpression.cs
- CompiledQueryCacheKey.cs
- XmlQualifiedNameTest.cs
- TypeGeneratedEventArgs.cs
- SelectorItemAutomationPeer.cs
- ConfigurationStrings.cs
- ImageListDesigner.cs
- DelegatedStream.cs
- AppDomainCompilerProxy.cs
- BinHexDecoder.cs
- SafeRegistryHandle.cs
- BindableAttribute.cs
- WebUtil.cs
- SHA1Managed.cs
- OdbcTransaction.cs
- ContentElementAutomationPeer.cs
- TemplateInstanceAttribute.cs
- InvokeWebService.cs
- VirtualDirectoryMappingCollection.cs
- WebCategoryAttribute.cs
- HexParser.cs
- IsolatedStorageFilePermission.cs
- EventDescriptorCollection.cs
- VisualProxy.cs
- XDRSchema.cs
- RedirectionProxy.cs
- MenuTracker.cs
- XslCompiledTransform.cs
- PriorityItem.cs
- RegexWriter.cs
- PointUtil.cs
- WindowsFormsHostAutomationPeer.cs
- InternalResources.cs
- StopStoryboard.cs
- SqlReferenceCollection.cs
- FastPropertyAccessor.cs
- TextCompositionManager.cs
- SQLDecimalStorage.cs
- TypeNameConverter.cs
- HtmlInputPassword.cs
- SoapSchemaMember.cs
- MarginCollapsingState.cs
- XmlCharacterData.cs
- XmlEnumAttribute.cs
- UpdatePanel.cs
- KeyNotFoundException.cs
- OleDbConnection.cs
- CheckBoxAutomationPeer.cs
- DispatcherSynchronizationContext.cs
- RotationValidation.cs
- PropertyChangedEventArgs.cs
- UIElementHelper.cs
- XmlArrayItemAttributes.cs