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
- SQLString.cs
- Button.cs
- PersonalizationProvider.cs
- FieldBuilder.cs
- PropertyHelper.cs
- AssemblyInfo.cs
- SplitterCancelEvent.cs
- MDIClient.cs
- ResizeGrip.cs
- ManifestBasedResourceGroveler.cs
- TableItemProviderWrapper.cs
- ProxyManager.cs
- ClientRoleProvider.cs
- PrintDocument.cs
- MDIWindowDialog.cs
- SectionXmlInfo.cs
- UIElementPropertyUndoUnit.cs
- BindingWorker.cs
- TdsEnums.cs
- Camera.cs
- ErrorLog.cs
- EntityFrameworkVersions.cs
- DetailsView.cs
- CodeCatchClause.cs
- XPathNodePointer.cs
- Atom10FormatterFactory.cs
- SemaphoreSecurity.cs
- DefaultTextStoreTextComposition.cs
- MatrixTransform3D.cs
- XmlChoiceIdentifierAttribute.cs
- SimpleWebHandlerParser.cs
- ArraySet.cs
- Translator.cs
- ResolveNameEventArgs.cs
- TextRangeAdaptor.cs
- DataGridViewCellCollection.cs
- PointHitTestResult.cs
- EncoderBestFitFallback.cs
- HashSetEqualityComparer.cs
- RequestCacheManager.cs
- ActivityXRefConverter.cs
- ThumbButtonInfoCollection.cs
- QuadraticBezierSegment.cs
- InheritanceAttribute.cs
- XmlSiteMapProvider.cs
- DataControlFieldHeaderCell.cs
- DataTable.cs
- XmlAttribute.cs
- AspNetSynchronizationContext.cs
- Sequence.cs
- XmlSchemaInclude.cs
- DataGridViewTextBoxColumn.cs
- XmlQualifiedName.cs
- Frame.cs
- MatcherBuilder.cs
- FormsAuthenticationCredentials.cs
- ParameterBinding.cs
- DoubleCollectionConverter.cs
- CreateParams.cs
- OrthographicCamera.cs
- ClaimTypeElementCollection.cs
- SqlTransaction.cs
- DelegatingHeader.cs
- DbConnectionPool.cs
- RelatedView.cs
- RijndaelManagedTransform.cs
- LinearKeyFrames.cs
- VerticalAlignConverter.cs
- ErrorRuntimeConfig.cs
- MenuItemStyle.cs
- EncodingStreamWrapper.cs
- TaskFormBase.cs
- FontWeight.cs
- WebPartCollection.cs
- SimpleTypeResolver.cs
- RSAProtectedConfigurationProvider.cs
- FacetChecker.cs
- StylusPointProperty.cs
- IsolationInterop.cs
- ArrayConverter.cs
- SdlChannelSink.cs
- WebReferenceCollection.cs
- TrackingMemoryStream.cs
- HandledEventArgs.cs
- BypassElement.cs
- GcSettings.cs
- WebPartConnectionsEventArgs.cs
- StrongNameUtility.cs
- ErrorTableItemStyle.cs
- TopClause.cs
- DefaultBindingPropertyAttribute.cs
- ContextStaticAttribute.cs
- MetadataUtil.cs
- DataGridViewCellStateChangedEventArgs.cs
- TypeLoadException.cs
- ConfigurationProperty.cs
- Scripts.cs
- ConnectionStringsSection.cs
- PriorityBinding.cs
- NonClientArea.cs