Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- Privilege.cs
- DropShadowEffect.cs
- SqlProviderUtilities.cs
- WebSysDescriptionAttribute.cs
- xdrvalidator.cs
- MDIControlStrip.cs
- SspiNegotiationTokenAuthenticatorState.cs
- EncodingDataItem.cs
- DbException.cs
- MetaType.cs
- NativeMethods.cs
- CharacterMetrics.cs
- RouteItem.cs
- TransactionTable.cs
- LingerOption.cs
- CheckBoxAutomationPeer.cs
- ContainerVisual.cs
- JavaScriptObjectDeserializer.cs
- SqlTopReducer.cs
- WorkflowViewService.cs
- ExceptionUtil.cs
- SecurityElement.cs
- HMACSHA256.cs
- FixedSOMTableRow.cs
- InstanceContext.cs
- DefaultWorkflowLoaderService.cs
- EntityConnection.cs
- MediaTimeline.cs
- dataobject.cs
- DataGridViewSelectedCellCollection.cs
- TextSelectionHighlightLayer.cs
- NullReferenceException.cs
- CommandBinding.cs
- DataTableNewRowEvent.cs
- AnnotationObservableCollection.cs
- SystemWebCachingSectionGroup.cs
- DiagnosticSection.cs
- OutputCacheSettings.cs
- EntityDataSourceViewSchema.cs
- FixedTextView.cs
- SortFieldComparer.cs
- XmlCollation.cs
- GridViewDeletedEventArgs.cs
- SendingRequestEventArgs.cs
- CodeAttributeDeclarationCollection.cs
- DataIdProcessor.cs
- Panel.cs
- ContainerParaClient.cs
- InputChannelAcceptor.cs
- WebReferencesBuildProvider.cs
- XmlWellformedWriterHelpers.cs
- PageClientProxyGenerator.cs
- NonBatchDirectoryCompiler.cs
- BitmapFrame.cs
- FileUtil.cs
- LogFlushAsyncResult.cs
- ColumnCollectionEditor.cs
- ToolStripCodeDomSerializer.cs
- HMACMD5.cs
- TextRunCacheImp.cs
- DesignerPerfEventProvider.cs
- ThreadAbortException.cs
- dsa.cs
- CroppedBitmap.cs
- DbConnectionHelper.cs
- IdleTimeoutMonitor.cs
- OrderedDictionary.cs
- LicenseContext.cs
- HyperLinkStyle.cs
- CompiledQuery.cs
- UnsafeNativeMethodsPenimc.cs
- UnauthorizedWebPart.cs
- SspiWrapper.cs
- MapPathBasedVirtualPathProvider.cs
- XmlImplementation.cs
- EdgeProfileValidation.cs
- wgx_exports.cs
- PnrpPermission.cs
- MaskedTextBoxDesignerActionList.cs
- TrackingValidationObjectDictionary.cs
- WmlPanelAdapter.cs
- UnionExpr.cs
- FormatVersion.cs
- WebPartEditVerb.cs
- Serializer.cs
- RuleSetDialog.Designer.cs
- PresentationSource.cs
- TabletDevice.cs
- TypeConvertions.cs
- NameValueConfigurationCollection.cs
- XmlIncludeAttribute.cs
- DeclarativeExpressionConditionDeclaration.cs
- CacheMemory.cs
- ProcessInfo.cs
- SlotInfo.cs
- EntityDesignerUtils.cs
- TextServicesHost.cs
- LocalizedNameDescriptionPair.cs
- CompensatableTransactionScopeActivity.cs
- AnyAllSearchOperator.cs