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
- GradientBrush.cs
- JsonClassDataContract.cs
- ClientProtocol.cs
- RewritingValidator.cs
- HttpVersion.cs
- TextFormatterImp.cs
- QuaternionAnimation.cs
- WebPart.cs
- TextCompositionManager.cs
- ToggleProviderWrapper.cs
- DriveInfo.cs
- MethodToken.cs
- _NetworkingPerfCounters.cs
- DataFormats.cs
- Menu.cs
- HttpApplication.cs
- Size3DConverter.cs
- OdbcEnvironment.cs
- ContentTextAutomationPeer.cs
- SymbolEqualComparer.cs
- HtmlInputSubmit.cs
- FormViewCommandEventArgs.cs
- CopyAction.cs
- EnvelopedSignatureTransform.cs
- ParameterInfo.cs
- WebConfigurationManager.cs
- Container.cs
- Profiler.cs
- SevenBitStream.cs
- CapabilitiesPattern.cs
- CultureTableRecord.cs
- Label.cs
- Material.cs
- DecoderBestFitFallback.cs
- EdgeProfileValidation.cs
- VirtualDirectoryMapping.cs
- TypeContext.cs
- Claim.cs
- WebPartTransformerAttribute.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ZoneIdentityPermission.cs
- WindowHelperService.cs
- PropertyPath.cs
- DllNotFoundException.cs
- ProgressBarRenderer.cs
- Assembly.cs
- ToolStripDropDownItem.cs
- OrderingExpression.cs
- InputLanguageProfileNotifySink.cs
- List.cs
- SafeTokenHandle.cs
- UrlRoutingModule.cs
- UidPropertyAttribute.cs
- TextTreeInsertUndoUnit.cs
- MemberRelationshipService.cs
- BaseResourcesBuildProvider.cs
- PrintDialogException.cs
- Message.cs
- Msec.cs
- LinqDataSourceEditData.cs
- LicenseProviderAttribute.cs
- ColorContextHelper.cs
- EditorServiceContext.cs
- TransformerInfo.cs
- NetworkInterface.cs
- bindurihelper.cs
- DataObject.cs
- WebConfigurationManager.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- ViewPort3D.cs
- Glyph.cs
- ConstantExpression.cs
- CodeAccessPermission.cs
- HScrollBar.cs
- StdValidatorsAndConverters.cs
- DesignerAutoFormat.cs
- TcpClientChannel.cs
- FormattedText.cs
- recordstate.cs
- XPathNavigatorReader.cs
- ServiceBehaviorElement.cs
- TranslateTransform3D.cs
- DispatcherEventArgs.cs
- WSSecurityPolicy12.cs
- TextInfo.cs
- ExpressionTable.cs
- DataIdProcessor.cs
- WebBrowserBase.cs
- UshortList2.cs
- BinaryObjectInfo.cs
- PixelShader.cs
- WpfWebRequestHelper.cs
- SymmetricAlgorithm.cs
- VerticalAlignConverter.cs
- GlyphRunDrawing.cs
- PersonalizationDictionary.cs
- HttpStreams.cs
- WebContext.cs
- LayoutEngine.cs
- RecognitionResult.cs