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
- AnnotationElement.cs
- WorkflowDefinitionDispenser.cs
- XmlIgnoreAttribute.cs
- SqlTransaction.cs
- ProcessThread.cs
- MobileErrorInfo.cs
- HtmlUtf8RawTextWriter.cs
- ProtocolsConfiguration.cs
- HttpModuleActionCollection.cs
- PcmConverter.cs
- WebControlsSection.cs
- HashCoreRequest.cs
- UserUseLicenseDictionaryLoader.cs
- documentsequencetextcontainer.cs
- DesignerForm.cs
- URLAttribute.cs
- StringValidatorAttribute.cs
- NavigationExpr.cs
- ViewStateModeByIdAttribute.cs
- ServicePerformanceCounters.cs
- NativeObjectSecurity.cs
- BinHexEncoder.cs
- CqlErrorHelper.cs
- DataSvcMapFile.cs
- HttpWebRequestElement.cs
- AudioFileOut.cs
- ContainerParagraph.cs
- DynamicDocumentPaginator.cs
- ErrorWrapper.cs
- TargetControlTypeCache.cs
- UnaryNode.cs
- DefaultAsyncDataDispatcher.cs
- PasswordRecovery.cs
- WindowsTab.cs
- XslAst.cs
- XmlReaderSettings.cs
- documentsequencetextview.cs
- FaultCode.cs
- NameNode.cs
- SplitterEvent.cs
- OleDbStruct.cs
- NavigationHelper.cs
- EncodingTable.cs
- SrgsElement.cs
- ColumnMapProcessor.cs
- DbConnectionPoolOptions.cs
- XPathSelfQuery.cs
- Symbol.cs
- CodeGotoStatement.cs
- BasicKeyConstraint.cs
- messageonlyhwndwrapper.cs
- AssociationEndMember.cs
- RowToFieldTransformer.cs
- TextTreeObjectNode.cs
- ContextQuery.cs
- NameSpaceEvent.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- ResXResourceWriter.cs
- Point3DCollectionValueSerializer.cs
- Graph.cs
- Path.cs
- WinEventWrap.cs
- DoubleCollection.cs
- MemberDescriptor.cs
- MessageDecoder.cs
- PropertyHelper.cs
- ContentElement.cs
- StructuralObject.cs
- BaseTransportHeaders.cs
- ProfilePropertyNameValidator.cs
- RegisteredArrayDeclaration.cs
- TrackingDataItemValue.cs
- StatusBarItem.cs
- QfeChecker.cs
- future.cs
- KeyedQueue.cs
- ValueTable.cs
- DayRenderEvent.cs
- RoamingStoreFileUtility.cs
- DelegateInArgument.cs
- CompoundFileStreamReference.cs
- SystemParameters.cs
- ConstraintCollection.cs
- AlphabeticalEnumConverter.cs
- Message.cs
- KernelTypeValidation.cs
- ListDataBindEventArgs.cs
- DispatcherFrame.cs
- StrokeNodeOperations.cs
- FileEnumerator.cs
- FontStretches.cs
- DBCommand.cs
- AlternationConverter.cs
- RequestTimeoutManager.cs
- CriticalHandle.cs
- DaylightTime.cs
- DataGridTable.cs
- XamlWriter.cs
- WindowsClientCredential.cs
- DateTimeValueSerializerContext.cs