HashAlgorithm::TransformBlock Method
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.
Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)
public: virtual int TransformBlock( array<unsigned char>^ inputBuffer, int inputOffset, int inputCount, array<unsigned char>^ outputBuffer, int outputOffset ) sealed
Parameters
- inputBuffer
- Type: array<System::Byte>
The input to compute the hash code for.
- inputOffset
- Type: System::Int32
The offset into the input byte array from which to begin using data.
- inputCount
- Type: System::Int32
The number of bytes in the input byte array to use as data.
- outputBuffer
- Type: array<System::Byte>
A copy of the part of the input array used to compute the hash code.
- outputOffset
- Type: System::Int32
The offset into the output byte array from which to begin writing data.
Implements
ICryptoTransform::TransformBlock(array<Byte>, Int32, Int32, array<Byte>, Int32)| Exception | Condition |
|---|---|
| ArgumentException | inputCount uses an invalid value. -or- inputBuffer has an invalid length. |
| ArgumentNullException | inputBuffer is nullptr. |
| ArgumentOutOfRangeException | inputOffset is out of range. This parameter requires a non-negative number. |
| ObjectDisposedException | The object has already been disposed. |
You must call the TransformBlock method before calling the TransformFinalBlock method. You must call both methods before you retrieve the final hash value.
To retrieve the final hash value after calling the TransformFinalBlock method, get the byte array contained within the Hash property.
Calling the TransformBlock method with different input and output arrays results in an IOException.
The following code examples use the TransformFinalBlock method with the TransformBlock method to hash a string.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.