Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / clr / src / BCL / System / Security / Cryptography / MD5CryptoServiceProvider.cs / 1 / MD5CryptoServiceProvider.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // MD5CryptoServiceProvider.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public sealed class MD5CryptoServiceProvider : MD5 { private SafeHashHandle _safeHashHandle = null; // // public constructors // public MD5CryptoServiceProvider() { if (Utils.FipsAlgorithmPolicy == 1) throw new InvalidOperationException(Environment.GetResourceString("Cryptography_NonCompliantFIPSAlgorithm")); SafeHashHandle safeHashHandle = SafeHashHandle.InvalidHandle; // _CreateHash will check for failures and throw the appropriate exception Utils._CreateHash(Utils.StaticProvHandle, Constants.CALG_MD5, ref safeHashHandle); _safeHashHandle = safeHashHandle; } protected override void Dispose(bool disposing) { if (_safeHashHandle != null && !_safeHashHandle.IsClosed) _safeHashHandle.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_MD5, 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. // // ==--== // // MD5CryptoServiceProvider.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public sealed class MD5CryptoServiceProvider : MD5 { private SafeHashHandle _safeHashHandle = null; // // public constructors // public MD5CryptoServiceProvider() { if (Utils.FipsAlgorithmPolicy == 1) throw new InvalidOperationException(Environment.GetResourceString("Cryptography_NonCompliantFIPSAlgorithm")); SafeHashHandle safeHashHandle = SafeHashHandle.InvalidHandle; // _CreateHash will check for failures and throw the appropriate exception Utils._CreateHash(Utils.StaticProvHandle, Constants.CALG_MD5, ref safeHashHandle); _safeHashHandle = safeHashHandle; } protected override void Dispose(bool disposing) { if (_safeHashHandle != null && !_safeHashHandle.IsClosed) _safeHashHandle.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_MD5, 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
- ToolStripDropDown.cs
- RegexTypeEditor.cs
- UIPermission.cs
- Rectangle.cs
- SafeTimerHandle.cs
- PopupEventArgs.cs
- XmlAttributeAttribute.cs
- ListView.cs
- AcceleratedTokenAuthenticator.cs
- CFStream.cs
- ManagementPath.cs
- ContentType.cs
- Matrix3DValueSerializer.cs
- StatusBarPanel.cs
- ComponentChangedEvent.cs
- httpapplicationstate.cs
- NotImplementedException.cs
- ObjectCacheHost.cs
- StagingAreaInputItem.cs
- TraceUtils.cs
- COAUTHINFO.cs
- Native.cs
- CollectionViewProxy.cs
- _Semaphore.cs
- SQLInt16Storage.cs
- ObjectSecurity.cs
- SelectionChangedEventArgs.cs
- Tablet.cs
- DateRangeEvent.cs
- XmlDataImplementation.cs
- IntegerFacetDescriptionElement.cs
- CompModSwitches.cs
- SendReply.cs
- CapiHashAlgorithm.cs
- RuleProcessor.cs
- LabelEditEvent.cs
- PropertyDescriptor.cs
- ParserContext.cs
- TextTreeInsertUndoUnit.cs
- AutoFocusStyle.xaml.cs
- MemberAccessException.cs
- ToolTipAutomationPeer.cs
- MasterPageParser.cs
- FixedPageAutomationPeer.cs
- SqlUserDefinedTypeAttribute.cs
- StaticSiteMapProvider.cs
- ObjectConverter.cs
- TemplateKeyConverter.cs
- WeakReferenceList.cs
- ToolStripManager.cs
- SQLDecimalStorage.cs
- LoadRetryConstantStrategy.cs
- CapabilitiesUse.cs
- XamlBrushSerializer.cs
- OverlappedContext.cs
- Odbc32.cs
- ToolStripItemDesigner.cs
- SqlDataSource.cs
- UnmanagedMemoryStream.cs
- SwitchAttribute.cs
- EntitySqlQueryBuilder.cs
- CustomErrorsSection.cs
- ResolveCriteria.cs
- ChunkedMemoryStream.cs
- CachedFontFamily.cs
- EntityTransaction.cs
- ActiveDocumentEvent.cs
- Errors.cs
- SecurityElement.cs
- XmlDataContract.cs
- AlphabetConverter.cs
- TextCompositionManager.cs
- TraceFilter.cs
- TextEffectResolver.cs
- TerminateSequenceResponse.cs
- Effect.cs
- ISFClipboardData.cs
- MediaSystem.cs
- GridViewRowCollection.cs
- shaperfactoryquerycachekey.cs
- util.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- TemplatedMailWebEventProvider.cs
- WebPartHeaderCloseVerb.cs
- DataTemplateKey.cs
- Journaling.cs
- PhoneCallDesigner.cs
- DrawingContextWalker.cs
- GPPOINT.cs
- DataRecordInfo.cs
- RadioButtonStandardAdapter.cs
- DataGridViewAdvancedBorderStyle.cs
- RunInstallerAttribute.cs
- StatusBarItemAutomationPeer.cs
- MenuItem.cs
- Console.cs
- SchemaLookupTable.cs
- XmlDataImplementation.cs
- CacheVirtualItemsEvent.cs
- InputManager.cs