Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- Brush.cs
- TaiwanLunisolarCalendar.cs
- Vector3dCollection.cs
- CommandID.cs
- MessageSecurityProtocol.cs
- DateBoldEvent.cs
- TransformerConfigurationWizardBase.cs
- DrawingCollection.cs
- IntegrationExceptionEventArgs.cs
- MenuAdapter.cs
- SafeCancelMibChangeNotify.cs
- VSWCFServiceContractGenerator.cs
- Token.cs
- DbProviderFactory.cs
- InstalledFontCollection.cs
- NamespaceListProperty.cs
- SecurityRuntime.cs
- PaperSource.cs
- DataGrid.cs
- TypeAccessException.cs
- ComponentCollection.cs
- DescendantOverDescendantQuery.cs
- ListViewGroupCollectionEditor.cs
- SByte.cs
- Pts.cs
- CommandHelper.cs
- EntityContainerEntitySet.cs
- KernelTypeValidation.cs
- CompiledIdentityConstraint.cs
- HttpHandler.cs
- LinkDesigner.cs
- FlowLayout.cs
- XmlDomTextWriter.cs
- JournalEntry.cs
- RegexGroupCollection.cs
- LocatorGroup.cs
- EndEvent.cs
- ServiceModelActivity.cs
- TimeSpanValidatorAttribute.cs
- ItemType.cs
- HttpCookie.cs
- ThreadStaticAttribute.cs
- BrowsableAttribute.cs
- ReferenceConverter.cs
- PropertyMapper.cs
- GridViewColumnHeaderAutomationPeer.cs
- SecurityContext.cs
- SocketException.cs
- ScopelessEnumAttribute.cs
- GrammarBuilderWildcard.cs
- DiscardableAttribute.cs
- PathGradientBrush.cs
- KeyPullup.cs
- GradientBrush.cs
- ManagementDateTime.cs
- AuthenticationServiceManager.cs
- Menu.cs
- CounterSample.cs
- XmlDocumentType.cs
- AppDomain.cs
- SerialErrors.cs
- MultipleCopiesCollection.cs
- AutoScrollHelper.cs
- HtmlTableRow.cs
- WebPartConnectionsCancelEventArgs.cs
- ExtensionFile.cs
- CodeTypeReferenceExpression.cs
- SaveRecipientRequest.cs
- MobileTemplatedControlDesigner.cs
- ProfileEventArgs.cs
- SqlTrackingQuery.cs
- RuleSettingsCollection.cs
- PeekCompletedEventArgs.cs
- HotSpot.cs
- JoinTreeNode.cs
- HostedElements.cs
- GeometryGroup.cs
- InputProcessorProfilesLoader.cs
- ReachFixedDocumentSerializerAsync.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- ToolStripMenuItem.cs
- SqlRetyper.cs
- DynamicMethod.cs
- ArraySegment.cs
- CustomWebEventKey.cs
- _ConnectionGroup.cs
- SingleObjectCollection.cs
- SQLInt32Storage.cs
- FrameworkRichTextComposition.cs
- SessionStateModule.cs
- TransactionCache.cs
- ReadOnlyCollection.cs
- TextDecoration.cs
- RotationValidation.cs
- ServerValidateEventArgs.cs
- UIPermission.cs
- XmlDocumentFragment.cs
- HttpModulesSection.cs
- XamlTreeBuilderBamlRecordWriter.cs
- XmlSchemaObjectCollection.cs