Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / SHA1Cng.cs / 1305376 / SHA1Cng.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-1 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA1Cng : SHA1 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA1Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha1, 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-1 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA1Cng : SHA1 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA1Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha1, 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
- MsmqTransportElement.cs
- SingleKeyFrameCollection.cs
- DataViewSettingCollection.cs
- TextBoxBase.cs
- TouchesCapturedWithinProperty.cs
- Point4DConverter.cs
- XpsFixedPageReaderWriter.cs
- PlanCompiler.cs
- SharedDp.cs
- CollaborationHelperFunctions.cs
- DataGridLengthConverter.cs
- TextModifierScope.cs
- GAC.cs
- SqlReferenceCollection.cs
- ObjectConverter.cs
- XmlDictionaryWriter.cs
- ObjectDataSourceSelectingEventArgs.cs
- ProtocolViolationException.cs
- AudioStateChangedEventArgs.cs
- NavigationWindow.cs
- SqlReorderer.cs
- Int32Storage.cs
- COSERVERINFO.cs
- SizeIndependentAnimationStorage.cs
- DoubleAnimationBase.cs
- CompilationLock.cs
- RelatedCurrencyManager.cs
- ServiceReference.cs
- ContractsBCL.cs
- MenuItemBinding.cs
- CLRBindingWorker.cs
- IncrementalReadDecoders.cs
- HtmlUtf8RawTextWriter.cs
- RootBuilder.cs
- DecimalAnimationUsingKeyFrames.cs
- MsmqReceiveHelper.cs
- CacheMemory.cs
- TextElementCollection.cs
- BodyGlyph.cs
- NameTable.cs
- UnsafeNativeMethods.cs
- mactripleDES.cs
- CodeTypeReferenceExpression.cs
- nulltextcontainer.cs
- mansign.cs
- SspiHelper.cs
- LayoutEngine.cs
- OneOfTypeConst.cs
- HwndHostAutomationPeer.cs
- ErrorRuntimeConfig.cs
- TextTreeFixupNode.cs
- ProbeMatchesMessageCD1.cs
- EditorOptionAttribute.cs
- WebPartsPersonalizationAuthorization.cs
- NameValueConfigurationCollection.cs
- StreamMarshaler.cs
- SqlDependencyListener.cs
- Parser.cs
- DynamicRouteExpression.cs
- ExtendedPropertyCollection.cs
- HasActivatableWorkflowEvent.cs
- NamespaceList.cs
- SqlPersonalizationProvider.cs
- DescendantBaseQuery.cs
- ScopelessEnumAttribute.cs
- BaseValidator.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- RegionData.cs
- SizeChangedInfo.cs
- EntityConnectionStringBuilder.cs
- ComplexLine.cs
- Setter.cs
- TypeElement.cs
- ApplicationTrust.cs
- GlobalAllocSafeHandle.cs
- TextAnchor.cs
- DiscardableAttribute.cs
- TraceLevelStore.cs
- UpDownEvent.cs
- ExecutedRoutedEventArgs.cs
- NumericPagerField.cs
- arabicshape.cs
- ToolstripProfessionalRenderer.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- ProcessHostFactoryHelper.cs
- ColumnClickEvent.cs
- PageHandlerFactory.cs
- LabelDesigner.cs
- RequestQueue.cs
- invalidudtexception.cs
- XamlPoint3DCollectionSerializer.cs
- IdentifierService.cs
- Delegate.cs
- ZipFileInfo.cs
- TabRenderer.cs
- Point4D.cs
- PrivilegeNotHeldException.cs
- ApplicationActivator.cs
- HttpConfigurationSystem.cs
- RequestCacheEntry.cs