Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Cryptography / MD5CryptoServiceProvider.cs / 1305376 / MD5CryptoServiceProvider.cs
using System.Diagnostics.Contracts;
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// [....]
//
//
// MD5CryptoServiceProvider.cs
//
namespace System.Security.Cryptography {
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class MD5CryptoServiceProvider : MD5 {
[System.Security.SecurityCritical /*auto-generated*/]
private SafeHashHandle _safeHashHandle = null;
//
// public constructors
//
[System.Security.SecuritySafeCritical] // auto-generated
public MD5CryptoServiceProvider() {
if (CryptoConfig.AllowOnlyFipsAlgorithms)
throw new InvalidOperationException(Environment.GetResourceString("Cryptography_NonCompliantFIPSAlgorithm"));
Contract.EndContractBlock();
// _CreateHash will check for failures and throw the appropriate exception
_safeHashHandle = Utils.CreateHash(Utils.StaticProvHandle, Constants.CALG_MD5);
}
[System.Security.SecuritySafeCritical] // overrides public transparent member
protected override void Dispose(bool disposing)
{
if (_safeHashHandle != null && !_safeHashHandle.IsClosed)
_safeHashHandle.Dispose();
base.Dispose(disposing);
}
//
// public methods
//
[System.Security.SecuritySafeCritical] // auto-generated
public override void Initialize() {
if (_safeHashHandle != null && !_safeHashHandle.IsClosed)
_safeHashHandle.Dispose();
// _CreateHash will check for failures and throw the appropriate exception
_safeHashHandle = Utils.CreateHash(Utils.StaticProvHandle, Constants.CALG_MD5);
}
[System.Security.SecuritySafeCritical] // overrides protected transparent member
protected override void HashCore(byte[] rgb, int ibStart, int cbSize)
{
Utils.HashData(_safeHashHandle, rgb, ibStart, cbSize);
}
[System.Security.SecuritySafeCritical] // overrides protected transparent member
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.
using System.Diagnostics.Contracts;
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// [....]
//
//
// MD5CryptoServiceProvider.cs
//
namespace System.Security.Cryptography {
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class MD5CryptoServiceProvider : MD5 {
[System.Security.SecurityCritical /*auto-generated*/]
private SafeHashHandle _safeHashHandle = null;
//
// public constructors
//
[System.Security.SecuritySafeCritical] // auto-generated
public MD5CryptoServiceProvider() {
if (CryptoConfig.AllowOnlyFipsAlgorithms)
throw new InvalidOperationException(Environment.GetResourceString("Cryptography_NonCompliantFIPSAlgorithm"));
Contract.EndContractBlock();
// _CreateHash will check for failures and throw the appropriate exception
_safeHashHandle = Utils.CreateHash(Utils.StaticProvHandle, Constants.CALG_MD5);
}
[System.Security.SecuritySafeCritical] // overrides public transparent member
protected override void Dispose(bool disposing)
{
if (_safeHashHandle != null && !_safeHashHandle.IsClosed)
_safeHashHandle.Dispose();
base.Dispose(disposing);
}
//
// public methods
//
[System.Security.SecuritySafeCritical] // auto-generated
public override void Initialize() {
if (_safeHashHandle != null && !_safeHashHandle.IsClosed)
_safeHashHandle.Dispose();
// _CreateHash will check for failures and throw the appropriate exception
_safeHashHandle = Utils.CreateHash(Utils.StaticProvHandle, Constants.CALG_MD5);
}
[System.Security.SecuritySafeCritical] // overrides protected transparent member
protected override void HashCore(byte[] rgb, int ibStart, int cbSize)
{
Utils.HashData(_safeHashHandle, rgb, ibStart, cbSize);
}
[System.Security.SecuritySafeCritical] // overrides protected transparent member
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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PerspectiveCamera.cs
- RSAOAEPKeyExchangeFormatter.cs
- StateMachineAction.cs
- BasicViewGenerator.cs
- NetworkInformationPermission.cs
- SoapObjectInfo.cs
- ColorContextHelper.cs
- FrameworkContentElement.cs
- SiteMap.cs
- RegistrySecurity.cs
- ObjectAnimationBase.cs
- Substitution.cs
- RemoteX509AsymmetricSecurityKey.cs
- CurrentChangingEventManager.cs
- HttpPostServerProtocol.cs
- UpdateTranslator.cs
- QuotedStringWriteStateInfo.cs
- LazyTextWriterCreator.cs
- ServerValidateEventArgs.cs
- FakeModelPropertyImpl.cs
- Function.cs
- EUCJPEncoding.cs
- HwndSubclass.cs
- MouseGesture.cs
- XPathSingletonIterator.cs
- ListItem.cs
- DoubleCollectionConverter.cs
- Pens.cs
- ConfigXmlWhitespace.cs
- InvalidDataContractException.cs
- PeerNameRecordCollection.cs
- _SSPISessionCache.cs
- WebPartAuthorizationEventArgs.cs
- ResourceIDHelper.cs
- AutoGeneratedFieldProperties.cs
- JoinTreeNode.cs
- AnnotationResourceChangedEventArgs.cs
- MethodCallConverter.cs
- ColorDialog.cs
- TextDecorationLocationValidation.cs
- BuildResult.cs
- ConfigurationPropertyCollection.cs
- TypeUnloadedException.cs
- DbResourceAllocator.cs
- SqlTypeSystemProvider.cs
- MSAAWinEventWrap.cs
- ScriptIgnoreAttribute.cs
- DrawingDrawingContext.cs
- XmlSerializerNamespaces.cs
- StrongName.cs
- TableLayoutStyle.cs
- SystemIPInterfaceStatistics.cs
- Exceptions.cs
- SHA384Cng.cs
- Point3DIndependentAnimationStorage.cs
- X509CertificateCollection.cs
- NotImplementedException.cs
- RegistrationServices.cs
- InitializingNewItemEventArgs.cs
- SecurityTokenRequirement.cs
- DependencyObjectType.cs
- SQLBinaryStorage.cs
- ConfigurationLocationCollection.cs
- DeploymentSectionCache.cs
- AutoGeneratedFieldProperties.cs
- BookmarkScopeInfo.cs
- GroupLabel.cs
- MemberInitExpression.cs
- Choices.cs
- _SslStream.cs
- VariantWrapper.cs
- AdapterSwitches.cs
- SmtpNetworkElement.cs
- SerializableAttribute.cs
- OleDbRowUpdatedEvent.cs
- TextAction.cs
- CodeNamespaceCollection.cs
- DataError.cs
- ObjectRef.cs
- MessageQueueEnumerator.cs
- EventLogger.cs
- UnsafeCollabNativeMethods.cs
- DataControlFieldCollection.cs
- DrawingCollection.cs
- ReachIDocumentPaginatorSerializerAsync.cs
- PagesSection.cs
- ListViewCancelEventArgs.cs
- FixedSchema.cs
- CollectionsUtil.cs
- StyleCollection.cs
- __ComObject.cs
- NativeMethods.cs
- Point.cs
- IsolatedStorageFile.cs
- GreenMethods.cs
- GridViewHeaderRowPresenter.cs
- coordinatorfactory.cs
- CultureSpecificCharacterBufferRange.cs
- DataBindingCollectionEditor.cs
- SafePipeHandle.cs