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
- WebHttpDispatchOperationSelector.cs
- DoubleLinkListEnumerator.cs
- Brush.cs
- FixedPageProcessor.cs
- HybridObjectCache.cs
- AssemblyAttributesGoHere.cs
- UnsafeNativeMethodsMilCoreApi.cs
- CompilationUtil.cs
- CellTreeNode.cs
- GridView.cs
- MarginCollapsingState.cs
- Literal.cs
- ColumnMapCopier.cs
- CodeDOMProvider.cs
- HttpCookie.cs
- RewritingPass.cs
- SymbolType.cs
- ButtonChrome.cs
- TrustLevelCollection.cs
- ConfigurationElementProperty.cs
- ExpandedProjectionNode.cs
- Stack.cs
- EmptyStringExpandableObjectConverter.cs
- DataTableMapping.cs
- RelatedCurrencyManager.cs
- GC.cs
- CodeIndexerExpression.cs
- CompilationUtil.cs
- CommandValueSerializer.cs
- InstanceStoreQueryResult.cs
- MenuRendererClassic.cs
- HtmlContainerControl.cs
- XamlRtfConverter.cs
- EdmSchemaError.cs
- PopupEventArgs.cs
- TemplateControlParser.cs
- AuthorizationContext.cs
- ScriptBehaviorDescriptor.cs
- SoapElementAttribute.cs
- CollectionAdapters.cs
- TypeKeyValue.cs
- TriggerCollection.cs
- Serializer.cs
- ZoneIdentityPermission.cs
- InvalidDocumentContentsException.cs
- ImageListDesigner.cs
- RowType.cs
- EventRouteFactory.cs
- Color.cs
- GenericPrincipal.cs
- RowType.cs
- TrustSection.cs
- LoginDesignerUtil.cs
- ZipPackage.cs
- Group.cs
- ContractComponent.cs
- QuaternionIndependentAnimationStorage.cs
- ComponentChangingEvent.cs
- StateMachineWorkflowDesigner.cs
- TagMapInfo.cs
- GenericUI.cs
- UnhandledExceptionEventArgs.cs
- TcpServerChannel.cs
- BevelBitmapEffect.cs
- EnvironmentPermission.cs
- Html32TextWriter.cs
- ClientTarget.cs
- ScriptReference.cs
- DropDownButton.cs
- DataRowCollection.cs
- TypeResolver.cs
- TextTreeTextBlock.cs
- PolygonHotSpot.cs
- SurrogateSelector.cs
- FlowDocumentPaginator.cs
- DesignerActionUI.cs
- X509ClientCertificateAuthenticationElement.cs
- WebPartTransformer.cs
- UpWmlPageAdapter.cs
- PeerUnsafeNativeMethods.cs
- XmlReaderSettings.cs
- WebPartDisplayModeCancelEventArgs.cs
- WpfXamlLoader.cs
- DataGridViewDataConnection.cs
- ThreadStaticAttribute.cs
- LogReserveAndAppendState.cs
- BindingExpressionBase.cs
- SingleKeyFrameCollection.cs
- OleDbException.cs
- QilValidationVisitor.cs
- TrustLevelCollection.cs
- ArgumentException.cs
- VerticalAlignConverter.cs
- EmptyStringExpandableObjectConverter.cs
- sqlmetadatafactory.cs
- CreateRefExpr.cs
- Pkcs9Attribute.cs
- ToolboxItemAttribute.cs
- CommonDialog.cs
- UrlAuthFailedErrorFormatter.cs