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
- TransactionManager.cs
- LogicalExpressionEditor.cs
- StringToken.cs
- Literal.cs
- ExpressionVisitorHelpers.cs
- storepermissionattribute.cs
- ZipPackagePart.cs
- XmlIncludeAttribute.cs
- X509Certificate2Collection.cs
- SplineKeyFrames.cs
- RoutedEventArgs.cs
- InternalSafeNativeMethods.cs
- ContentType.cs
- DateTimeValueSerializer.cs
- XmlNodeChangedEventArgs.cs
- FactoryGenerator.cs
- TextRangeEditTables.cs
- SparseMemoryStream.cs
- ExpressionWriter.cs
- EventLogPermissionEntry.cs
- Stack.cs
- WindowsAuthenticationModule.cs
- DictionaryContent.cs
- DirectoryNotFoundException.cs
- TemplateBamlTreeBuilder.cs
- ObfuscateAssemblyAttribute.cs
- BaseTemplateBuildProvider.cs
- QilInvoke.cs
- AnimationStorage.cs
- ActivationServices.cs
- RegularExpressionValidator.cs
- IDictionary.cs
- ErrorRuntimeConfig.cs
- HostedImpersonationContext.cs
- DesignerCalendarAdapter.cs
- ClientTargetCollection.cs
- MinMaxParagraphWidth.cs
- VariableQuery.cs
- DecoderReplacementFallback.cs
- PasswordValidationException.cs
- InputScopeAttribute.cs
- TransportConfigurationTypeElementCollection.cs
- GridView.cs
- RewritingValidator.cs
- WebPartsSection.cs
- TextRangeAdaptor.cs
- XmlArrayItemAttribute.cs
- XmlBindingWorker.cs
- AnimatedTypeHelpers.cs
- CellTreeNodeVisitors.cs
- PlanCompilerUtil.cs
- PropertyGroupDescription.cs
- HttpChannelHelper.cs
- BufferedReadStream.cs
- StorageModelBuildProvider.cs
- KeyProperty.cs
- HttpListenerException.cs
- SyndicationItemFormatter.cs
- DataMisalignedException.cs
- MailDefinition.cs
- MinimizableAttributeTypeConverter.cs
- AlignmentYValidation.cs
- TreePrinter.cs
- InputLanguageManager.cs
- TableItemPattern.cs
- DocumentPageViewAutomationPeer.cs
- TextTreeObjectNode.cs
- ServicePoint.cs
- ImageBrush.cs
- IndexOutOfRangeException.cs
- BasicViewGenerator.cs
- RuntimeResourceSet.cs
- ViewGenResults.cs
- CellTreeNodeVisitors.cs
- BinaryObjectInfo.cs
- ContentFilePart.cs
- PropertyItemInternal.cs
- CompilationRelaxations.cs
- Message.cs
- CreateCardRequest.cs
- Profiler.cs
- ActivityStatusChangeEventArgs.cs
- LinqToSqlWrapper.cs
- DynamicExpression.cs
- Size3D.cs
- ListenerElementsCollection.cs
- WebPartsPersonalizationAuthorization.cs
- BmpBitmapDecoder.cs
- ZipFileInfo.cs
- AccessDataSourceWizardForm.cs
- XmlTextReaderImplHelpers.cs
- BitmapSourceSafeMILHandle.cs
- Logging.cs
- JpegBitmapEncoder.cs
- XmlDocument.cs
- FormViewPagerRow.cs
- TypeSystem.cs
- AvTraceDetails.cs
- X509CertificateCollection.cs
- PathFigure.cs