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
- FacetValueContainer.cs
- ImageSource.cs
- MethodMessage.cs
- fixedPageContentExtractor.cs
- ComponentResourceManager.cs
- RequestQueryParser.cs
- invalidudtexception.cs
- Logging.cs
- LocalFileSettingsProvider.cs
- SystemWebSectionGroup.cs
- ListViewGroup.cs
- ProxyElement.cs
- InputMethodStateChangeEventArgs.cs
- Buffer.cs
- UnmanagedMemoryStream.cs
- OdbcConnectionStringbuilder.cs
- EventsTab.cs
- Mapping.cs
- Visitors.cs
- GenericTypeParameterBuilder.cs
- ActivityAction.cs
- SingleStorage.cs
- SmtpClient.cs
- __ConsoleStream.cs
- SourceFileBuildProvider.cs
- IpcManager.cs
- Maps.cs
- TypeSystemProvider.cs
- GeometryGroup.cs
- SQLRoleProvider.cs
- NamespaceDisplay.xaml.cs
- SQLBinary.cs
- Base64Encoding.cs
- ConfigXmlAttribute.cs
- EditorZoneDesigner.cs
- controlskin.cs
- PathSegmentCollection.cs
- PartialList.cs
- DbDataSourceEnumerator.cs
- EventLogInformation.cs
- WindowsListViewSubItem.cs
- TextLineBreak.cs
- counter.cs
- ClientSponsor.cs
- ConcatQueryOperator.cs
- EditingScope.cs
- ProcessModule.cs
- BlockCollection.cs
- CorePropertiesFilter.cs
- PreviewPrintController.cs
- PrivilegedConfigurationManager.cs
- SubMenuStyle.cs
- SctClaimSerializer.cs
- _Win32.cs
- XmlEncoding.cs
- ExpandedWrapper.cs
- FormViewModeEventArgs.cs
- _Events.cs
- RenderingEventArgs.cs
- ServerValidateEventArgs.cs
- BooleanToVisibilityConverter.cs
- XslNumber.cs
- EntityDataSourceView.cs
- DataGridViewCell.cs
- userdatakeys.cs
- TemplatePagerField.cs
- ConfigurationCollectionAttribute.cs
- InlineCollection.cs
- DataGridViewCell.cs
- BamlRecords.cs
- ScrollItemPattern.cs
- AsnEncodedData.cs
- SimpleMailWebEventProvider.cs
- TextServicesDisplayAttributePropertyRanges.cs
- ResourceExpressionBuilder.cs
- LocalizableResourceBuilder.cs
- SmiMetaDataProperty.cs
- XPathDocumentNavigator.cs
- Triangle.cs
- TrackingMemoryStream.cs
- AtomMaterializerLog.cs
- ExpressionEvaluator.cs
- PrintDialogException.cs
- SqlNotificationRequest.cs
- MimeParameterWriter.cs
- MouseGestureConverter.cs
- WindowsHyperlink.cs
- oledbmetadatacollectionnames.cs
- LoginUtil.cs
- ValidateNames.cs
- _NegoStream.cs
- ElementsClipboardData.cs
- WebPartCatalogCloseVerb.cs
- XmlParser.cs
- HttpListenerPrefixCollection.cs
- DefaultValueAttribute.cs
- CodeValidator.cs
- WebServiceFault.cs
- SqlBulkCopyColumnMapping.cs
- EntityConnectionStringBuilder.cs