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
- ListView.cs
- Transform3DGroup.cs
- BooleanKeyFrameCollection.cs
- AssociationSetMetadata.cs
- RuntimeArgument.cs
- _UriSyntax.cs
- LoginViewDesigner.cs
- PartitionerStatic.cs
- SocketPermission.cs
- CacheMemory.cs
- PopupControlService.cs
- OleDbConnectionInternal.cs
- DesignerView.xaml.cs
- DataGridViewCellFormattingEventArgs.cs
- TraceHandler.cs
- AuthenticateEventArgs.cs
- RegistryKey.cs
- SchemaImporter.cs
- CodeTypeConstructor.cs
- DocumentViewerBaseAutomationPeer.cs
- MappingException.cs
- TracePayload.cs
- Point.cs
- DataGridViewColumnCollectionEditor.cs
- SmtpFailedRecipientException.cs
- ChangeNode.cs
- ScrollViewerAutomationPeer.cs
- TextRange.cs
- isolationinterop.cs
- AttachedAnnotationChangedEventArgs.cs
- WebPartDisplayModeCancelEventArgs.cs
- ErrorEventArgs.cs
- ConstructorBuilder.cs
- PathTooLongException.cs
- DoubleKeyFrameCollection.cs
- CacheOutputQuery.cs
- SqlRowUpdatingEvent.cs
- Privilege.cs
- MetadataItemCollectionFactory.cs
- UpdateTracker.cs
- Rights.cs
- FocusChangedEventArgs.cs
- StaticExtension.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- CodeTypeMemberCollection.cs
- WmlLiteralTextAdapter.cs
- RegexWorker.cs
- ValidateNames.cs
- ScriptingWebServicesSectionGroup.cs
- XmlText.cs
- UIElementParagraph.cs
- StoreItemCollection.Loader.cs
- SequenceDesigner.cs
- TaskForm.cs
- ResourcesChangeInfo.cs
- sqlser.cs
- TraceContextRecord.cs
- TimeoutConverter.cs
- DockPatternIdentifiers.cs
- LicenseManager.cs
- StyleHelper.cs
- XmlComment.cs
- DocobjHost.cs
- GlyphRunDrawing.cs
- RequestQueryParser.cs
- Input.cs
- Positioning.cs
- ColumnResizeAdorner.cs
- XmlWhitespace.cs
- SmtpSection.cs
- DataBinding.cs
- HotSpotCollection.cs
- errorpatternmatcher.cs
- FocusTracker.cs
- EncryptedKey.cs
- StylusButtonCollection.cs
- ListBase.cs
- Point4DValueSerializer.cs
- SystemUnicastIPAddressInformation.cs
- XsltLoader.cs
- EndpointAddressElementBase.cs
- ThicknessAnimationBase.cs
- XmlExtensionFunction.cs
- StringAttributeCollection.cs
- HttpFileCollection.cs
- ModulesEntry.cs
- InlineCollection.cs
- ValidatingPropertiesEventArgs.cs
- StrokeNodeOperations.cs
- URLString.cs
- FilterInvalidBodyAccessException.cs
- StylusLogic.cs
- TextFormatter.cs
- PresentationTraceSources.cs
- OracleDataReader.cs
- PtsHelper.cs
- XmlSchemas.cs
- DispatcherExceptionEventArgs.cs
- SqlSelectStatement.cs
- MenuItemStyle.cs