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
- GeneralTransform2DTo3D.cs
- PageParser.cs
- RequestCacheValidator.cs
- XmlSchemaComplexType.cs
- FontNamesConverter.cs
- OleDbMetaDataFactory.cs
- PrinterUnitConvert.cs
- XmlAnyElementAttributes.cs
- PolicyManager.cs
- OracleColumn.cs
- XmlText.cs
- CanonicalXml.cs
- MeshGeometry3D.cs
- WindowsStartMenu.cs
- CaseStatement.cs
- WsdlImporter.cs
- IndexedString.cs
- SyndicationSerializer.cs
- TaskFormBase.cs
- SharedPerformanceCounter.cs
- SevenBitStream.cs
- AdapterUtil.cs
- ImageFormat.cs
- HtmlMeta.cs
- EntityModelBuildProvider.cs
- ButtonColumn.cs
- AnnotationDocumentPaginator.cs
- CriticalFinalizerObject.cs
- ComponentResourceManager.cs
- DecimalMinMaxAggregationOperator.cs
- GraphicsPath.cs
- AssemblyAttributes.cs
- ChangePassword.cs
- WebReferenceCollection.cs
- DataSetMappper.cs
- ApplicationException.cs
- LinqDataSourceValidationException.cs
- SettingsBase.cs
- FocusTracker.cs
- XmlAttributeAttribute.cs
- Propagator.JoinPropagator.cs
- TableLayoutRowStyleCollection.cs
- System.Data.OracleClient_BID.cs
- CodeMemberField.cs
- PersistenceParticipant.cs
- SapiRecognizer.cs
- PenContexts.cs
- SqlDataSourceSummaryPanel.cs
- IUnknownConstantAttribute.cs
- TextPointer.cs
- figurelength.cs
- controlskin.cs
- ComponentGuaranteesAttribute.cs
- MsmqInputChannelListenerBase.cs
- XmlAttributeProperties.cs
- XmlSchemaComplexType.cs
- BindingGraph.cs
- ReadOnlyDictionary.cs
- ByteConverter.cs
- FrameworkElementAutomationPeer.cs
- Privilege.cs
- SafeWaitHandle.cs
- DataServiceQueryProvider.cs
- XmlQueryTypeFactory.cs
- VBCodeProvider.cs
- _CookieModule.cs
- IntegerValidatorAttribute.cs
- StrongNamePublicKeyBlob.cs
- BlurEffect.cs
- SecurityUniqueId.cs
- PhysicalOps.cs
- DrawingAttributes.cs
- RowBinding.cs
- ToolStripItemCollection.cs
- ReflectEventDescriptor.cs
- _DomainName.cs
- SimpleWebHandlerParser.cs
- PortCache.cs
- MenuCommandsChangedEventArgs.cs
- RootCodeDomSerializer.cs
- PropertyPath.cs
- RichTextBox.cs
- SubstitutionResponseElement.cs
- Int32Storage.cs
- OleDbTransaction.cs
- MessageFilter.cs
- GACIdentityPermission.cs
- XmlDocumentFragment.cs
- VirtualizingStackPanel.cs
- TrackingMemoryStream.cs
- RSAProtectedConfigurationProvider.cs
- CodeGenerator.cs
- Rights.cs
- CodePrimitiveExpression.cs
- CodeNamespaceImport.cs
- DataRelationPropertyDescriptor.cs
- KerberosSecurityTokenParameters.cs
- xdrvalidator.cs
- EmulateRecognizeCompletedEventArgs.cs
- DbSourceParameterCollection.cs