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
- DateTimeConverter.cs
- PixelShader.cs
- HwndTarget.cs
- GetPageNumberCompletedEventArgs.cs
- BuildManagerHost.cs
- SplineKeyFrames.cs
- ActivityExecutionContext.cs
- ExceptionAggregator.cs
- SoapAttributeAttribute.cs
- WindowsFormsDesignerOptionService.cs
- DateTimeConstantAttribute.cs
- Adorner.cs
- Monitor.cs
- SignatureHelper.cs
- FastPropertyAccessor.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- StrokeNodeData.cs
- CommandField.cs
- DrawListViewColumnHeaderEventArgs.cs
- PagedDataSource.cs
- VisualBrush.cs
- PageCatalogPartDesigner.cs
- ConstraintCollection.cs
- ObjectCloneHelper.cs
- FillBehavior.cs
- TriggerActionCollection.cs
- MarkupProperty.cs
- ColumnPropertiesGroup.cs
- HashAlgorithm.cs
- Focus.cs
- UpdateTranslator.cs
- SimpleWebHandlerParser.cs
- BufferedGraphics.cs
- XmlSchemaCompilationSettings.cs
- TcpProcessProtocolHandler.cs
- ExecutionEngineException.cs
- URLMembershipCondition.cs
- ReliableRequestSessionChannel.cs
- WebScriptClientGenerator.cs
- Condition.cs
- DataSourceCacheDurationConverter.cs
- SchemaManager.cs
- Int64Animation.cs
- EventProviderTraceListener.cs
- HyperLink.cs
- SqlInfoMessageEvent.cs
- ELinqQueryState.cs
- WorkflowDesigner.cs
- NamespaceInfo.cs
- SystemTcpConnection.cs
- DefaultAuthorizationContext.cs
- SerializationHelper.cs
- ISFTagAndGuidCache.cs
- ClientSettingsProvider.cs
- datacache.cs
- DoubleAnimationBase.cs
- SystemFonts.cs
- InputLanguageSource.cs
- HttpValueCollection.cs
- Hash.cs
- MulticastDelegate.cs
- Convert.cs
- Resources.Designer.cs
- RepeaterItem.cs
- VersionConverter.cs
- AspNetHostingPermission.cs
- TableLayoutCellPaintEventArgs.cs
- CharStorage.cs
- HwndAppCommandInputProvider.cs
- UTF32Encoding.cs
- CreatingCookieEventArgs.cs
- VarInfo.cs
- TemplateParser.cs
- VerificationAttribute.cs
- TreeNodeCollectionEditor.cs
- ProcessModelInfo.cs
- EntityDataSourceDataSelectionPanel.cs
- FormsAuthenticationEventArgs.cs
- DateTimeSerializationSection.cs
- Error.cs
- MemberAccessException.cs
- PictureBox.cs
- SafeNativeMethodsOther.cs
- SQLInt16Storage.cs
- Type.cs
- FrameworkTemplate.cs
- FormParameter.cs
- ObjectQuery_EntitySqlExtensions.cs
- AnnotationHighlightLayer.cs
- SynchronizingStream.cs
- ObjectDataProvider.cs
- EnumerableRowCollectionExtensions.cs
- messageonlyhwndwrapper.cs
- DuplicateWaitObjectException.cs
- ObjectSet.cs
- SqlSupersetValidator.cs
- LookupBindingPropertiesAttribute.cs
- TransformGroup.cs
- _BaseOverlappedAsyncResult.cs
- EnterpriseServicesHelper.cs