Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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);
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ToolStripManager.cs
- PropertyPathConverter.cs
- ComboBoxAutomationPeer.cs
- ExpressionBuilder.cs
- _RequestCacheProtocol.cs
- XmlSchemaGroupRef.cs
- Win32Exception.cs
- NonBatchDirectoryCompiler.cs
- IApplicationTrustManager.cs
- NumericUpDownAccelerationCollection.cs
- BufferedGraphicsContext.cs
- X509CertificateClaimSet.cs
- LineBreak.cs
- TimeSpanParse.cs
- TextChangedEventArgs.cs
- DataGridViewDataErrorEventArgs.cs
- ZipIOExtraField.cs
- MediaTimeline.cs
- MultiPartWriter.cs
- MenuBindingsEditor.cs
- DetailsViewRow.cs
- CategoryNameCollection.cs
- FixedDocumentSequencePaginator.cs
- GlyphCache.cs
- HtmlUtf8RawTextWriter.cs
- LinqDataSourceInsertEventArgs.cs
- HyperLink.cs
- LoginCancelEventArgs.cs
- RegexParser.cs
- Compiler.cs
- PointAnimationUsingPath.cs
- FontSource.cs
- CharEntityEncoderFallback.cs
- Utils.cs
- IntegerFacetDescriptionElement.cs
- DataServiceHost.cs
- GenericIdentity.cs
- EmptyEnumerable.cs
- _ContextAwareResult.cs
- EventDescriptor.cs
- InvokePattern.cs
- EvidenceTypeDescriptor.cs
- BaseResourcesBuildProvider.cs
- String.cs
- ListMarkerLine.cs
- RegistryKey.cs
- Config.cs
- QilVisitor.cs
- Path.cs
- Win32Interop.cs
- FrameworkTemplate.cs
- EntityDataSourceChangedEventArgs.cs
- FormsAuthenticationUserCollection.cs
- prompt.cs
- LeaseManager.cs
- OracleMonthSpan.cs
- PropertyInformation.cs
- StringFunctions.cs
- LogicalExpr.cs
- InvokeProviderWrapper.cs
- Script.cs
- DbReferenceCollection.cs
- X509ChainPolicy.cs
- DataRowView.cs
- _DomainName.cs
- Msec.cs
- HttpResponse.cs
- ItemsPresenter.cs
- ErrorRuntimeConfig.cs
- ExpandCollapseIsCheckedConverter.cs
- Misc.cs
- XmlSerializerNamespaces.cs
- AtomServiceDocumentSerializer.cs
- MessageSecurityException.cs
- WFItemsToSpacerVisibility.cs
- ImportCatalogPart.cs
- DesignerRegionMouseEventArgs.cs
- MessageFormatterConverter.cs
- Authorization.cs
- SecurityPolicySection.cs
- RelationshipSet.cs
- BitmapCache.cs
- RemotingServices.cs
- ReadOnlyDictionary.cs
- GridErrorDlg.cs
- BitmapEffectDrawingContent.cs
- PointLightBase.cs
- XmlDictionaryReader.cs
- DataGridViewComboBoxEditingControl.cs
- XmlWriter.cs
- ElementHostAutomationPeer.cs
- ColumnTypeConverter.cs
- MethodExpr.cs
- CodeFieldReferenceExpression.cs
- SourceLineInfo.cs
- SmtpFailedRecipientException.cs
- HtmlTableRow.cs
- BaseComponentEditor.cs
- BulletedListEventArgs.cs
- TextServicesPropertyRanges.cs