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
- ComponentChangingEvent.cs
- BmpBitmapDecoder.cs
- Helper.cs
- QueueAccessMode.cs
- Trace.cs
- Size3D.cs
- _ConnectOverlappedAsyncResult.cs
- Container.cs
- NamespaceCollection.cs
- DelegatingTypeDescriptionProvider.cs
- SimpleHandlerBuildProvider.cs
- BindingCompleteEventArgs.cs
- HtmlEmptyTagControlBuilder.cs
- DataGridHeaderBorder.cs
- TransformGroup.cs
- DataContractSerializerSection.cs
- WindowsProgressbar.cs
- RowToFieldTransformer.cs
- PriorityBindingExpression.cs
- HitTestWithGeometryDrawingContextWalker.cs
- Choices.cs
- BitmapDecoder.cs
- HttpValueCollection.cs
- WindowsTreeView.cs
- StrokeIntersection.cs
- wgx_render.cs
- SoundPlayer.cs
- TdsValueSetter.cs
- CommandCollectionEditor.cs
- LocatorGroup.cs
- ExpressionBuilderContext.cs
- DataBinder.cs
- SpAudioStreamWrapper.cs
- ImageList.cs
- ConnectionsZone.cs
- SaveFileDialogDesigner.cs
- MetadataArtifactLoader.cs
- DrawingContextDrawingContextWalker.cs
- EventLogEntryCollection.cs
- BulletChrome.cs
- ObjectDataSourceSelectingEventArgs.cs
- FontSourceCollection.cs
- ColumnResizeUndoUnit.cs
- DrawingServices.cs
- ConfigurationElementCollection.cs
- RequestQueue.cs
- CharacterShapingProperties.cs
- Facet.cs
- SqlSelectClauseBuilder.cs
- StreamInfo.cs
- GeneratedCodeAttribute.cs
- ConnectionPoolManager.cs
- UIElement3DAutomationPeer.cs
- NamespaceDisplay.xaml.cs
- ToolStripPanelSelectionBehavior.cs
- SourceFileInfo.cs
- HttpsHostedTransportConfiguration.cs
- AttributeSetAction.cs
- HandledEventArgs.cs
- DataGridHelper.cs
- Color.cs
- BasicViewGenerator.cs
- ChangePasswordAutoFormat.cs
- Size3D.cs
- PositiveTimeSpanValidator.cs
- DataPointer.cs
- SecurityHelper.cs
- CommonObjectSecurity.cs
- RawContentTypeMapper.cs
- SqlDataSource.cs
- ToolStripDropDown.cs
- TextBoxView.cs
- Journaling.cs
- SelectionListComponentEditor.cs
- SystemKeyConverter.cs
- Helpers.cs
- ClientBuildManager.cs
- NotificationContext.cs
- XmlLinkedNode.cs
- FormatConvertedBitmap.cs
- MatrixAnimationBase.cs
- OleDbCommand.cs
- SplineKeyFrames.cs
- SqlExpander.cs
- SqlOuterApplyReducer.cs
- FlowchartSizeFeature.cs
- SelectionItemPattern.cs
- MimeTypePropertyAttribute.cs
- BuildResult.cs
- EntityContainerEmitter.cs
- HtmlInputReset.cs
- NetworkCredential.cs
- SqlParameterizer.cs
- ReflectEventDescriptor.cs
- ToolStripRenderer.cs
- WindowsAuthenticationEventArgs.cs
- HttpInputStream.cs
- ZipIOBlockManager.cs
- WebPartCancelEventArgs.cs
- MimeFormatter.cs