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
- SessionChannels.cs
- FileIOPermission.cs
- SymbolUsageManager.cs
- StyleSheetDesigner.cs
- CacheSection.cs
- SRDisplayNameAttribute.cs
- RequestCacheManager.cs
- Knowncolors.cs
- MetadataResolver.cs
- ReachSerializableProperties.cs
- FrameDimension.cs
- validationstate.cs
- DurationConverter.cs
- PropertySourceInfo.cs
- KeyValueInternalCollection.cs
- DataContractSerializerOperationFormatter.cs
- ImageConverter.cs
- ExpressionDumper.cs
- WebPartAuthorizationEventArgs.cs
- XmlSchemaAll.cs
- CryptoKeySecurity.cs
- FileVersionInfo.cs
- Block.cs
- safelinkcollection.cs
- DataGridViewColumnCollection.cs
- DataServiceClientException.cs
- Operand.cs
- PageStatePersister.cs
- ConnectionStringSettingsCollection.cs
- MetadataCollection.cs
- ApplicationSettingsBase.cs
- GridViewItemAutomationPeer.cs
- IfJoinedCondition.cs
- ToolStripContentPanel.cs
- DateTimePicker.cs
- ControlIdConverter.cs
- TextStore.cs
- StringValidatorAttribute.cs
- WebSysDisplayNameAttribute.cs
- RightsManagementManager.cs
- DataGridLinkButton.cs
- CellTreeSimplifier.cs
- DecimalFormatter.cs
- TimeSpanConverter.cs
- ToolStripComboBox.cs
- CodeGotoStatement.cs
- EmbossBitmapEffect.cs
- ListBindingConverter.cs
- RetrieveVirtualItemEventArgs.cs
- EntityProviderFactory.cs
- GorillaCodec.cs
- UrlPath.cs
- ObjectTypeMapping.cs
- SHA1.cs
- WebEvents.cs
- DataSourceListEditor.cs
- PeerApplication.cs
- NetworkInformationPermission.cs
- TemplateManager.cs
- NamespaceEmitter.cs
- SizeIndependentAnimationStorage.cs
- Preprocessor.cs
- BatchServiceHost.cs
- UrlPropertyAttribute.cs
- TdsValueSetter.cs
- BinaryObjectInfo.cs
- PropertyRef.cs
- NativeMethods.cs
- ActivityCodeGenerator.cs
- FileDialogPermission.cs
- GroupBox.cs
- ManifestResourceInfo.cs
- DragDrop.cs
- Thickness.cs
- TemplateParser.cs
- InputBuffer.cs
- FileSecurity.cs
- Number.cs
- ConfigXmlCDataSection.cs
- uribuilder.cs
- InstanceLockedException.cs
- SqlNodeAnnotations.cs
- SourceInterpreter.cs
- Subset.cs
- HwndSubclass.cs
- PropertyChangeTracker.cs
- EntityDataSourceDataSelection.cs
- JulianCalendar.cs
- DynamicRouteExpression.cs
- Stream.cs
- Point3DAnimationUsingKeyFrames.cs
- RegistryPermission.cs
- SHA256Managed.cs
- Rules.cs
- WsatExtendedInformation.cs
- WsrmFault.cs
- SizeAnimation.cs
- NativeMethods.cs
- BamlRecordReader.cs
- RowUpdatedEventArgs.cs