Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / SHA512CryptoServiceProvider.cs / 1305376 / SHA512CryptoServiceProvider.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
using System;
using System.Diagnostics.Contracts;
namespace System.Security.Cryptography {
///
/// Wrapper around the CAPI implementation of the SHA-512 hashing algorithm
///
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public sealed class SHA512CryptoServiceProvider : SHA512 {
private CapiHashAlgorithm m_hashAlgorithm;
//
//
//
[System.Security.SecurityCritical]
public SHA512CryptoServiceProvider() {
Contract.Ensures(m_hashAlgorithm != null);
m_hashAlgorithm = new CapiHashAlgorithm(CapiNative.ProviderNames.MicrosoftEnhancedRsaAes,
CapiNative.ProviderType.RsaAes,
CapiNative.AlgorithmId.Sha512);
}
//
//
//
[System.Security.SecurityCritical]
protected override void Dispose(bool disposing) {
try {
if (disposing) {
m_hashAlgorithm.Dispose();
}
}
finally {
base.Dispose(disposing);
}
}
///
/// Reset the hash algorithm to begin hashing a new set of data
///
//
//
//
[System.Security.SecurityCritical]
public override void Initialize() {
Contract.Assert(m_hashAlgorithm != null);
m_hashAlgorithm.Initialize();
}
///
/// Hash a block of data
///
//
//
//
[System.Security.SecurityCritical]
protected override void HashCore(byte[] array, int ibStart, int cbSize) {
Contract.Assert(m_hashAlgorithm != null);
m_hashAlgorithm.HashCore(array, ibStart, cbSize);
}
///
/// Complete the hash, returning its value
///
//
//
//
[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 CAPI implementation of the SHA-512 hashing algorithm
///
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public sealed class SHA512CryptoServiceProvider : SHA512 {
private CapiHashAlgorithm m_hashAlgorithm;
//
//
//
[System.Security.SecurityCritical]
public SHA512CryptoServiceProvider() {
Contract.Ensures(m_hashAlgorithm != null);
m_hashAlgorithm = new CapiHashAlgorithm(CapiNative.ProviderNames.MicrosoftEnhancedRsaAes,
CapiNative.ProviderType.RsaAes,
CapiNative.AlgorithmId.Sha512);
}
//
//
//
[System.Security.SecurityCritical]
protected override void Dispose(bool disposing) {
try {
if (disposing) {
m_hashAlgorithm.Dispose();
}
}
finally {
base.Dispose(disposing);
}
}
///
/// Reset the hash algorithm to begin hashing a new set of data
///
//
//
//
[System.Security.SecurityCritical]
public override void Initialize() {
Contract.Assert(m_hashAlgorithm != null);
m_hashAlgorithm.Initialize();
}
///
/// Hash a block of data
///
//
//
//
[System.Security.SecurityCritical]
protected override void HashCore(byte[] array, int ibStart, int cbSize) {
Contract.Assert(m_hashAlgorithm != null);
m_hashAlgorithm.HashCore(array, ibStart, cbSize);
}
///
/// Complete the hash, returning its value
///
//
//
//
[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
- XPathDocumentBuilder.cs
- CompositeClientFormatter.cs
- ProxyHelper.cs
- X500Name.cs
- BamlRecordHelper.cs
- IUnknownConstantAttribute.cs
- StringUtil.cs
- UIPermission.cs
- ServiceEndpoint.cs
- AssemblyBuilder.cs
- ModelItemKeyValuePair.cs
- CharStorage.cs
- ObjectView.cs
- ScrollProviderWrapper.cs
- LayoutInformation.cs
- ProfileProvider.cs
- MeasureData.cs
- SelectingProviderEventArgs.cs
- BinaryMethodMessage.cs
- unitconverter.cs
- ClientSession.cs
- Compiler.cs
- UiaCoreTypesApi.cs
- SaveWorkflowAsyncResult.cs
- NullableFloatMinMaxAggregationOperator.cs
- ConsoleTraceListener.cs
- DiscoveryDocumentReference.cs
- SizeFConverter.cs
- CodeDirectoryCompiler.cs
- UserNameSecurityTokenProvider.cs
- ExceptionHandler.cs
- CaretElement.cs
- ActivatedMessageQueue.cs
- ListBindableAttribute.cs
- _LocalDataStore.cs
- ClientTargetCollection.cs
- CounterCreationData.cs
- TextRenderer.cs
- DynamicDataManager.cs
- KeyValuePair.cs
- WeakReferenceKey.cs
- TextAnchor.cs
- QueryableDataSource.cs
- CodeAttributeArgumentCollection.cs
- UpdateCommand.cs
- RemotingConfigParser.cs
- SegmentInfo.cs
- DbException.cs
- _LoggingObject.cs
- XLinq.cs
- DomNameTable.cs
- CodeMemberMethod.cs
- DesignerDataParameter.cs
- CodeDomComponentSerializationService.cs
- XmlSchemaObjectCollection.cs
- CommandDesigner.cs
- LinqDataSourceUpdateEventArgs.cs
- HelpEvent.cs
- FlowchartDesigner.xaml.cs
- WaitForChangedResult.cs
- PrincipalPermission.cs
- ProgressChangedEventArgs.cs
- odbcmetadatafactory.cs
- MsmqIntegrationSecurityElement.cs
- IOException.cs
- Int32.cs
- PageContentAsyncResult.cs
- TextServicesLoader.cs
- NamespaceEmitter.cs
- ListDesigner.cs
- ToolboxItemCollection.cs
- Int16AnimationBase.cs
- SingleBodyParameterMessageFormatter.cs
- GlobalId.cs
- BufferedReadStream.cs
- TextProviderWrapper.cs
- WaitForChangedResult.cs
- RequestQueryParser.cs
- HttpMethodAttribute.cs
- SqlFactory.cs
- TableLayout.cs
- LocalizedNameDescriptionPair.cs
- XhtmlCssHandler.cs
- ScrollContentPresenter.cs
- HttpResponse.cs
- SchemaInfo.cs
- DeflateStream.cs
- ImageInfo.cs
- IListConverters.cs
- DbMetaDataColumnNames.cs
- Message.cs
- ScrollChangedEventArgs.cs
- TextEndOfSegment.cs
- QueryRelOp.cs
- IPipelineRuntime.cs
- SQLInt32.cs
- PropertyNames.cs
- PropertyTab.cs
- TdsParserStateObject.cs
- DataProtection.cs