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
- SelectionItemPattern.cs
- TextContainer.cs
- IssuanceLicense.cs
- InputProviderSite.cs
- FollowerQueueCreator.cs
- WindowsGraphicsCacheManager.cs
- CommonDialog.cs
- DocumentCollection.cs
- SqlXmlStorage.cs
- ContainerSelectorGlyph.cs
- Int32Converter.cs
- AdornerLayer.cs
- SoundPlayer.cs
- ObjectSecurity.cs
- httpstaticobjectscollection.cs
- ConsoleEntryPoint.cs
- Image.cs
- UseAttributeSetsAction.cs
- ReservationCollection.cs
- FontFamily.cs
- SocketException.cs
- CompilationRelaxations.cs
- DataGridViewCellParsingEventArgs.cs
- DSASignatureFormatter.cs
- SecurityCriticalDataForSet.cs
- ContentDisposition.cs
- Evidence.cs
- CompilationUtil.cs
- SHA256Managed.cs
- RoleGroup.cs
- ReferentialConstraint.cs
- PageTheme.cs
- TextTreeInsertUndoUnit.cs
- SqlTypesSchemaImporter.cs
- DataColumnChangeEvent.cs
- GridToolTip.cs
- HttpConfigurationContext.cs
- IdentityNotMappedException.cs
- TypeUtil.cs
- SystemWebCachingSectionGroup.cs
- SudsWriter.cs
- ProcessHostConfigUtils.cs
- DrawingGroup.cs
- SystemIPGlobalProperties.cs
- PersonalizableTypeEntry.cs
- Message.cs
- UnsafeNativeMethods.cs
- ProcessManager.cs
- AssemblyResourceLoader.cs
- ApplicationException.cs
- WindowsProgressbar.cs
- PresentationTraceSources.cs
- ListViewTableCell.cs
- DiagnosticTraceSource.cs
- QilTypeChecker.cs
- DbConnectionStringCommon.cs
- SHA256.cs
- SQLRoleProvider.cs
- ComponentEditorPage.cs
- SessionStateModule.cs
- XmlSiteMapProvider.cs
- BinaryCommonClasses.cs
- TransformCryptoHandle.cs
- GACIdentityPermission.cs
- ScriptDescriptor.cs
- TargetParameterCountException.cs
- PassportAuthenticationModule.cs
- OdbcParameterCollection.cs
- GeometryDrawing.cs
- EffectiveValueEntry.cs
- OutgoingWebResponseContext.cs
- _OverlappedAsyncResult.cs
- PathFigureCollection.cs
- DependencyObjectType.cs
- DataListItemCollection.cs
- SessionSwitchEventArgs.cs
- XmlSchemaGroup.cs
- LedgerEntryCollection.cs
- URLString.cs
- GlobalEventManager.cs
- Switch.cs
- TaiwanCalendar.cs
- OdbcUtils.cs
- X509ImageLogo.cs
- CharEntityEncoderFallback.cs
- _NetRes.cs
- GroupItem.cs
- ObjectDataSourceView.cs
- SchemaNames.cs
- WebPartZone.cs
- ActiveXSite.cs
- SiteMapPath.cs
- _HeaderInfo.cs
- HideDisabledControlAdapter.cs
- XmlValidatingReaderImpl.cs
- ConditionCollection.cs
- AttributeEmitter.cs
- XslAstAnalyzer.cs
- FontSource.cs
- NotImplementedException.cs