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
- WebHeaderCollection.cs
- HandledMouseEvent.cs
- XmlEntity.cs
- CodeRegionDirective.cs
- PerformanceCountersElement.cs
- SqlNodeTypeOperators.cs
- PowerStatus.cs
- Tool.cs
- TextModifier.cs
- Common.cs
- OleDbInfoMessageEvent.cs
- ConstraintCollection.cs
- AndCondition.cs
- HtmlSelect.cs
- NativeMethods.cs
- ThreadAttributes.cs
- CompiledAction.cs
- MediaPlayerState.cs
- WizardStepBase.cs
- DictionaryEntry.cs
- OrderedParallelQuery.cs
- Coordinator.cs
- MetadataLocation.cs
- StrokeNodeData.cs
- NavigatorOutput.cs
- DefaultObjectMappingItemCollection.cs
- InsufficientExecutionStackException.cs
- TrustExchangeException.cs
- Separator.cs
- ObjectItemCachedAssemblyLoader.cs
- AuthenticationServiceManager.cs
- TerminatorSinks.cs
- DefinitionUpdate.cs
- StringInfo.cs
- NegationPusher.cs
- TimeSpanValidator.cs
- RegexCompiler.cs
- RequestUriProcessor.cs
- XmlAttributeProperties.cs
- Splitter.cs
- NativeRecognizer.cs
- MouseButtonEventArgs.cs
- MissingManifestResourceException.cs
- cookiecollection.cs
- AtomParser.cs
- DataGridViewTopLeftHeaderCell.cs
- ChangePassword.cs
- SymmetricKeyWrap.cs
- CodeIndexerExpression.cs
- UnmanagedBitmapWrapper.cs
- DataGridViewCellConverter.cs
- ScriptRef.cs
- ClipboardData.cs
- DnsCache.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- WinEventQueueItem.cs
- DataSourceGroupCollection.cs
- FileNotFoundException.cs
- ClientSettingsProvider.cs
- EditorPart.cs
- WebServiceFault.cs
- ConfigXmlDocument.cs
- Preprocessor.cs
- CommonXSendMessage.cs
- WebPartDescription.cs
- RuleSettingsCollection.cs
- TrackBar.cs
- DataControlCommands.cs
- FastPropertyAccessor.cs
- XmlTextReader.cs
- XMLDiffLoader.cs
- RSACryptoServiceProvider.cs
- ShutDownListener.cs
- CaseExpr.cs
- OperationAbortedException.cs
- _NtlmClient.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- PropertyInfo.cs
- HTTPRemotingHandler.cs
- Int32EqualityComparer.cs
- ChangeConflicts.cs
- SevenBitStream.cs
- XPathSingletonIterator.cs
- Cursor.cs
- SecurityContext.cs
- WsdlServiceChannelBuilder.cs
- QueryValue.cs
- CodeAccessPermission.cs
- _TLSstream.cs
- PrintEvent.cs
- StartUpEventArgs.cs
- BrowserCapabilitiesCodeGenerator.cs
- RIPEMD160Managed.cs
- InternalBufferManager.cs
- HwndHost.cs
- StateMachineDesignerPaint.cs
- DataGridViewTopRowAccessibleObject.cs
- MatrixValueSerializer.cs
- MenuAdapter.cs
- GuidConverter.cs