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
- BindToObject.cs
- IgnoreSection.cs
- NotificationContext.cs
- ProfilePropertySettings.cs
- BrushMappingModeValidation.cs
- Publisher.cs
- OperandQuery.cs
- PolyLineSegment.cs
- Brush.cs
- RangeValuePatternIdentifiers.cs
- ObjectTypeMapping.cs
- FreezableCollection.cs
- MenuItemCollection.cs
- PowerStatus.cs
- TableChangeProcessor.cs
- ProtocolsConfigurationEntry.cs
- PagesChangedEventArgs.cs
- Attributes.cs
- StylusPointPropertyUnit.cs
- Events.cs
- IListConverters.cs
- IMembershipProvider.cs
- RegexEditorDialog.cs
- GraphicsState.cs
- OleDbError.cs
- StringFreezingAttribute.cs
- SpeechRecognizer.cs
- HtmlTable.cs
- _AcceptOverlappedAsyncResult.cs
- WebPartConnectVerb.cs
- ClientRolePrincipal.cs
- HtmlTitle.cs
- GeneralTransformGroup.cs
- MinMaxParagraphWidth.cs
- WorkflowPersistenceService.cs
- Base64Encoder.cs
- CheckBoxField.cs
- EdgeProfileValidation.cs
- DelimitedListTraceListener.cs
- SetIterators.cs
- NamedPipeTransportElement.cs
- Hex.cs
- LogSwitch.cs
- WindowsGraphicsCacheManager.cs
- PromptBuilder.cs
- SafeProcessHandle.cs
- DesignerLinkAdapter.cs
- PropertyItemInternal.cs
- KeyValuePair.cs
- PageAdapter.cs
- XslNumber.cs
- PersonalizableAttribute.cs
- ViewEventArgs.cs
- OdbcDataReader.cs
- ProtectedConfiguration.cs
- SchemaInfo.cs
- Vector3DAnimation.cs
- DocumentPage.cs
- UnsafeNativeMethodsPenimc.cs
- PopupEventArgs.cs
- Directory.cs
- AttributeAction.cs
- FormatterConverter.cs
- CodeBinaryOperatorExpression.cs
- SocketElement.cs
- ToolBarTray.cs
- TypeRestriction.cs
- TreeWalkHelper.cs
- DelimitedListTraceListener.cs
- SoapInteropTypes.cs
- AddIn.cs
- WindowsAuthenticationModule.cs
- DbConnectionStringCommon.cs
- XamlHostingSectionGroup.cs
- ProcessInfo.cs
- DataViewSetting.cs
- SelectionItemPattern.cs
- BitmapScalingModeValidation.cs
- ObjectDataSourceEventArgs.cs
- DebugView.cs
- ListDesigner.cs
- ComponentEditorForm.cs
- TokenBasedSet.cs
- LocalizationParserHooks.cs
- TransactionFlowBindingElementImporter.cs
- ExtensionQuery.cs
- SequentialActivityDesigner.cs
- JsonServiceDocumentSerializer.cs
- OdbcException.cs
- X509Utils.cs
- BehaviorEditorPart.cs
- SignatureHelper.cs
- WindowAutomationPeer.cs
- OdbcHandle.cs
- CodeRemoveEventStatement.cs
- WorkflowCommandExtensionItem.cs
- DocumentSequenceHighlightLayer.cs
- DoubleCollectionConverter.cs
- DCSafeHandle.cs
- CharStorage.cs