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
- BrowserDefinitionCollection.cs
- Window.cs
- QilTypeChecker.cs
- ClientConfigurationHost.cs
- AnnotationStore.cs
- StrokeDescriptor.cs
- ProviderBase.cs
- MetaTableHelper.cs
- CodeArrayIndexerExpression.cs
- DbDataRecord.cs
- WindowsScroll.cs
- ConnectionProviderAttribute.cs
- InstalledVoice.cs
- ExpressionLexer.cs
- RecordsAffectedEventArgs.cs
- GeneralTransformGroup.cs
- ContextStaticAttribute.cs
- InstancePersistenceException.cs
- UpdateExpressionVisitor.cs
- TreeIterators.cs
- StretchValidation.cs
- StatusBarItemAutomationPeer.cs
- PeerName.cs
- UxThemeWrapper.cs
- RangeBaseAutomationPeer.cs
- HttpContext.cs
- RadioButtonBaseAdapter.cs
- DataContext.cs
- CompensatableTransactionScopeActivity.cs
- PasswordTextContainer.cs
- XmlSubtreeReader.cs
- PathFigureCollectionConverter.cs
- dataprotectionpermission.cs
- NetNamedPipeBinding.cs
- ExpressionServices.cs
- DbProviderFactoriesConfigurationHandler.cs
- PageRequestManager.cs
- PageTheme.cs
- HtmlForm.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- ByteStreamMessageEncodingElement.cs
- ContextMenu.cs
- DataObjectAttribute.cs
- DesignerDataSourceView.cs
- BindingGraph.cs
- ErrorFormatter.cs
- BufferedReadStream.cs
- ActiveXHost.cs
- GeometryConverter.cs
- RuleConditionDialog.cs
- CallContext.cs
- DataTableCollection.cs
- StringAttributeCollection.cs
- DataPagerCommandEventArgs.cs
- MatrixTransform.cs
- DataGridRow.cs
- XmlEventCache.cs
- DecoderExceptionFallback.cs
- adornercollection.cs
- EntityClientCacheKey.cs
- SeparatorAutomationPeer.cs
- TreeViewImageKeyConverter.cs
- TextHidden.cs
- BinaryKeyIdentifierClause.cs
- Simplifier.cs
- WebPartPersonalization.cs
- Sentence.cs
- XmlTextReaderImplHelpers.cs
- ArrangedElementCollection.cs
- AuthenticationSection.cs
- RepeaterItem.cs
- SafeCertificateContext.cs
- XPathNodeInfoAtom.cs
- EntityRecordInfo.cs
- StringDictionary.cs
- ImageAttributes.cs
- InstanceData.cs
- TimeStampChecker.cs
- HostExecutionContextManager.cs
- ChangeProcessor.cs
- RoutedUICommand.cs
- WebPartEventArgs.cs
- NativeRecognizer.cs
- StickyNoteHelper.cs
- XmlILTrace.cs
- HtmlUtf8RawTextWriter.cs
- ErrorItem.cs
- XdrBuilder.cs
- RubberbandSelector.cs
- HyperLinkColumn.cs
- TrustManager.cs
- SendMailErrorEventArgs.cs
- ScrollEventArgs.cs
- _KerberosClient.cs
- DataRowChangeEvent.cs
- OdbcRowUpdatingEvent.cs
- ListChangedEventArgs.cs
- AssemblyAssociatedContentFileAttribute.cs
- Visitors.cs
- JavaScriptSerializer.cs