Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / clr / src / BCL / System / Security / Cryptography / SHA1CryptoServiceProvider.cs / 1 / SHA1CryptoServiceProvider.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
//
// SHA1CryptoServiceProvider.cs
//
namespace System.Security.Cryptography {
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class SHA1CryptoServiceProvider : SHA1
{
private SafeHashHandle _safeHashHandle = null;
//
// public constructors
//
public SHA1CryptoServiceProvider() {
SafeHashHandle safeHashHandle = SafeHashHandle.InvalidHandle;
// _CreateHash will check for failures and throw the appropriate exception
Utils._CreateHash(Utils.StaticProvHandle, Constants.CALG_SHA1, ref safeHashHandle);
_safeHashHandle = safeHashHandle;
}
protected override void Dispose(bool disposing)
{
if (_safeHashHandle != null && !_safeHashHandle.IsClosed)
_safeHashHandle.Dispose();
// call the base class's Dispose
base.Dispose(disposing);
}
//
// public methods
//
public override void Initialize() {
if (_safeHashHandle != null && !_safeHashHandle.IsClosed)
_safeHashHandle.Dispose();
SafeHashHandle safeHashHandle = SafeHashHandle.InvalidHandle;
// _CreateHash will check for failures and throw the appropriate exception
Utils._CreateHash(Utils.StaticProvHandle, Constants.CALG_SHA1, ref safeHashHandle);
_safeHashHandle = safeHashHandle;
}
protected override void HashCore(byte[] rgb, int ibStart, int cbSize) {
Utils._HashData(_safeHashHandle, rgb, ibStart, cbSize);
}
protected override byte[] HashFinal() {
return Utils._EndHash(_safeHashHandle);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
//
// SHA1CryptoServiceProvider.cs
//
namespace System.Security.Cryptography {
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class SHA1CryptoServiceProvider : SHA1
{
private SafeHashHandle _safeHashHandle = null;
//
// public constructors
//
public SHA1CryptoServiceProvider() {
SafeHashHandle safeHashHandle = SafeHashHandle.InvalidHandle;
// _CreateHash will check for failures and throw the appropriate exception
Utils._CreateHash(Utils.StaticProvHandle, Constants.CALG_SHA1, ref safeHashHandle);
_safeHashHandle = safeHashHandle;
}
protected override void Dispose(bool disposing)
{
if (_safeHashHandle != null && !_safeHashHandle.IsClosed)
_safeHashHandle.Dispose();
// call the base class's Dispose
base.Dispose(disposing);
}
//
// public methods
//
public override void Initialize() {
if (_safeHashHandle != null && !_safeHashHandle.IsClosed)
_safeHashHandle.Dispose();
SafeHashHandle safeHashHandle = SafeHashHandle.InvalidHandle;
// _CreateHash will check for failures and throw the appropriate exception
Utils._CreateHash(Utils.StaticProvHandle, Constants.CALG_SHA1, ref safeHashHandle);
_safeHashHandle = safeHashHandle;
}
protected override void HashCore(byte[] rgb, int ibStart, int cbSize) {
Utils._HashData(_safeHashHandle, rgb, ibStart, cbSize);
}
protected override byte[] HashFinal() {
return Utils._EndHash(_safeHashHandle);
}
}
}
// 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
- Substitution.cs
- EventWaitHandle.cs
- IsolatedStorageException.cs
- XmlQualifiedNameTest.cs
- Parameter.cs
- ThemeDictionaryExtension.cs
- Guid.cs
- OdbcParameter.cs
- DesignerForm.cs
- NamespaceEmitter.cs
- RecognizedPhrase.cs
- StructuredTypeEmitter.cs
- ServiceDiscoveryBehavior.cs
- IChannel.cs
- JournalEntry.cs
- ContextMenu.cs
- ResourceContainer.cs
- GeometryModel3D.cs
- InfoCardServiceInstallComponent.cs
- DataGridViewCheckBoxCell.cs
- PropertyManager.cs
- ActivityStatusChangeEventArgs.cs
- WebPartEditorApplyVerb.cs
- _UriTypeConverter.cs
- ElementHostPropertyMap.cs
- Vertex.cs
- ConnectionManager.cs
- Timer.cs
- CapabilitiesAssignment.cs
- DataControlImageButton.cs
- InvalidAsynchronousStateException.cs
- SafeUserTokenHandle.cs
- Serializer.cs
- RectIndependentAnimationStorage.cs
- DesignerView.xaml.cs
- ThicknessConverter.cs
- BindingCompleteEventArgs.cs
- UpdatePanelTriggerCollection.cs
- Peer.cs
- ListBoxAutomationPeer.cs
- SemaphoreSecurity.cs
- WmfPlaceableFileHeader.cs
- HyperlinkAutomationPeer.cs
- LoadMessageLogger.cs
- OracleTimeSpan.cs
- MappingException.cs
- ScriptServiceAttribute.cs
- DelegateBodyWriter.cs
- CodeArrayIndexerExpression.cs
- SqlDataSource.cs
- AnonymousIdentificationModule.cs
- DateTimePicker.cs
- XmlIgnoreAttribute.cs
- XmlValueConverter.cs
- SystemParameters.cs
- ProcessStartInfo.cs
- EncryptedXml.cs
- ScriptMethodAttribute.cs
- ConsoleTraceListener.cs
- SchemaImporter.cs
- EtwTrace.cs
- MenuItemBinding.cs
- ConfigurationPropertyCollection.cs
- AssemblyEvidenceFactory.cs
- ScaleTransform3D.cs
- Padding.cs
- PixelFormats.cs
- BrowserDefinitionCollection.cs
- ContentFileHelper.cs
- ToolBarOverflowPanel.cs
- TemplateField.cs
- XPathScanner.cs
- PtsHost.cs
- DynamicILGenerator.cs
- ToolStripContainerActionList.cs
- PropertyPathWorker.cs
- HtmlEmptyTagControlBuilder.cs
- sqlnorm.cs
- MasterPageParser.cs
- GridItemProviderWrapper.cs
- MenuCommand.cs
- PixelFormats.cs
- DataGridViewRowsRemovedEventArgs.cs
- AppSettingsReader.cs
- DetailsViewInsertEventArgs.cs
- LayoutUtils.cs
- DecodeHelper.cs
- FloatUtil.cs
- ScrollBar.cs
- WebPartUtil.cs
- SafeNativeMethodsOther.cs
- XamlSerializerUtil.cs
- BaseDataList.cs
- JulianCalendar.cs
- NameGenerator.cs
- DataGridViewTopLeftHeaderCell.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- HttpWebResponse.cs
- ProcessInfo.cs
- UserPersonalizationStateInfo.cs