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
- ListViewInsertedEventArgs.cs
- ReferenceEqualityComparer.cs
- ReferenceAssemblyAttribute.cs
- NumberEdit.cs
- SmtpSection.cs
- Pen.cs
- EntityDataSourceStatementEditor.cs
- DataTableClearEvent.cs
- Win32Exception.cs
- UrlAuthFailedErrorFormatter.cs
- XmlSchemaChoice.cs
- LinearKeyFrames.cs
- HashHelper.cs
- BuildManagerHost.cs
- QilTypeChecker.cs
- Rfc2898DeriveBytes.cs
- IgnoreSection.cs
- ProtectedConfigurationSection.cs
- SyndicationItemFormatter.cs
- SubMenuStyle.cs
- FormsAuthenticationUser.cs
- Marshal.cs
- InheritanceAttribute.cs
- WebBrowserDocumentCompletedEventHandler.cs
- JsonReaderWriterFactory.cs
- Filter.cs
- ChildChangedEventArgs.cs
- CheckBoxRenderer.cs
- clipboard.cs
- HtmlShimManager.cs
- DataGridHeaderBorder.cs
- MSG.cs
- Int16Storage.cs
- MasterPageCodeDomTreeGenerator.cs
- safesecurityhelperavalon.cs
- TraceHwndHost.cs
- SmtpNtlmAuthenticationModule.cs
- SystemIcmpV4Statistics.cs
- DBPropSet.cs
- DynamicMethod.cs
- ConsumerConnectionPointCollection.cs
- XsltInput.cs
- Iis7Helper.cs
- IPAddressCollection.cs
- SemanticKeyElement.cs
- BehaviorEditorPart.cs
- BinHexEncoder.cs
- MarkupExtensionParser.cs
- DigitalSignature.cs
- ApplicationManager.cs
- PageHandlerFactory.cs
- DbFunctionCommandTree.cs
- LogicalTreeHelper.cs
- AutomationPropertyInfo.cs
- ToolStripDropTargetManager.cs
- HttpHandlersSection.cs
- Drawing.cs
- ToolStripDropDown.cs
- TextBox.cs
- Pair.cs
- QueryHandler.cs
- QilInvoke.cs
- ExtendedProtectionPolicyTypeConverter.cs
- PeerNameRegistration.cs
- EditorServiceContext.cs
- _RequestCacheProtocol.cs
- Matrix.cs
- ComponentResourceKey.cs
- ImageDrawing.cs
- InvalidOleVariantTypeException.cs
- CatalogPart.cs
- DocumentGridPage.cs
- FilterEventArgs.cs
- dsa.cs
- DataDocumentXPathNavigator.cs
- PackageRelationshipCollection.cs
- Shape.cs
- PointLight.cs
- RTTrackingProfile.cs
- DecimalAnimation.cs
- ResourceReferenceKeyNotFoundException.cs
- ThreadStartException.cs
- Content.cs
- SoapHelper.cs
- TextInfo.cs
- AssemblyResolver.cs
- MenuItemCollection.cs
- ControlIdConverter.cs
- SafeNativeMethods.cs
- PasswordTextNavigator.cs
- HostingEnvironmentWrapper.cs
- ISAPIRuntime.cs
- TypeResolvingOptions.cs
- RC2.cs
- DispatcherHooks.cs
- SafeProcessHandle.cs
- DataGridItemCollection.cs
- TextElementAutomationPeer.cs
- wgx_commands.cs
- AlternateViewCollection.cs