Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ConfigurationElementProperty.cs
- ReachVisualSerializer.cs
- GPPOINTF.cs
- UidManager.cs
- SqlXml.cs
- KeyboardEventArgs.cs
- ByteStack.cs
- HostVisual.cs
- RouteData.cs
- CodeTypeReferenceCollection.cs
- X509CertificateCollection.cs
- ConfigXmlText.cs
- FilteredReadOnlyMetadataCollection.cs
- XPathArrayIterator.cs
- MsmqIntegrationSecurityMode.cs
- FormsAuthenticationUserCollection.cs
- NavigationPropertySingletonExpression.cs
- PanelDesigner.cs
- WinInet.cs
- XamlStream.cs
- ProcessInfo.cs
- FileDetails.cs
- StagingAreaInputItem.cs
- DbProviderFactories.cs
- PageSettings.cs
- Base64Stream.cs
- WebPartConnectionsEventArgs.cs
- DisplayMemberTemplateSelector.cs
- ProcessStartInfo.cs
- CurrencyManager.cs
- SecurityKeyIdentifierClause.cs
- TaiwanLunisolarCalendar.cs
- AsymmetricAlgorithm.cs
- PropertyPath.cs
- TargetControlTypeCache.cs
- FrameworkTextComposition.cs
- NavigationFailedEventArgs.cs
- PreProcessInputEventArgs.cs
- cache.cs
- DrawingContextDrawingContextWalker.cs
- SiteMapPath.cs
- Baml2006ReaderFrame.cs
- _HTTPDateParse.cs
- AppDomainAttributes.cs
- EntityProxyTypeInfo.cs
- DesignerOptionService.cs
- DataRecordInternal.cs
- ProcessHost.cs
- PageParserFilter.cs
- DateTimeFormatInfo.cs
- EntitySqlQueryState.cs
- TemplateField.cs
- SqlStatistics.cs
- TokenBasedSet.cs
- Transform.cs
- ParameterCollection.cs
- DataGridViewLayoutData.cs
- COM2EnumConverter.cs
- Graphics.cs
- xml.cs
- EventLog.cs
- UnhandledExceptionEventArgs.cs
- IPEndPoint.cs
- ReceiveMessageAndVerifySecurityAsyncResultBase.cs
- DiffuseMaterial.cs
- TextHidden.cs
- ArrayExtension.cs
- SqlDataRecord.cs
- PersonalizationStateQuery.cs
- AngleUtil.cs
- SafeFileHandle.cs
- ProviderUtil.cs
- LinqDataSourceInsertEventArgs.cs
- RichTextBoxConstants.cs
- SplayTreeNode.cs
- ManagedIStream.cs
- StylusEventArgs.cs
- CreateParams.cs
- ImageProxy.cs
- TableHeaderCell.cs
- EdmComplexTypeAttribute.cs
- XmlDictionary.cs
- ServiceNameElement.cs
- TextLine.cs
- ChannelSinkStacks.cs
- ImageAnimator.cs
- MatchingStyle.cs
- ExpressionDumper.cs
- TypeGeneratedEventArgs.cs
- DefaultEventAttribute.cs
- EventProviderTraceListener.cs
- TreeNodeClickEventArgs.cs
- columnmapfactory.cs
- NullRuntimeConfig.cs
- SafeFindHandle.cs
- StringReader.cs
- SqlCachedBuffer.cs
- GraphicsPath.cs
- AudioBase.cs
- SortExpressionBuilder.cs