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
- BookmarkScopeInfo.cs
- ValueUnavailableException.cs
- VisualBasicSettingsHandler.cs
- App.cs
- OleAutBinder.cs
- RepeaterItem.cs
- TemplatedControlDesigner.cs
- Msec.cs
- WebPartConnectionsCancelEventArgs.cs
- TextEndOfParagraph.cs
- SQLInt64.cs
- Utils.cs
- ProtocolInformationWriter.cs
- PositiveTimeSpanValidatorAttribute.cs
- ContractMapping.cs
- MembershipPasswordException.cs
- CmsInterop.cs
- CurrentChangedEventManager.cs
- NextPreviousPagerField.cs
- NumberSubstitution.cs
- ConnectionPoint.cs
- CodeDirectoryCompiler.cs
- ChineseLunisolarCalendar.cs
- FontCollection.cs
- SingleResultAttribute.cs
- RetrieveVirtualItemEventArgs.cs
- ObjectPropertyMapping.cs
- IntPtr.cs
- CollectionEditor.cs
- GridViewDesigner.cs
- StoryFragments.cs
- AccessControlList.cs
- SortFieldComparer.cs
- EmptyWithCancelationCheckWorkItem.cs
- TripleDESCryptoServiceProvider.cs
- TrackingStringDictionary.cs
- Vector3DAnimation.cs
- BlurEffect.cs
- SelectionUIService.cs
- ConfigurationValidatorBase.cs
- MetadataItemCollectionFactory.cs
- InitializerFacet.cs
- DBParameter.cs
- HwndTarget.cs
- itemelement.cs
- SapiGrammar.cs
- EdmRelationshipRoleAttribute.cs
- SqlSupersetValidator.cs
- Camera.cs
- ReferenceEqualityComparer.cs
- HtmlElementErrorEventArgs.cs
- SmiMetaData.cs
- DecoderNLS.cs
- CodeDomSerializerException.cs
- HttpPostClientProtocol.cs
- AllMembershipCondition.cs
- PreloadedPackages.cs
- CaseExpr.cs
- ParameterModifier.cs
- DataColumnPropertyDescriptor.cs
- GridViewDeleteEventArgs.cs
- NetMsmqSecurityMode.cs
- NotifyIcon.cs
- Decorator.cs
- PropertyMetadata.cs
- MimeWriter.cs
- PolyBezierSegment.cs
- SingleObjectCollection.cs
- CodeBlockBuilder.cs
- XmlCustomFormatter.cs
- DropShadowEffect.cs
- DataServiceRequest.cs
- HttpProfileBase.cs
- TrustManagerMoreInformation.cs
- BroadcastEventHelper.cs
- EncodingTable.cs
- StorageConditionPropertyMapping.cs
- ChildDocumentBlock.cs
- MsmqTransportBindingElement.cs
- MsmqInputMessage.cs
- DataGridViewTextBoxEditingControl.cs
- RootBrowserWindowProxy.cs
- ObjectView.cs
- BinaryExpression.cs
- HttpHandlerActionCollection.cs
- ListCommandEventArgs.cs
- DictionarySurrogate.cs
- Aggregates.cs
- CqlLexerHelpers.cs
- CodeMemberProperty.cs
- SerializationObjectManager.cs
- StylusPlugin.cs
- AutoSizeComboBox.cs
- SiteOfOriginContainer.cs
- And.cs
- DesignerSerializationVisibilityAttribute.cs
- DataGridViewComboBoxCell.cs
- Process.cs
- InputLangChangeEvent.cs
- UnsafeNativeMethods.cs