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
- ProtectedConfigurationProviderCollection.cs
- LinqMaximalSubtreeNominator.cs
- TextRange.cs
- StdRegProviderWrapper.cs
- SR.cs
- ObjectDataSourceChooseMethodsPanel.cs
- LoginName.cs
- HttpInputStream.cs
- DetailsViewModeEventArgs.cs
- ExpressionWriter.cs
- XmlSchemaIdentityConstraint.cs
- ObjectTokenCategory.cs
- ContentHostHelper.cs
- ServiceReference.cs
- VectorCollection.cs
- ActiveXContainer.cs
- TraceProvider.cs
- Brush.cs
- QueryRewriter.cs
- ResourceIDHelper.cs
- DataTemplateKey.cs
- XmlExpressionDumper.cs
- WindowsGraphicsWrapper.cs
- WeakReference.cs
- ScrollItemProviderWrapper.cs
- GridSplitterAutomationPeer.cs
- baseaxisquery.cs
- StorageRoot.cs
- IssuanceLicense.cs
- ClientScriptManager.cs
- TabControlAutomationPeer.cs
- SizeAnimationUsingKeyFrames.cs
- Internal.cs
- WebReferencesBuildProvider.cs
- UIntPtr.cs
- TrackPoint.cs
- Config.cs
- WeakReadOnlyCollection.cs
- WbemProvider.cs
- ColorAnimation.cs
- XmlCharType.cs
- EntitySetRetriever.cs
- RtfControls.cs
- VersionedStreamOwner.cs
- Serializer.cs
- SudsParser.cs
- XLinq.cs
- Point.cs
- VectorKeyFrameCollection.cs
- MouseActionConverter.cs
- XmlSerializerFactory.cs
- IdentitySection.cs
- KeyPressEvent.cs
- ReadOnlyDictionary.cs
- VirtualPathUtility.cs
- SafeUserTokenHandle.cs
- Vector3DCollectionConverter.cs
- NegotiateStream.cs
- RNGCryptoServiceProvider.cs
- BitmapEffect.cs
- AccessKeyManager.cs
- AbstractExpressions.cs
- EraserBehavior.cs
- ManagementPath.cs
- Keywords.cs
- ConfigurationManagerHelper.cs
- ObjectDataSourceDesigner.cs
- ByteArrayHelperWithString.cs
- SpeechEvent.cs
- HttpListenerContext.cs
- UriScheme.cs
- XmlSchemaSequence.cs
- DivideByZeroException.cs
- BookmarkUndoUnit.cs
- CodeTypeReferenceCollection.cs
- FixedPageAutomationPeer.cs
- ResourceProviderFactory.cs
- KnownTypeHelper.cs
- BookmarkWorkItem.cs
- DesignerProperties.cs
- ClockController.cs
- Timer.cs
- EventManager.cs
- TextTrailingWordEllipsis.cs
- XmlSchemaSimpleContent.cs
- AttributeUsageAttribute.cs
- SecurityTokenSerializer.cs
- TableRowCollection.cs
- BrowserCapabilitiesCodeGenerator.cs
- FixedSOMPageElement.cs
- RestHandlerFactory.cs
- WebPartExportVerb.cs
- DataServiceQueryException.cs
- CharAnimationBase.cs
- IdentityModelStringsVersion1.cs
- XPathConvert.cs
- ProfileManager.cs
- Border.cs
- XPathScanner.cs
- SecurityException.cs