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
- ThemeDictionaryExtension.cs
- EditCommandColumn.cs
- ObjectNotFoundException.cs
- SiteMapProvider.cs
- GridViewColumn.cs
- MessageEventSubscriptionService.cs
- CodeVariableDeclarationStatement.cs
- MdiWindowListStrip.cs
- WarningException.cs
- FlowSwitch.cs
- TemplateNameScope.cs
- PropertyTabAttribute.cs
- EventLogPermissionAttribute.cs
- SqlInternalConnection.cs
- DrawListViewSubItemEventArgs.cs
- DrawingServices.cs
- X509Utils.cs
- WebUtil.cs
- StandardBindingElementCollection.cs
- _DigestClient.cs
- UnsafeNativeMethods.cs
- BamlCollectionHolder.cs
- EntityException.cs
- DrawingGroup.cs
- DataServiceQueryException.cs
- SourceItem.cs
- MissingMethodException.cs
- DiagnosticTraceRecords.cs
- WebDisplayNameAttribute.cs
- Attributes.cs
- MembershipSection.cs
- ChildrenQuery.cs
- DataGrid.cs
- LinqDataView.cs
- Condition.cs
- ExpressionValueEditor.cs
- OleDbParameterCollection.cs
- RegistrationServices.cs
- Menu.cs
- XmlObjectSerializerWriteContext.cs
- HtmlTernaryTree.cs
- PeerPresenceInfo.cs
- CheckPair.cs
- CrossAppDomainChannel.cs
- UshortList2.cs
- KeyedCollection.cs
- ToolStripDropDownClosingEventArgs.cs
- RawStylusInput.cs
- GlyphTypeface.cs
- CommandID.cs
- TargetControlTypeAttribute.cs
- LambdaCompiler.Statements.cs
- KeyBinding.cs
- RemoteWebConfigurationHostServer.cs
- SqlConnectionStringBuilder.cs
- EntityContainerRelationshipSetEnd.cs
- MembershipValidatePasswordEventArgs.cs
- CryptoStream.cs
- WindowsPrincipal.cs
- RuntimeIdentifierPropertyAttribute.cs
- ContentType.cs
- CollectionViewGroupRoot.cs
- TextStore.cs
- PKCS1MaskGenerationMethod.cs
- Site.cs
- DateTimeOffset.cs
- configsystem.cs
- UnicodeEncoding.cs
- DesignColumnCollection.cs
- GradientStopCollection.cs
- NumericPagerField.cs
- DataTableExtensions.cs
- SqlRemoveConstantOrderBy.cs
- XPathDocumentBuilder.cs
- XPathQilFactory.cs
- CodeGeneratorOptions.cs
- Win32SafeHandles.cs
- SynchronizedDispatch.cs
- FlowDocument.cs
- DataMemberConverter.cs
- SafeHandle.cs
- UnhandledExceptionEventArgs.cs
- baseaxisquery.cs
- ResourceDisplayNameAttribute.cs
- DocumentXmlWriter.cs
- ErrorHandler.cs
- EntityContainerAssociationSetEnd.cs
- SystemIPInterfaceProperties.cs
- HttpDictionary.cs
- FlowDocumentPage.cs
- TaskDesigner.cs
- FormsAuthenticationConfiguration.cs
- _NTAuthentication.cs
- ConfigurationLocationCollection.cs
- PropertyMappingExceptionEventArgs.cs
- StatusBarPanel.cs
- ShaderEffect.cs
- AndCondition.cs
- SystemColors.cs
- DataSourceXmlAttributeAttribute.cs