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
- TabletDevice.cs
- MailBnfHelper.cs
- TrustLevelCollection.cs
- ValidatorCompatibilityHelper.cs
- Screen.cs
- Wrapper.cs
- IBuiltInEvidence.cs
- ServiceOperationParameter.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- EventHandlerList.cs
- DefaultExpression.cs
- XMLUtil.cs
- AssemblySettingAttributes.cs
- ExtendedTransformFactory.cs
- StrokeNodeOperations2.cs
- PrtTicket_Public_Simple.cs
- XmlCharType.cs
- CodeDirectoryCompiler.cs
- SqlNotificationEventArgs.cs
- GeometryHitTestResult.cs
- SystemNetworkInterface.cs
- CodeDomExtensionMethods.cs
- BuilderInfo.cs
- __Filters.cs
- DbModificationClause.cs
- RecognizedWordUnit.cs
- DynamicRendererThreadManager.cs
- TileBrush.cs
- TdsParser.cs
- ObjectViewFactory.cs
- ValueConversionAttribute.cs
- SocketPermission.cs
- ComponentEditorPage.cs
- EnumValAlphaComparer.cs
- ResizeGrip.cs
- SqlTypeSystemProvider.cs
- XPathSelectionIterator.cs
- WebServiceParameterData.cs
- StylusSystemGestureEventArgs.cs
- ProbeRequestResponseAsyncResult.cs
- xmlsaver.cs
- Timer.cs
- TraceUtils.cs
- CodeSnippetExpression.cs
- PassportIdentity.cs
- BoolExpr.cs
- EntityParameterCollection.cs
- XamlRtfConverter.cs
- ApplicationGesture.cs
- HttpHostedTransportConfiguration.cs
- HtmlInputRadioButton.cs
- WebPartHeaderCloseVerb.cs
- DataGridToolTip.cs
- SatelliteContractVersionAttribute.cs
- SplineQuaternionKeyFrame.cs
- XmlWriterTraceListener.cs
- HtmlCommandAdapter.cs
- EdmProviderManifest.cs
- ToolTipAutomationPeer.cs
- Rotation3DAnimationBase.cs
- EventMappingSettingsCollection.cs
- XmlNamespaceMappingCollection.cs
- StateMachineSubscription.cs
- WhiteSpaceTrimStringConverter.cs
- SqlBulkCopyColumnMappingCollection.cs
- TraceContextEventArgs.cs
- DispatcherProcessingDisabled.cs
- Delegate.cs
- ParagraphVisual.cs
- SymbolType.cs
- PermissionSetTriple.cs
- BindingNavigator.cs
- HijriCalendar.cs
- RequiredAttributeAttribute.cs
- AttributeProviderAttribute.cs
- InputProcessorProfiles.cs
- WebPartsPersonalization.cs
- Material.cs
- XmlRootAttribute.cs
- EngineSite.cs
- TargetConverter.cs
- SystemIPv4InterfaceProperties.cs
- ProgressChangedEventArgs.cs
- ByteStream.cs
- ProtocolsConfigurationHandler.cs
- InlineUIContainer.cs
- ProfileGroupSettings.cs
- MatrixCamera.cs
- EventLogEntryCollection.cs
- CursorConverter.cs
- ProjectionCamera.cs
- XmlSerializableServices.cs
- ObjectAssociationEndMapping.cs
- WebPartAddingEventArgs.cs
- TreeViewCancelEvent.cs
- UdpDiscoveryEndpointProvider.cs
- RequestCacheEntry.cs
- TcpClientSocketManager.cs
- NavigatorOutput.cs
- PageResolution.cs