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
- PageHandlerFactory.cs
- PageBorderless.cs
- DefaultParameterValueAttribute.cs
- CommandEventArgs.cs
- RequestBringIntoViewEventArgs.cs
- DesignerRegion.cs
- DBDataPermissionAttribute.cs
- SizeIndependentAnimationStorage.cs
- MarginCollapsingState.cs
- Transform3D.cs
- XmlValueConverter.cs
- XmlDataProvider.cs
- EpmCustomContentDeSerializer.cs
- RegisteredScript.cs
- FileStream.cs
- ComboBox.cs
- VirtualPathData.cs
- Attributes.cs
- ComponentGlyph.cs
- AuthStoreRoleProvider.cs
- bidPrivateBase.cs
- ClientFormsAuthenticationCredentials.cs
- ApplicationTrust.cs
- DefaultObjectMappingItemCollection.cs
- SecurityContextSecurityToken.cs
- TypeGeneratedEventArgs.cs
- RowTypeElement.cs
- Bold.cs
- StreamUpdate.cs
- EntitySetRetriever.cs
- RSAProtectedConfigurationProvider.cs
- WebServiceTypeData.cs
- HostedHttpTransportManager.cs
- EqualityComparer.cs
- KeyEvent.cs
- DrawTreeNodeEventArgs.cs
- MediaTimeline.cs
- TransactionFlowProperty.cs
- Expression.cs
- XdrBuilder.cs
- ObjectKeyFrameCollection.cs
- TemplateControlBuildProvider.cs
- AccessorTable.cs
- SqlDataSourceAdvancedOptionsForm.cs
- CommandPlan.cs
- ReadonlyMessageFilter.cs
- _NetRes.cs
- MsmqIntegrationBindingElement.cs
- Context.cs
- SoapSchemaExporter.cs
- CollectionBuilder.cs
- RemotingConfiguration.cs
- ToolStripSplitButton.cs
- Odbc32.cs
- ObjectItemCollection.cs
- GridViewCellAutomationPeer.cs
- CodeTryCatchFinallyStatement.cs
- DiscoveryClientDuplexChannel.cs
- SchemaElementDecl.cs
- TypeHelpers.cs
- ClosureBinding.cs
- GB18030Encoding.cs
- ColorMap.cs
- RoutedEvent.cs
- SQLBytes.cs
- SQLResource.cs
- AssemblyAssociatedContentFileAttribute.cs
- LogicalExpressionEditor.cs
- CompiledRegexRunner.cs
- SystemIcmpV6Statistics.cs
- DbgCompiler.cs
- XmlMapping.cs
- ConfigurationValidatorBase.cs
- AppDomainProtocolHandler.cs
- DoubleCollectionConverter.cs
- TextWriterTraceListener.cs
- DbMetaDataCollectionNames.cs
- ScrollPatternIdentifiers.cs
- Interfaces.cs
- XmlSchemaParticle.cs
- MDIWindowDialog.cs
- SudsWriter.cs
- Publisher.cs
- ToolStripDropDownMenu.cs
- DiscoveryExceptionDictionary.cs
- KnownColorTable.cs
- oledbmetadatacollectionnames.cs
- IList.cs
- ResourceDescriptionAttribute.cs
- ArraySegment.cs
- DependencyPropertyChangedEventArgs.cs
- CustomErrorsSection.cs
- TransactionScope.cs
- DataGridRowHeaderAutomationPeer.cs
- ComplexType.cs
- Stylesheet.cs
- RuntimeHandles.cs
- ButtonField.cs
- Wildcard.cs
- ValidationResult.cs