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
- DispatchChannelSink.cs
- AncillaryOps.cs
- ExtensibleClassFactory.cs
- EventProviderWriter.cs
- DependencyObject.cs
- FixedPageStructure.cs
- Compiler.cs
- WeakEventManager.cs
- AppDomainEvidenceFactory.cs
- MetafileEditor.cs
- MatrixTransform.cs
- ParsedAttributeCollection.cs
- BitmapMetadataBlob.cs
- TagMapCollection.cs
- RuntimeResourceSet.cs
- RowSpanVector.cs
- TextTreeText.cs
- TemplateInstanceAttribute.cs
- BooleanStorage.cs
- CompositeScriptReference.cs
- Message.cs
- MatrixTransform.cs
- ChangePassword.cs
- FlowLayoutSettings.cs
- XNodeNavigator.cs
- _NativeSSPI.cs
- PanelContainerDesigner.cs
- SafeRegistryKey.cs
- BitmapSource.cs
- DecimalStorage.cs
- EntityDesignerBuildProvider.cs
- ClassData.cs
- SymbolMethod.cs
- BindingEditor.xaml.cs
- SqlCommandBuilder.cs
- ProviderCommandInfoUtils.cs
- OleDbInfoMessageEvent.cs
- HMACSHA384.cs
- PersonalizationStateInfoCollection.cs
- Button.cs
- PointCollectionValueSerializer.cs
- WebRequestModuleElement.cs
- safex509handles.cs
- WpfSharedBamlSchemaContext.cs
- WasHttpHandlersInstallComponent.cs
- EventLogTraceListener.cs
- CoreSwitches.cs
- WebPartDeleteVerb.cs
- EntityReference.cs
- XmlSchemaException.cs
- CalendarTable.cs
- RelationshipDetailsRow.cs
- RemotingServices.cs
- CodeBlockBuilder.cs
- JournalNavigationScope.cs
- TemplateField.cs
- formatter.cs
- OracleCommandSet.cs
- xsdvalidator.cs
- TransformerTypeCollection.cs
- XmlSchemaInfo.cs
- WindowsGraphicsCacheManager.cs
- KeyTimeConverter.cs
- MobileControlPersister.cs
- propertytag.cs
- __Filters.cs
- FormConverter.cs
- WindowsGraphics2.cs
- EmptyControlCollection.cs
- RegisteredScript.cs
- KeyFrames.cs
- EntryIndex.cs
- ChannelSettingsElement.cs
- XPathScanner.cs
- DataFieldConverter.cs
- UserPersonalizationStateInfo.cs
- EFAssociationProvider.cs
- SqlBulkCopyColumnMappingCollection.cs
- SystemPens.cs
- CodeDomSerializer.cs
- AdobeCFFWrapper.cs
- PageVisual.cs
- PromptBuilder.cs
- DataGridCellInfo.cs
- OleDbReferenceCollection.cs
- SimpleBitVector32.cs
- DataFormats.cs
- TreeViewImageKeyConverter.cs
- QilScopedVisitor.cs
- TypeUtil.cs
- ProgressBar.cs
- EditorZone.cs
- FileRecordSequenceCompletedAsyncResult.cs
- Wildcard.cs
- Material.cs
- GPRECT.cs
- ToolTipService.cs
- PrivilegedConfigurationManager.cs
- Hex.cs
- CompoundFileDeflateTransform.cs