Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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);
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DisplayMemberTemplateSelector.cs
- Menu.cs
- SqlXmlStorage.cs
- WebPartZoneBase.cs
- ExpressionsCollectionEditor.cs
- UInt16.cs
- RowBinding.cs
- TerminatorSinks.cs
- XmlRootAttribute.cs
- Polygon.cs
- DataServiceRequest.cs
- DebugInfo.cs
- XmlSchemaComplexContentExtension.cs
- IgnoreFlushAndCloseStream.cs
- ColorTranslator.cs
- GCHandleCookieTable.cs
- SocketAddress.cs
- XPathScanner.cs
- AvtEvent.cs
- Processor.cs
- SchemaObjectWriter.cs
- AdRotator.cs
- TextTreePropertyUndoUnit.cs
- ToolZone.cs
- ReadOnlyCollection.cs
- ViewStateModeByIdAttribute.cs
- TaiwanLunisolarCalendar.cs
- UnknownWrapper.cs
- UIElementParaClient.cs
- ButtonPopupAdapter.cs
- PlainXmlSerializer.cs
- StaticResourceExtension.cs
- regiisutil.cs
- DesignerAdapterUtil.cs
- HelpEvent.cs
- CodeTypeReferenceCollection.cs
- WebPartDeleteVerb.cs
- BoolLiteral.cs
- BypassElement.cs
- ConsumerConnectionPointCollection.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- HeaderUtility.cs
- PassportAuthenticationEventArgs.cs
- DiscoveryReferences.cs
- ToolBar.cs
- XmlWhitespace.cs
- XmlStringTable.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- Assert.cs
- SQLString.cs
- SoapIgnoreAttribute.cs
- ImageList.cs
- DrawingVisual.cs
- UshortList2.cs
- NetNamedPipeSecurityMode.cs
- XmlCharCheckingReader.cs
- CharAnimationBase.cs
- TabPage.cs
- Font.cs
- UnescapedXmlDiagnosticData.cs
- XmlAutoDetectWriter.cs
- IssuedTokensHeader.cs
- SqlStatistics.cs
- CheckBox.cs
- EntitySet.cs
- LockingPersistenceProvider.cs
- __ConsoleStream.cs
- Substitution.cs
- ScrollEventArgs.cs
- TextServicesCompartmentEventSink.cs
- WinEventHandler.cs
- CriticalExceptions.cs
- Crc32.cs
- RoleServiceManager.cs
- Exceptions.cs
- IndependentAnimationStorage.cs
- WebBrowserHelper.cs
- Int32Rect.cs
- PagesSection.cs
- StreamInfo.cs
- TransformerInfo.cs
- MenuItemStyle.cs
- SubpageParaClient.cs
- dbdatarecord.cs
- ExpressionHelper.cs
- PrimitiveSchema.cs
- TypeLoader.cs
- ToolboxComponentsCreatedEventArgs.cs
- UnaryQueryOperator.cs
- ImageDrawing.cs
- Compensate.cs
- AdapterUtil.cs
- CultureInfo.cs
- StructuralType.cs
- NegotiationTokenProvider.cs
- TableLayoutSettings.cs
- CultureNotFoundException.cs
- MenuItemAutomationPeer.cs
- ListItemViewAttribute.cs
- TokenBasedSetEnumerator.cs