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
- SynchronizingStream.cs
- TextSerializer.cs
- WebPartEditorCancelVerb.cs
- ExecutionScope.cs
- DataGridViewTextBoxColumn.cs
- WindowsTab.cs
- DispatcherObject.cs
- SmtpFailedRecipientsException.cs
- AnchoredBlock.cs
- KeyToListMap.cs
- LabelLiteral.cs
- KnownBoxes.cs
- KnownColorTable.cs
- PeerContact.cs
- AtomMaterializerLog.cs
- WaitHandleCannotBeOpenedException.cs
- SystemInfo.cs
- XmlEventCache.cs
- QilParameter.cs
- BitmapEffectOutputConnector.cs
- CaseStatementProjectedSlot.cs
- ConfigurationValues.cs
- ProtocolsConfigurationEntry.cs
- DataServiceRequestOfT.cs
- ListViewContainer.cs
- TextServicesContext.cs
- XmlSchemaSubstitutionGroup.cs
- CodeNamespaceImportCollection.cs
- SudsCommon.cs
- MaterialCollection.cs
- WebPartConnectionsCancelVerb.cs
- SqlBuilder.cs
- NameScope.cs
- HostProtectionPermission.cs
- BaseValidator.cs
- FieldTemplateUserControl.cs
- DelimitedListTraceListener.cs
- DateTime.cs
- XmlDocumentType.cs
- PieceDirectory.cs
- TextFindEngine.cs
- LocalizableAttribute.cs
- NameService.cs
- IisTraceListener.cs
- EntryWrittenEventArgs.cs
- QilInvokeLateBound.cs
- TextBoxAutoCompleteSourceConverter.cs
- AnimatedTypeHelpers.cs
- odbcmetadatacollectionnames.cs
- GridViewSortEventArgs.cs
- GrammarBuilderRuleRef.cs
- EventHandlerService.cs
- SchemaConstraints.cs
- ReceiveActivityDesignerTheme.cs
- IteratorDescriptor.cs
- GestureRecognizer.cs
- CheckBoxAutomationPeer.cs
- FlowLayout.cs
- NonSerializedAttribute.cs
- Odbc32.cs
- SmiContext.cs
- DesignerOptionService.cs
- StrongNameHelpers.cs
- UnsafeNativeMethods.cs
- ResourcesGenerator.cs
- OleDbCommand.cs
- Stopwatch.cs
- FileInfo.cs
- DataQuery.cs
- DesignerCommandSet.cs
- DetailsViewRowCollection.cs
- ColorTranslator.cs
- PrinterSettings.cs
- IISMapPath.cs
- QilPatternVisitor.cs
- LinqDataSourceStatusEventArgs.cs
- InkSerializer.cs
- BatchParser.cs
- DataGridViewLinkColumn.cs
- Light.cs
- ClaimTypes.cs
- Binding.cs
- EnumerableCollectionView.cs
- AlphabeticalEnumConverter.cs
- CatalogPartDesigner.cs
- MachineKeySection.cs
- DataGridHeaderBorder.cs
- SQLChars.cs
- WorkflowInstanceExtensionManager.cs
- CheckBoxAutomationPeer.cs
- ProtectedConfigurationProviderCollection.cs
- InputLanguageSource.cs
- TextEditorParagraphs.cs
- WsdlBuildProvider.cs
- StorageComplexTypeMapping.cs
- ProjectionPath.cs
- XmlSortKeyAccumulator.cs
- ServiceHostingEnvironment.cs
- BaseTemplateBuildProvider.cs
- StrokeCollection.cs