Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- FixUpCollection.cs
- XmlDocument.cs
- CheckedListBox.cs
- baseshape.cs
- XslAst.cs
- ManagementScope.cs
- GraphicsContext.cs
- WaitHandleCannotBeOpenedException.cs
- TraceUtils.cs
- SspiWrapper.cs
- DBConnection.cs
- RuntimeCompatibilityAttribute.cs
- AnnotationService.cs
- NotifyCollectionChangedEventArgs.cs
- WebPartHeaderCloseVerb.cs
- SqlHelper.cs
- UInt16Converter.cs
- ContentAlignmentEditor.cs
- XmlSchemaSequence.cs
- MatrixConverter.cs
- DictionaryGlobals.cs
- SiteMapNodeItem.cs
- GridViewCancelEditEventArgs.cs
- DataServiceResponse.cs
- AdRotatorDesigner.cs
- StrongNamePublicKeyBlob.cs
- BinaryFormatter.cs
- webclient.cs
- TableLayoutPanelCellPosition.cs
- GrammarBuilderRuleRef.cs
- selecteditemcollection.cs
- Part.cs
- ELinqQueryState.cs
- FindProgressChangedEventArgs.cs
- EntitySetBaseCollection.cs
- DetailsViewInsertEventArgs.cs
- DataColumn.cs
- DefaultAssemblyResolver.cs
- DefaultAuthorizationContext.cs
- MethodAccessException.cs
- ConfigurationConverterBase.cs
- StorageModelBuildProvider.cs
- GiveFeedbackEventArgs.cs
- Figure.cs
- Evidence.cs
- PlatformCulture.cs
- XmlLanguage.cs
- CompareInfo.cs
- EllipseGeometry.cs
- TemplateLookupAction.cs
- TextInfo.cs
- Win32MouseDevice.cs
- NullableDoubleAverageAggregationOperator.cs
- WCFBuildProvider.cs
- Parameter.cs
- SqlDependency.cs
- MetadataCache.cs
- FormViewDeleteEventArgs.cs
- InputScope.cs
- AssociationTypeEmitter.cs
- BindingListCollectionView.cs
- DrawingImage.cs
- BrowserDefinition.cs
- FullTextBreakpoint.cs
- TextChange.cs
- DirectoryNotFoundException.cs
- ImageConverter.cs
- MDIControlStrip.cs
- FixedFlowMap.cs
- HttpDebugHandler.cs
- FigureParagraph.cs
- Deflater.cs
- WindowsFormsHostAutomationPeer.cs
- WebPartsPersonalization.cs
- HttpContextServiceHost.cs
- LinkLabel.cs
- PropertyChange.cs
- CompositionDesigner.cs
- WebPartDisplayModeCollection.cs
- ExpressionBuilder.cs
- namescope.cs
- XamlStyleSerializer.cs
- SymbolDocumentInfo.cs
- DataBoundControlAdapter.cs
- CancellationToken.cs
- BamlLocalizationDictionary.cs
- BaseParser.cs
- DataGrid.cs
- ToolboxControl.cs
- StylusPlugInCollection.cs
- XmlILIndex.cs
- CircleHotSpot.cs
- TextViewSelectionProcessor.cs
- DetailsViewRow.cs
- HtmlInputControl.cs
- ToggleButton.cs
- SchemaImporterExtensionElementCollection.cs
- AtomPub10ServiceDocumentFormatter.cs
- recordstatescratchpad.cs
- CorePropertiesFilter.cs