Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- WeakReferenceList.cs
- MemberPath.cs
- ToolStripItem.cs
- ProjectionCamera.cs
- ObjectDataSourceView.cs
- ButtonFieldBase.cs
- EdmPropertyAttribute.cs
- Encoding.cs
- Mouse.cs
- login.cs
- CommonDialog.cs
- EmbeddedMailObject.cs
- ImageDrawing.cs
- WCFModelStrings.Designer.cs
- SqlCaseSimplifier.cs
- DeferrableContent.cs
- ModelItemCollectionImpl.cs
- TemplateNodeContextMenu.cs
- XmlLanguageConverter.cs
- AutomationPatternInfo.cs
- RelatedView.cs
- MetricEntry.cs
- DataGridViewSelectedCellCollection.cs
- State.cs
- TargetFrameworkUtil.cs
- QuaternionAnimation.cs
- BamlTreeNode.cs
- HttpInputStream.cs
- WeakReference.cs
- KnownBoxes.cs
- ListViewPagedDataSource.cs
- __ComObject.cs
- Utils.cs
- ExtensibleClassFactory.cs
- CreateUserErrorEventArgs.cs
- UrlParameterReader.cs
- ValueChangedEventManager.cs
- SByte.cs
- IOThreadScheduler.cs
- LightweightCodeGenerator.cs
- GenerateTemporaryAssemblyTask.cs
- ResolveDuplexAsyncResult.cs
- DecoderReplacementFallback.cs
- DbFunctionCommandTree.cs
- Stacktrace.cs
- ViewManager.cs
- SpellerError.cs
- TCPClient.cs
- ExpandCollapsePattern.cs
- DataGridViewSortCompareEventArgs.cs
- COM2ExtendedTypeConverter.cs
- XmlSchemaSimpleContentRestriction.cs
- FolderNameEditor.cs
- ValueUtilsSmi.cs
- TextReader.cs
- RichTextBoxConstants.cs
- FacetValues.cs
- Fault.cs
- DataPagerField.cs
- Converter.cs
- PhysicalOps.cs
- DPCustomTypeDescriptor.cs
- _DisconnectOverlappedAsyncResult.cs
- SeekableReadStream.cs
- ComplexTypeEmitter.cs
- StrokeIntersection.cs
- FunctionDetailsReader.cs
- StoreAnnotationsMap.cs
- DesignTimeVisibleAttribute.cs
- DependencySource.cs
- Attributes.cs
- EntityCollection.cs
- UserPersonalizationStateInfo.cs
- SapiRecognizer.cs
- PropertiesTab.cs
- Selector.cs
- PrintDialog.cs
- XmlWriter.cs
- AbstractDataSvcMapFileLoader.cs
- HttpPostServerProtocol.cs
- Vector.cs
- latinshape.cs
- DataGridViewUtilities.cs
- CallbackValidator.cs
- VerificationAttribute.cs
- XComponentModel.cs
- MailMessageEventArgs.cs
- TextTrailingCharacterEllipsis.cs
- DocumentPageHost.cs
- StreamWithDictionary.cs
- BuildProviderAppliesToAttribute.cs
- SchemaNotation.cs
- namescope.cs
- LinkedList.cs
- EntityDataSourceValidationException.cs
- CapabilitiesAssignment.cs
- PageOutputQuality.cs
- XmlMtomReader.cs
- ThaiBuddhistCalendar.cs
- SqlClientFactory.cs