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
- tooltip.cs
- Ops.cs
- CheckBoxBaseAdapter.cs
- ConfigurationManagerHelper.cs
- PresentationTraceSources.cs
- PagePropertiesChangingEventArgs.cs
- PenThreadPool.cs
- TextBoxLine.cs
- ToolStripMenuItem.cs
- BufferedOutputAsyncStream.cs
- WindowsAltTab.cs
- DataGridViewImageColumn.cs
- InstancePersistence.cs
- Rule.cs
- UInt16Converter.cs
- CompModSwitches.cs
- ADMembershipUser.cs
- TextFormatterImp.cs
- DynamicValueConverter.cs
- ClusterRegistryConfigurationProvider.cs
- ISO2022Encoding.cs
- ToolZone.cs
- httpserverutility.cs
- WeakEventTable.cs
- ObservableDictionary.cs
- DesignerActionService.cs
- TabletDevice.cs
- StorageScalarPropertyMapping.cs
- CultureInfoConverter.cs
- SchemaDeclBase.cs
- ThreadSafeList.cs
- SqlProcedureAttribute.cs
- sqlstateclientmanager.cs
- SwitchAttribute.cs
- MemberAccessException.cs
- HostedBindingBehavior.cs
- _ListenerAsyncResult.cs
- EntityContainerEmitter.cs
- GeneralTransformCollection.cs
- ProcessHostServerConfig.cs
- BooleanAnimationUsingKeyFrames.cs
- ObjectKeyFrameCollection.cs
- BaseValidator.cs
- OrderedDictionary.cs
- StorageTypeMapping.cs
- SessionEndedEventArgs.cs
- DictionaryCustomTypeDescriptor.cs
- QueryIntervalOp.cs
- DateTimeConstantAttribute.cs
- TrailingSpaceComparer.cs
- PenContext.cs
- DrawingContextDrawingContextWalker.cs
- DownloadProgressEventArgs.cs
- RSACryptoServiceProvider.cs
- Relationship.cs
- IntSumAggregationOperator.cs
- MetadataItemEmitter.cs
- ConfigXmlWhitespace.cs
- ConfigurationManagerHelper.cs
- CompareValidator.cs
- DelegatedStream.cs
- AnimatedTypeHelpers.cs
- Cursors.cs
- ControlAdapter.cs
- XPathArrayIterator.cs
- RelativeSource.cs
- XmlBindingWorker.cs
- _SslState.cs
- ObservableCollectionDefaultValueFactory.cs
- MenuItem.cs
- SqlInternalConnectionSmi.cs
- OperationResponse.cs
- UnmanagedMemoryStreamWrapper.cs
- EntityProxyTypeInfo.cs
- UnauthorizedAccessException.cs
- ellipse.cs
- FunctionQuery.cs
- _NetworkingPerfCounters.cs
- ListBoxItemWrapperAutomationPeer.cs
- HandlerBase.cs
- CacheRequest.cs
- OutputCacheSettingsSection.cs
- DragDeltaEventArgs.cs
- XAMLParseException.cs
- ConfigurationStrings.cs
- BreadCrumbTextConverter.cs
- _SSPISessionCache.cs
- ResourcesChangeInfo.cs
- XsltLoader.cs
- DtdParser.cs
- Type.cs
- ProtocolsConfiguration.cs
- HyperLinkStyle.cs
- MimeWriter.cs
- FontStyleConverter.cs
- LedgerEntryCollection.cs
- DesignerAttribute.cs
- DataViewSettingCollection.cs
- RemotingAttributes.cs
- ColorAnimationUsingKeyFrames.cs