Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Security / Cryptography / SHA1Cng.cs / 1305376 / SHA1Cng.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 SHA-1 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA1Cng : SHA1 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA1Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha1, 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 SHA-1 hashing algorithm /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class SHA1Cng : SHA1 { private BCryptHashAlgorithm m_hashAlgorithm; //// [System.Security.SecurityCritical] public SHA1Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha1, 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
- DesignTable.cs
- EntityDataSourceQueryBuilder.cs
- RectValueSerializer.cs
- ComponentManagerBroker.cs
- PointConverter.cs
- TextServicesLoader.cs
- DeferrableContentConverter.cs
- StaticExtensionConverter.cs
- XmlSchema.cs
- LayoutUtils.cs
- WindowsScrollBarBits.cs
- XPathChildIterator.cs
- MarkupCompiler.cs
- UserControlBuildProvider.cs
- ByteStream.cs
- RegexRunner.cs
- WebPartCancelEventArgs.cs
- XmlSerializableWriter.cs
- SqlTopReducer.cs
- RichTextBoxAutomationPeer.cs
- PolicyStatement.cs
- TextViewSelectionProcessor.cs
- AsyncResult.cs
- ClockGroup.cs
- BaseResourcesBuildProvider.cs
- SQLDouble.cs
- SafeLibraryHandle.cs
- XmlConverter.cs
- JsonQNameDataContract.cs
- TimeoutValidationAttribute.cs
- ZipIOCentralDirectoryFileHeader.cs
- WindowsStatic.cs
- ResourceReferenceExpressionConverter.cs
- HijriCalendar.cs
- DataGridViewHeaderCell.cs
- elementinformation.cs
- XPathNode.cs
- Utils.cs
- ApplicationProxyInternal.cs
- MaskedTextBoxDesigner.cs
- _UriTypeConverter.cs
- DurableEnlistmentState.cs
- Parser.cs
- ExceptionUtility.cs
- DataListItemCollection.cs
- ResolveNameEventArgs.cs
- ADMembershipProvider.cs
- GroupQuery.cs
- MultiView.cs
- TableParaClient.cs
- PointLight.cs
- DefaultValueAttribute.cs
- FormView.cs
- Visual3D.cs
- CustomAttributeSerializer.cs
- SequentialWorkflowHeaderFooter.cs
- ActiveXSite.cs
- RawStylusInputCustomData.cs
- NameSpaceEvent.cs
- CfgParser.cs
- XmlSchemaSequence.cs
- AnnotationMap.cs
- JoinGraph.cs
- AttachedPropertyBrowsableAttribute.cs
- Expression.cs
- InputScope.cs
- ReturnEventArgs.cs
- GeometryValueSerializer.cs
- StaticResourceExtension.cs
- Point3DCollectionValueSerializer.cs
- AttributeEmitter.cs
- SqlNodeAnnotations.cs
- DataRecord.cs
- KerberosReceiverSecurityToken.cs
- UnsignedPublishLicense.cs
- WindowsAuthenticationModule.cs
- CellRelation.cs
- controlskin.cs
- PerformanceCounterManager.cs
- ReadingWritingEntityEventArgs.cs
- VectorAnimation.cs
- SqlCommandSet.cs
- PeerSecurityManager.cs
- ProxyHwnd.cs
- TableLayout.cs
- CodeChecksumPragma.cs
- CapabilitiesUse.cs
- PartitionResolver.cs
- SamlAttribute.cs
- WeakReferenceList.cs
- SafeEventLogWriteHandle.cs
- DeviceContexts.cs
- OleDbError.cs
- ExtensionQuery.cs
- EventBuilder.cs
- References.cs
- Math.cs
- UMPAttributes.cs
- InternalConfigSettingsFactory.cs
- TextEditorMouse.cs