Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / SHA256Cng.cs / 1305376 / SHA256Cng.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-256 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA256Cng : SHA256 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA256Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha256, 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-256 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA256Cng : SHA256 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA256Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha256, 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
- InternalTransaction.cs
- BaseParser.cs
- Viewport2DVisual3D.cs
- TextElementCollectionHelper.cs
- DefaultExpressionVisitor.cs
- ButtonBase.cs
- PointAnimationBase.cs
- InitializingNewItemEventArgs.cs
- PrimitiveCodeDomSerializer.cs
- TextPointerBase.cs
- CookieParameter.cs
- ProxySimple.cs
- CompilationLock.cs
- MemoryStream.cs
- ImageDrawing.cs
- GridViewDeletedEventArgs.cs
- EventDescriptor.cs
- Literal.cs
- C14NUtil.cs
- EnumBuilder.cs
- SpotLight.cs
- EdmFunctionAttribute.cs
- NativeMethods.cs
- ObjectContext.cs
- CalendarDayButton.cs
- ECDiffieHellmanCngPublicKey.cs
- CheckBox.cs
- SpeechUI.cs
- ProcessHost.cs
- SafeSecurityHelper.cs
- FieldToken.cs
- TdsParserStaticMethods.cs
- ObjectContextServiceProvider.cs
- PlanCompilerUtil.cs
- DataSourceCollectionBase.cs
- HtmlControl.cs
- PrintPreviewGraphics.cs
- XslException.cs
- FixedSOMLineRanges.cs
- ReadContentAsBinaryHelper.cs
- ActiveXSite.cs
- SizeValueSerializer.cs
- DbConnectionPoolGroupProviderInfo.cs
- FileReservationCollection.cs
- AppSettingsReader.cs
- TreeView.cs
- XmlDictionaryString.cs
- DataGridViewColumnConverter.cs
- URLString.cs
- RunClient.cs
- _BasicClient.cs
- ColorConverter.cs
- PageHandlerFactory.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- ProcessModelInfo.cs
- HttpProxyCredentialType.cs
- RectConverter.cs
- ArrayList.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- PolicyUtility.cs
- XmlSchemaSearchPattern.cs
- RecordsAffectedEventArgs.cs
- mediaeventshelper.cs
- XPathItem.cs
- _CommandStream.cs
- HostProtectionPermission.cs
- CodeAttributeDeclarationCollection.cs
- XmlUnspecifiedAttribute.cs
- TableMethodGenerator.cs
- WindowsTooltip.cs
- DefaultAssemblyResolver.cs
- SettingsPropertyValueCollection.cs
- XmlSchemaAttributeGroupRef.cs
- Literal.cs
- UnmanagedMemoryStreamWrapper.cs
- StringResourceManager.cs
- EdmToObjectNamespaceMap.cs
- ConvertTextFrag.cs
- CodeNamespaceImport.cs
- HttpRequestWrapper.cs
- InstanceNotReadyException.cs
- WindowPatternIdentifiers.cs
- linebase.cs
- StickyNoteAnnotations.cs
- UnsafeNativeMethods.cs
- SiteOfOriginPart.cs
- NativeWindow.cs
- SafeLibraryHandle.cs
- LocalizedNameDescriptionPair.cs
- DelegateSerializationHolder.cs
- ParameterCollection.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- XmlSchemaSimpleType.cs
- AnnotationComponentChooser.cs
- BeginEvent.cs
- SmiContext.cs
- MobileControlDesigner.cs
- FileCodeGroup.cs
- TileModeValidation.cs
- ArrayHelper.cs