Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- XmlSchemaSimpleType.cs
- FunctionQuery.cs
- BufferAllocator.cs
- UserPersonalizationStateInfo.cs
- DataGridViewComboBoxCell.cs
- HttpRuntime.cs
- BaseValidatorDesigner.cs
- WSFederationHttpSecurityMode.cs
- RuntimeHelpers.cs
- HttpContextServiceHost.cs
- AssociationType.cs
- OlePropertyStructs.cs
- Style.cs
- UrlMappingsModule.cs
- AvTraceFormat.cs
- PackagingUtilities.cs
- CharEntityEncoderFallback.cs
- LocatorGroup.cs
- StringBuilder.cs
- SecurityState.cs
- HostedHttpTransportManager.cs
- Pair.cs
- PropertyPath.cs
- ClassHandlersStore.cs
- ObjectAssociationEndMapping.cs
- XmlQueryCardinality.cs
- SafeNativeMethodsCLR.cs
- OdbcConnectionFactory.cs
- XmlHierarchyData.cs
- ProfilePropertySettingsCollection.cs
- FullTextState.cs
- StyleTypedPropertyAttribute.cs
- RoleManagerEventArgs.cs
- BaseCodeDomTreeGenerator.cs
- EditingScope.cs
- FormClosedEvent.cs
- TextWriterTraceListener.cs
- PropertyRecord.cs
- RightNameExpirationInfoPair.cs
- XmlDataCollection.cs
- SqlCacheDependencyDatabaseCollection.cs
- SynchronizationLockException.cs
- Odbc32.cs
- GenericIdentity.cs
- SelectionPattern.cs
- HostAdapter.cs
- DependencyObjectProvider.cs
- FSWPathEditor.cs
- _UriSyntax.cs
- EntityDataSourceWizardForm.cs
- Exceptions.cs
- BinaryObjectReader.cs
- SendActivityValidator.cs
- DesignerUtils.cs
- UTF8Encoding.cs
- GradientStop.cs
- ToolboxBitmapAttribute.cs
- ApplicationSecurityManager.cs
- AbandonedMutexException.cs
- PaginationProgressEventArgs.cs
- FileDialogCustomPlaces.cs
- StringConverter.cs
- IdentityHolder.cs
- EntryWrittenEventArgs.cs
- Adorner.cs
- TextFormatterImp.cs
- PopupRootAutomationPeer.cs
- CloseSequenceResponse.cs
- PolyLineSegment.cs
- MulticastDelegate.cs
- LinkButton.cs
- StateMachineDesignerPaint.cs
- DbSetClause.cs
- SiteMapNodeCollection.cs
- DataRowCollection.cs
- FixedFindEngine.cs
- ISAPIRuntime.cs
- CategoryNameCollection.cs
- ReferencedType.cs
- AcceleratedTokenAuthenticator.cs
- HtmlImage.cs
- PenContext.cs
- ProjectedWrapper.cs
- IconConverter.cs
- FlowPosition.cs
- ExecutedRoutedEventArgs.cs
- DataGridViewColumnEventArgs.cs
- FormsAuthenticationUserCollection.cs
- SecureEnvironment.cs
- FileRecordSequenceHelper.cs
- XmlValidatingReaderImpl.cs
- FocusManager.cs
- ToolStripArrowRenderEventArgs.cs
- PerspectiveCamera.cs
- ColumnResult.cs
- Model3DGroup.cs
- UserUseLicenseDictionaryLoader.cs
- FilterQuery.cs
- CodeDirectoryCompiler.cs
- FlowchartDesignerCommands.cs