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
- ManifestResourceInfo.cs
- AsynchronousChannelMergeEnumerator.cs
- ListSourceHelper.cs
- GridItemProviderWrapper.cs
- HiddenFieldPageStatePersister.cs
- Authorization.cs
- TcpProcessProtocolHandler.cs
- DataServiceQueryException.cs
- BuilderInfo.cs
- ResourceSet.cs
- ExceptionUtil.cs
- ListBase.cs
- AssemblyAttributes.cs
- NativeCppClassAttribute.cs
- SHA384.cs
- StrokeIntersection.cs
- BulletedList.cs
- TransformDescriptor.cs
- ObjRef.cs
- NotFiniteNumberException.cs
- DefaultEvaluationContext.cs
- IndexingContentUnit.cs
- ListCollectionView.cs
- ScriptComponentDescriptor.cs
- RC2.cs
- Table.cs
- ServiceProviders.cs
- SpecialTypeDataContract.cs
- ObjectReferenceStack.cs
- UnmanagedHandle.cs
- InputReferenceExpression.cs
- DefaultExpression.cs
- ProviderCollection.cs
- DataRelationPropertyDescriptor.cs
- ProxyHelper.cs
- EntityDesignerBuildProvider.cs
- ReferentialConstraintRoleElement.cs
- WCFModelStrings.Designer.cs
- MouseActionValueSerializer.cs
- ExitEventArgs.cs
- DataControlFieldCell.cs
- ScrollViewer.cs
- NavigationEventArgs.cs
- MediaScriptCommandRoutedEventArgs.cs
- XamlPathDataSerializer.cs
- Rotation3DAnimationBase.cs
- ClientSession.cs
- CompositeActivityTypeDescriptor.cs
- FontConverter.cs
- BitmapEffectInputData.cs
- EntityDesignerUtils.cs
- WindowsSecurityToken.cs
- WebPartConnectionsEventArgs.cs
- UniformGrid.cs
- SplineKeyFrames.cs
- UInt32.cs
- OracleLob.cs
- WindowsSecurityToken.cs
- CustomTypeDescriptor.cs
- DesignerTransactionCloseEvent.cs
- CodeGroup.cs
- GridViewRowCollection.cs
- EntityRecordInfo.cs
- RotationValidation.cs
- MailWriter.cs
- UrlMappingCollection.cs
- DisableDpiAwarenessAttribute.cs
- ImageCollectionEditor.cs
- ExpressionDumper.cs
- WsdlBuildProvider.cs
- MailMessage.cs
- XsdDuration.cs
- WizardStepBase.cs
- SerializationFieldInfo.cs
- Variant.cs
- CrossSiteScriptingValidation.cs
- CompilerLocalReference.cs
- SerializationBinder.cs
- FormsAuthentication.cs
- ShadowGlyph.cs
- OracleConnectionStringBuilder.cs
- TransformGroup.cs
- PreProcessor.cs
- ButtonField.cs
- ListViewUpdatedEventArgs.cs
- NavigationProperty.cs
- EntityCollection.cs
- EntityDataSourceDataSelectionPanel.cs
- DEREncoding.cs
- DetailsViewModeEventArgs.cs
- ScriptResourceAttribute.cs
- DynamicRenderer.cs
- ChannelServices.cs
- SdlChannelSink.cs
- DataGridViewHitTestInfo.cs
- ReliableDuplexSessionChannel.cs
- HostedHttpRequestAsyncResult.cs
- Icon.cs
- DrawingAttributeSerializer.cs
- SrgsDocument.cs