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
- JulianCalendar.cs
- X509Certificate2.cs
- EntityKeyElement.cs
- OracleException.cs
- PageParserFilter.cs
- HttpListenerResponse.cs
- ListViewItem.cs
- Transactions.cs
- XAMLParseException.cs
- SharedPerformanceCounter.cs
- ServiceNameElementCollection.cs
- DataRowChangeEvent.cs
- _FtpControlStream.cs
- TextSegment.cs
- DecimalStorage.cs
- RewritingPass.cs
- ExpressionBuilder.cs
- Material.cs
- KeyedHashAlgorithm.cs
- BitSet.cs
- ListCollectionView.cs
- WorkflowMarkupSerializationException.cs
- DrawingAttributes.cs
- UnsafeCollabNativeMethods.cs
- TypeDescriptorContext.cs
- EncoderNLS.cs
- LogWriteRestartAreaState.cs
- SocketException.cs
- SpecialFolderEnumConverter.cs
- IndexingContentUnit.cs
- CngProperty.cs
- Int32EqualityComparer.cs
- OperatingSystem.cs
- EncoderBestFitFallback.cs
- MissingManifestResourceException.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- ActivationWorker.cs
- ProcessModuleCollection.cs
- KeyTime.cs
- StateMachineWorkflowDesigner.cs
- SymDocumentType.cs
- SslStream.cs
- EnumerableRowCollection.cs
- FacetValues.cs
- HeaderedContentControl.cs
- RelatedImageListAttribute.cs
- DbParameterHelper.cs
- ReferenceEqualityComparer.cs
- TreeViewImageKeyConverter.cs
- AxisAngleRotation3D.cs
- NullableLongAverageAggregationOperator.cs
- PropertyTabAttribute.cs
- Msec.cs
- FontStretches.cs
- DisplayInformation.cs
- MulticastOption.cs
- Thread.cs
- EntityKeyElement.cs
- RegexBoyerMoore.cs
- ClientData.cs
- TimeSpanSecondsConverter.cs
- NoPersistScope.cs
- ArraySortHelper.cs
- HostedImpersonationContext.cs
- ResolvedKeyFrameEntry.cs
- InputChannel.cs
- _NestedMultipleAsyncResult.cs
- PointLight.cs
- ReadWriteObjectLock.cs
- SparseMemoryStream.cs
- NonDualMessageSecurityOverHttp.cs
- XmlDownloadManager.cs
- TableItemPattern.cs
- KnownBoxes.cs
- BamlRecordHelper.cs
- SqlMethodAttribute.cs
- ClientScriptItemCollection.cs
- WebPartCloseVerb.cs
- DataGridViewColumn.cs
- MatcherBuilder.cs
- TextDecorationCollection.cs
- AnnotationComponentManager.cs
- EntityModelSchemaGenerator.cs
- PlainXmlWriter.cs
- MeasurementDCInfo.cs
- SchemaHelper.cs
- SqlClientWrapperSmiStream.cs
- SqlHelper.cs
- LineServices.cs
- ListControlConvertEventArgs.cs
- InvalidDataException.cs
- PageAsyncTaskManager.cs
- UriTemplateMatchException.cs
- ResolveCriteriaApril2005.cs
- CellLabel.cs
- BitmapPalette.cs
- ExpandableObjectConverter.cs
- EngineSite.cs
- HtmlTable.cs
- DrawingBrush.cs