Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / MD5Cng.cs / 1305376 / MD5Cng.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== using System; using System.Diagnostics.Contracts; namespace System.Security.Cryptography { ////// Wrapper around the BCrypt implementation of the MD5 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class MD5Cng : MD5 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public MD5Cng() { Contract.Ensures(m_hashAlgorithm != null); if (CryptoConfig.AllowOnlyFipsAlgorithms) { throw new InvalidOperationException(SR.GetString(SR.Cryptography_NonCompliantFIPSAlgorithm)); } m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.MD5, BCryptNative.ProviderName.MicrosoftPrimitiveProvider); } //// // [System.Security.SecurityCritical] protected override void Dispose(bool disposing) { try { if (disposing) { m_hashAlgorithm.Dispose(); } } finally { base.Dispose(disposing); } } //// // [System.Security.SecurityCritical] public override void Initialize() { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.Initialize(); } //// // [System.Security.SecurityCritical] protected override void HashCore(byte[] array, int ibStart, int cbSize) { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.HashCore(array, ibStart, cbSize); } //// // [System.Security.SecurityCritical] protected override byte[] HashFinal() { Contract.Assert(m_hashAlgorithm != null); return m_hashAlgorithm.HashFinal(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== using System; using System.Diagnostics.Contracts; namespace System.Security.Cryptography { ///// /// Wrapper around the BCrypt implementation of the MD5 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class MD5Cng : MD5 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public MD5Cng() { Contract.Ensures(m_hashAlgorithm != null); if (CryptoConfig.AllowOnlyFipsAlgorithms) { throw new InvalidOperationException(SR.GetString(SR.Cryptography_NonCompliantFIPSAlgorithm)); } m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.MD5, BCryptNative.ProviderName.MicrosoftPrimitiveProvider); } //// // [System.Security.SecurityCritical] protected override void Dispose(bool disposing) { try { if (disposing) { m_hashAlgorithm.Dispose(); } } finally { base.Dispose(disposing); } } //// // [System.Security.SecurityCritical] public override void Initialize() { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.Initialize(); } //// // [System.Security.SecurityCritical] protected override void HashCore(byte[] array, int ibStart, int cbSize) { Contract.Assert(m_hashAlgorithm != null); m_hashAlgorithm.HashCore(array, ibStart, cbSize); } //// // [System.Security.SecurityCritical] protected override byte[] HashFinal() { Contract.Assert(m_hashAlgorithm != null); return m_hashAlgorithm.HashFinal(); } } } // 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
- FixedTextPointer.cs
- TabletDeviceInfo.cs
- StrongNameKeyPair.cs
- SystemEvents.cs
- baseaxisquery.cs
- CollectionContainer.cs
- RequestQueryProcessor.cs
- StorageEntityTypeMapping.cs
- TransformerInfo.cs
- MemberRelationshipService.cs
- AsymmetricKeyExchangeFormatter.cs
- PartialCachingAttribute.cs
- EventHandlers.cs
- HttpRuntime.cs
- SystemIPGlobalStatistics.cs
- TransformConverter.cs
- NotFiniteNumberException.cs
- RegexCapture.cs
- URL.cs
- DocumentOrderQuery.cs
- CorrelationRequestContext.cs
- SkinBuilder.cs
- XmlILAnnotation.cs
- SignedPkcs7.cs
- ActivationProxy.cs
- ServiceInstanceProvider.cs
- URI.cs
- DataPagerFieldCollection.cs
- TextChangedEventArgs.cs
- NodeInfo.cs
- FeatureSupport.cs
- XmlQueryRuntime.cs
- DependencyPropertyHelper.cs
- ButtonField.cs
- ExtentCqlBlock.cs
- CharEntityEncoderFallback.cs
- TreeViewImageIndexConverter.cs
- AssemblyAttributes.cs
- DecoderReplacementFallback.cs
- SessionConnectionReader.cs
- Buffer.cs
- Item.cs
- MenuItemAutomationPeer.cs
- recordstate.cs
- EndOfStreamException.cs
- ApplicationDirectory.cs
- OleDbFactory.cs
- ListDataHelper.cs
- InfoCardProofToken.cs
- Constraint.cs
- DynamicContractTypeBuilder.cs
- COM2ExtendedBrowsingHandler.cs
- ActivityDesigner.cs
- FileUtil.cs
- PtsPage.cs
- WebBrowserUriTypeConverter.cs
- SetStateEventArgs.cs
- DayRenderEvent.cs
- BamlStream.cs
- DataGridCell.cs
- PropertyValueChangedEvent.cs
- OracleNumber.cs
- DesignerActionKeyboardBehavior.cs
- XmlReflectionImporter.cs
- Scanner.cs
- TreeNodeBindingDepthConverter.cs
- MetaModel.cs
- HuffmanTree.cs
- BrowserCapabilitiesCompiler.cs
- Command.cs
- EDesignUtil.cs
- StringUtil.cs
- ConnectivityStatus.cs
- DetailsViewCommandEventArgs.cs
- RoleService.cs
- PropertyInfoSet.cs
- SafeNativeMethodsOther.cs
- entitydatasourceentitysetnameconverter.cs
- CollectionDataContractAttribute.cs
- ValidationErrorCollection.cs
- IEnumerable.cs
- DisplayToken.cs
- NamespaceEmitter.cs
- InfoCardTraceRecord.cs
- InternalRelationshipCollection.cs
- AppDomainAttributes.cs
- XamlVector3DCollectionSerializer.cs
- FixedLineResult.cs
- VisualStateChangedEventArgs.cs
- ParenthesizePropertyNameAttribute.cs
- NullableBoolConverter.cs
- MembershipUser.cs
- CodeGenerator.cs
- ConfigXmlDocument.cs
- sqlcontext.cs
- Command.cs
- WebPartCatalogCloseVerb.cs
- ProfilePropertySettings.cs
- WebPartChrome.cs
- RouteCollection.cs