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
- UpdateEventArgs.cs
- Char.cs
- _UriTypeConverter.cs
- SecurityContextSecurityToken.cs
- PenContexts.cs
- Metadata.cs
- XmlSchemaDocumentation.cs
- ThreadExceptionDialog.cs
- TypedTableBase.cs
- WaitHandleCannotBeOpenedException.cs
- InstancePersistenceEvent.cs
- RegexRunnerFactory.cs
- TypeSystemHelpers.cs
- ExtenderControl.cs
- ToolboxItemCollection.cs
- BindingExpressionUncommonField.cs
- SaveCardRequest.cs
- BamlMapTable.cs
- SystemTcpStatistics.cs
- DictionaryContent.cs
- DbConnectionPoolGroupProviderInfo.cs
- BitStack.cs
- ActionFrame.cs
- TextFormatterImp.cs
- Point3DCollectionValueSerializer.cs
- DispatcherExceptionFilterEventArgs.cs
- DataSourceProvider.cs
- HttpResponseBase.cs
- Freezable.cs
- TransformationRules.cs
- MobileControlDesigner.cs
- DataTemplate.cs
- ScriptResourceHandler.cs
- FileStream.cs
- DispatcherProcessingDisabled.cs
- TypeReference.cs
- SvcMapFileSerializer.cs
- MouseGesture.cs
- StyleBamlTreeBuilder.cs
- DataGridViewButtonCell.cs
- EpmSourceTree.cs
- PageWrapper.cs
- TcpServerChannel.cs
- EUCJPEncoding.cs
- SupportsEventValidationAttribute.cs
- AccessControlEntry.cs
- DocumentXPathNavigator.cs
- XmlSchemaObject.cs
- HandlerElementCollection.cs
- XmlSchemas.cs
- ManipulationDeltaEventArgs.cs
- TripleDESCryptoServiceProvider.cs
- PointValueSerializer.cs
- QilList.cs
- mansign.cs
- TraceSection.cs
- ConfigurationLocationCollection.cs
- TagPrefixAttribute.cs
- HMACSHA256.cs
- PropertyBuilder.cs
- QuarticEase.cs
- DecimalAnimationUsingKeyFrames.cs
- SupportsPreviewControlAttribute.cs
- FieldMetadata.cs
- ValueOfAction.cs
- MimeAnyImporter.cs
- DoubleAnimation.cs
- PathFigure.cs
- IdentityModelDictionary.cs
- MappedMetaModel.cs
- GeneralTransform3DTo2DTo3D.cs
- WmlListAdapter.cs
- Misc.cs
- Misc.cs
- StickyNoteHelper.cs
- ImageFormatConverter.cs
- MatrixStack.cs
- HttpAsyncResult.cs
- DataControlLinkButton.cs
- CTreeGenerator.cs
- Frame.cs
- updateconfighost.cs
- FtpCachePolicyElement.cs
- SqlDataSourceView.cs
- TimeEnumHelper.cs
- MembershipValidatePasswordEventArgs.cs
- PreviewPageInfo.cs
- PathSegmentCollection.cs
- EntityStoreSchemaGenerator.cs
- RuntimeResourceSet.cs
- QuaternionValueSerializer.cs
- UnauthorizedWebPart.cs
- SerializableTypeCodeDomSerializer.cs
- XmlILStorageConverter.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- X509UI.cs
- ToolStripItem.cs
- ValidatingReaderNodeData.cs
- ProviderCollection.cs
- XmlWhitespace.cs