Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / SHA256CryptoServiceProvider.cs / 1305376 / SHA256CryptoServiceProvider.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== using System; using System.Diagnostics.Contracts; namespace System.Security.Cryptography { ////// Wrapper around the CAPI implementation of the SHA-256 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA256CryptoServiceProvider : SHA256 { private CapiHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA256CryptoServiceProvider() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new CapiHashAlgorithm(CapiNative.ProviderNames.MicrosoftEnhancedRsaAes, CapiNative.ProviderType.RsaAes, CapiNative.AlgorithmId.Sha256); } //// // [System.Security.SecurityCritical] protected override void Dispose(bool disposing) { try { if (disposing) { m_hashAlgorithm.Dispose(); } } finally { base.Dispose(disposing); } } ///// /// Reset the hash algorithm to begin hashing a new set of data /// //// [System.Security.SecurityCritical] public override void Initialize() { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.Initialize(); } ///// /// Hash a block of data /// //// [System.Security.SecurityCritical] protected override void HashCore(byte[] array, int ibStart, int cbSize) { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.HashCore(array, ibStart, cbSize); } ///// /// Complete the hash, returning its value /// //// [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 CAPI implementation of the SHA-256 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA256CryptoServiceProvider : SHA256 { private CapiHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA256CryptoServiceProvider() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new CapiHashAlgorithm(CapiNative.ProviderNames.MicrosoftEnhancedRsaAes, CapiNative.ProviderType.RsaAes, CapiNative.AlgorithmId.Sha256); } //// // [System.Security.SecurityCritical] protected override void Dispose(bool disposing) { try { if (disposing) { m_hashAlgorithm.Dispose(); } } finally { base.Dispose(disposing); } } ///// /// Reset the hash algorithm to begin hashing a new set of data /// //// [System.Security.SecurityCritical] public override void Initialize() { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.Initialize(); } ///// /// Hash a block of data /// //// [System.Security.SecurityCritical] protected override void HashCore(byte[] array, int ibStart, int cbSize) { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.HashCore(array, ibStart, cbSize); } ///// /// Complete the hash, returning its value /// //// [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
- MappingSource.cs
- regiisutil.cs
- CollectionView.cs
- Size3D.cs
- ExpressionConverter.cs
- InfoCardSymmetricCrypto.cs
- Main.cs
- RowType.cs
- TrackBar.cs
- RawStylusInput.cs
- ColorBlend.cs
- ProfileSettings.cs
- OLEDB_Util.cs
- AsyncPostBackErrorEventArgs.cs
- HttpCacheVary.cs
- OutputCacheProviderCollection.cs
- SimplePropertyEntry.cs
- SmiConnection.cs
- figurelengthconverter.cs
- SqlFileStream.cs
- WindowsFormsHostAutomationPeer.cs
- IssuerInformation.cs
- MarginCollapsingState.cs
- InkCanvasSelection.cs
- IPHostEntry.cs
- FormatterServices.cs
- DictionarySectionHandler.cs
- SafeNativeMethods.cs
- ConditionalAttribute.cs
- ExpressionBuilder.cs
- ToolStripItemTextRenderEventArgs.cs
- XmlSerializerObjectSerializer.cs
- RedirectionProxy.cs
- SqlDependencyListener.cs
- StylusCaptureWithinProperty.cs
- DataObjectCopyingEventArgs.cs
- ExpressionBinding.cs
- Delegate.cs
- DrawToolTipEventArgs.cs
- HttpApplicationFactory.cs
- PagePropertiesChangingEventArgs.cs
- IPEndPoint.cs
- QuaternionIndependentAnimationStorage.cs
- DivideByZeroException.cs
- TextServicesManager.cs
- UrlPath.cs
- OrthographicCamera.cs
- XmlCompatibilityReader.cs
- StrongNameSignatureInformation.cs
- UndoManager.cs
- CreateUserWizardStep.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- CompositeDispatchFormatter.cs
- LogSwitch.cs
- HatchBrush.cs
- ConstraintManager.cs
- Margins.cs
- XmlText.cs
- future.cs
- JsonDeserializer.cs
- XamlValidatingReader.cs
- XPathNodeHelper.cs
- ImageDrawing.cs
- BuildManagerHost.cs
- PageFunction.cs
- ProgressBar.cs
- XPathBuilder.cs
- BulletChrome.cs
- ComponentCommands.cs
- AssemblyInfo.cs
- BufferModeSettings.cs
- Encoder.cs
- PointCollectionConverter.cs
- ParseNumbers.cs
- GenericWebPart.cs
- CodeDefaultValueExpression.cs
- PageParserFilter.cs
- DrawingContextWalker.cs
- HttpChannelHelpers.cs
- PluggableProtocol.cs
- CodeCastExpression.cs
- CodeRemoveEventStatement.cs
- SafeHandle.cs
- XmlDigitalSignatureProcessor.cs
- IdleTimeoutMonitor.cs
- PtsHost.cs
- NavigatorInvalidBodyAccessException.cs
- COM2Properties.cs
- TraceContextEventArgs.cs
- ColumnTypeConverter.cs
- RangeValuePattern.cs
- AppDomain.cs
- AuthenticationServiceManager.cs
- XmlNotation.cs
- TypeDescriptionProviderAttribute.cs
- LineBreakRecord.cs
- InitializationEventAttribute.cs
- SspiNegotiationTokenAuthenticator.cs
- TypeUsage.cs
- Event.cs