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
- SchemaObjectWriter.cs
- ListViewTableRow.cs
- ErrorEventArgs.cs
- PermissionToken.cs
- NameTable.cs
- safemediahandle.cs
- _AcceptOverlappedAsyncResult.cs
- WindowsGraphics2.cs
- SystemWebCachingSectionGroup.cs
- KeyPressEvent.cs
- WsdlInspector.cs
- ToolStripProgressBar.cs
- DynamicHyperLink.cs
- XhtmlBasicPageAdapter.cs
- XmlWrappingReader.cs
- Assert.cs
- HttpCachePolicy.cs
- ZoomPercentageConverter.cs
- HtmlElementErrorEventArgs.cs
- SEHException.cs
- HandleCollector.cs
- _ListenerRequestStream.cs
- KeyInfo.cs
- AnimatedTypeHelpers.cs
- IdentityNotMappedException.cs
- PageParserFilter.cs
- PopupControlService.cs
- WindowsFormsSectionHandler.cs
- Pts.cs
- _SslSessionsCache.cs
- Bits.cs
- DataObjectFieldAttribute.cs
- CharConverter.cs
- WebPartUserCapability.cs
- UpdatePanelTriggerCollection.cs
- KeySplineConverter.cs
- FragmentQueryKB.cs
- SqlDataSourceSelectingEventArgs.cs
- IMembershipProvider.cs
- LineVisual.cs
- SizeChangedInfo.cs
- StrongTypingException.cs
- ScriptReferenceBase.cs
- NameValueCollection.cs
- XpsTokenContext.cs
- RsaSecurityTokenParameters.cs
- UntrustedRecipientException.cs
- ColorPalette.cs
- Italic.cs
- Pkcs7Recipient.cs
- DataSysAttribute.cs
- RuntimeConfigurationRecord.cs
- DoubleUtil.cs
- TargetPerspective.cs
- ViewStateModeByIdAttribute.cs
- FieldTemplateFactory.cs
- RoleGroup.cs
- EventDescriptor.cs
- FixedPageStructure.cs
- SqlAliaser.cs
- CustomErrorsSection.cs
- HttpException.cs
- OutputCacheProfile.cs
- ACL.cs
- HttpHeaderCollection.cs
- Blend.cs
- CharConverter.cs
- Decimal.cs
- BaseCAMarshaler.cs
- FreezableOperations.cs
- BaseProcessor.cs
- OleDbStruct.cs
- TextParaLineResult.cs
- FixUp.cs
- NetMsmqSecurity.cs
- ListenerBinder.cs
- TreeSet.cs
- ellipse.cs
- OverlappedAsyncResult.cs
- ObservableDictionary.cs
- WebControlsSection.cs
- EventlogProvider.cs
- XamlFigureLengthSerializer.cs
- MimeFormatter.cs
- DragCompletedEventArgs.cs
- ContourSegment.cs
- SvcMapFileLoader.cs
- Form.cs
- DCSafeHandle.cs
- Task.cs
- Keyboard.cs
- TimerElapsedEvenArgs.cs
- PresentationAppDomainManager.cs
- ToolStripMenuItem.cs
- XmlSchemaImporter.cs
- TextElementEnumerator.cs
- MsmqIntegrationProcessProtocolHandler.cs
- smtpconnection.cs
- ObjectCloneHelper.cs
- AddInProcess.cs