SHA1CryptoServiceProvider Class

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Computes the SHA1 hash value for the input data using the implementation provided by the cryptographic service provider (CSP). This class cannot be inherited.

Namespace:   System.Security.Cryptography
Assembly:  mscorlib (in mscorlib.dll)

System::Object
  System.Security.Cryptography::HashAlgorithm
    System.Security.Cryptography::SHA1
      System.Security.Cryptography::SHA1CryptoServiceProvider

[ComVisibleAttribute(true)]
public ref class SHA1CryptoServiceProvider sealed : SHA1

NameDescription
System_CAPS_pubmethodSHA1CryptoServiceProvider()

Initializes a new instance of the SHA1CryptoServiceProvider class.

NameDescription
System_CAPS_pubpropertyCanReuseTransform

Gets a value indicating whether the current transform can be reused.(Inherited from HashAlgorithm.)

System_CAPS_pubpropertyCanTransformMultipleBlocks

When overridden in a derived class, gets a value indicating whether multiple blocks can be transformed.(Inherited from HashAlgorithm.)

System_CAPS_pubpropertyHash

Gets the value of the computed hash code.(Inherited from HashAlgorithm.)

System_CAPS_pubpropertyHashSize

Gets the size, in bits, of the computed hash code.(Inherited from HashAlgorithm.)

System_CAPS_pubpropertyInputBlockSize

When overridden in a derived class, gets the input block size.(Inherited from HashAlgorithm.)

System_CAPS_pubpropertyOutputBlockSize

When overridden in a derived class, gets the output block size.(Inherited from HashAlgorithm.)

NameDescription
System_CAPS_pubmethodClear()

Releases all resources used by the HashAlgorithm class.(Inherited from HashAlgorithm.)

System_CAPS_pubmethodComputeHash(array<Byte>^)

Computes the hash value for the specified byte array.(Inherited from HashAlgorithm.)

System_CAPS_pubmethodComputeHash(array<Byte>^, Int32, Int32)

Computes the hash value for the specified region of the specified byte array.(Inherited from HashAlgorithm.)

System_CAPS_pubmethodComputeHash(Stream^)

Computes the hash value for the specified Stream object.(Inherited from HashAlgorithm.)

System_CAPS_pubmethodDispose()

Releases all resources used by the current instance of the HashAlgorithm class.(Inherited from HashAlgorithm.)

System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitialize()

Initializes an instance of SHA1CryptoServiceProvider.(Overrides HashAlgorithm::Initialize().)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodTransformBlock(array<Byte>^, Int32, Int32, array<Byte>^, Int32)

Computes the hash value for the specified region of the input byte array and copies the specified region of the input byte array to the specified region of the output byte array.(Inherited from HashAlgorithm.)

System_CAPS_pubmethodTransformFinalBlock(array<Byte>^, Int32, Int32)

Computes the hash value for the specified region of the specified byte array.(Inherited from HashAlgorithm.)

NameDescription
System_CAPS_protfieldHashValue

Represents the value of the computed hash code.(Inherited from HashAlgorithm.)

The hash size for the SHA1CryptoServiceProvider class is 160 bits.

System_CAPS_importantImportant

This type implements the IDisposable interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Dispose method in a try/catch block. To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). For more information, see the “Using an Object that Implements IDisposable” section in the IDisposable interface topic.

The following code example computes the SHA1 hash value for data and stores it in result. This example assumes that there is a predefined constant DATA_SIZE.

array<Byte>^ data = gcnew array<Byte>( DATA_SIZE );

array<Byte>^ result;

SHA1^ sha = gcnew SHA1CryptoServiceProvider;

// This is one implementation of the abstract class SHA1.
result = sha->ComputeHash( data );

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: