Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / SHA512Cng.cs / 1305376 / SHA512Cng.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-512 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA512Cng : SHA512 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA512Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha512, 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-512 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA512Cng : SHA512 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA512Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha512, 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
- SyndicationSerializer.cs
- NonParentingControl.cs
- DelegateOutArgument.cs
- ValuePattern.cs
- Help.cs
- DataGridViewColumnCollectionEditor.cs
- mda.cs
- Speller.cs
- HiddenField.cs
- DefaultAsyncDataDispatcher.cs
- ComPlusTypeLoader.cs
- CustomCategoryAttribute.cs
- DefaultEventAttribute.cs
- DispatcherHookEventArgs.cs
- QilPatternVisitor.cs
- ServerReliableChannelBinder.cs
- DashStyles.cs
- RotateTransform3D.cs
- ApplicationFileCodeDomTreeGenerator.cs
- LineGeometry.cs
- XmlName.cs
- MsmqIntegrationElement.cs
- ObjectDataSourceEventArgs.cs
- SafeBuffer.cs
- DataControlButton.cs
- JobStaple.cs
- TextRenderer.cs
- BufferModesCollection.cs
- StyleModeStack.cs
- SettingsAttributeDictionary.cs
- AsymmetricSecurityProtocolFactory.cs
- EmptyImpersonationContext.cs
- GridViewSortEventArgs.cs
- PingOptions.cs
- TabItemAutomationPeer.cs
- ResolveMatchesCD1.cs
- DiscoveryEndpointElement.cs
- DefaultExpression.cs
- TransformCollection.cs
- ComboBox.cs
- MtomMessageEncodingBindingElement.cs
- PeerNameResolver.cs
- PackUriHelper.cs
- VisualStyleElement.cs
- XmlSchemaCollection.cs
- ToolTipAutomationPeer.cs
- validationstate.cs
- KernelTypeValidation.cs
- ColumnBinding.cs
- XslNumber.cs
- AppSettingsSection.cs
- TransformerTypeCollection.cs
- AccessDataSourceDesigner.cs
- Table.cs
- DataGridViewCell.cs
- ListControl.cs
- UriTemplateHelpers.cs
- RegexParser.cs
- SaveLedgerEntryRequest.cs
- IsolatedStorageFile.cs
- PrintDialog.cs
- DoWorkEventArgs.cs
- TimeIntervalCollection.cs
- X509IssuerSerialKeyIdentifierClause.cs
- SqlAliaser.cs
- ManifestResourceInfo.cs
- MetadataItemCollectionFactory.cs
- PropertyIDSet.cs
- DefaultValueTypeConverter.cs
- DPTypeDescriptorContext.cs
- HotCommands.cs
- ComplexObject.cs
- DefaultPrintController.cs
- DataError.cs
- ZipFileInfo.cs
- XPathPatternBuilder.cs
- IItemContainerGenerator.cs
- ObjectDisposedException.cs
- ObjectListFieldsPage.cs
- BevelBitmapEffect.cs
- FixedDocumentPaginator.cs
- FigureParaClient.cs
- RelationshipEndMember.cs
- TableChangeProcessor.cs
- CheckBox.cs
- WinEventTracker.cs
- ArgumentOutOfRangeException.cs
- XmlValueConverter.cs
- IdleTimeoutMonitor.cs
- RemotingException.cs
- UdpConstants.cs
- CombinedHttpChannel.cs
- CodeIterationStatement.cs
- PropertyNames.cs
- Matrix3DValueSerializer.cs
- SchemaRegistration.cs
- Variant.cs
- XPathAncestorIterator.cs
- HttpListenerRequest.cs
- FixedSOMContainer.cs