КриптоПро .NET
Search Results for

    Показать/Скрыть содержание

    Class CpIncrementalHash

    Provides support for computing a hash or HMAC value incrementally across several segments.

    Inheritance
    object
    CpIncrementalHash
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: CryptoPro.Security.Cryptography
    Assembly: CryptoPro.Security.Cryptography.dll
    Syntax
    public sealed class CpIncrementalHash : IDisposable

    Properties

    AlgorithmName

    Get the name of the algorithm being performed.

    Declaration
    public HashAlgorithmName AlgorithmName { get; }
    Property Value
    Type Description
    HashAlgorithmName

    Methods

    AppendData(byte[])

    Append the entire contents of data to the data already processed in the hash or HMAC.

    Declaration
    public void AppendData(byte[] data)
    Parameters
    Type Name Description
    byte[] data

    The data to process.

    Exceptions
    Type Condition
    ArgumentNullException

    data is null.

    ObjectDisposedException

    The object has already been disposed.

    AppendData(byte[], int, int)

    Append count bytes of data, starting at offset, to the data already processed in the hash or HMAC.

    Declaration
    public void AppendData(byte[] data, int offset, int count)
    Parameters
    Type Name Description
    byte[] data

    The data to process.

    int offset

    The offset into the byte array from which to begin using data.

    int count

    The number of bytes in the array to use as data.

    Exceptions
    Type Condition
    ArgumentNullException

    data is null.

    ArgumentOutOfRangeException

    offset is out of range. This parameter requires a non-negative number.

    ArgumentOutOfRangeException

    count is out of range. This parameter requires a non-negative number less than the Length value of data.

    ArgumentException

    count is greater than data.Length - offset.

    ObjectDisposedException

    The object has already been disposed.

    AppendData(ReadOnlySpan<byte>)

    Declaration
    public void AppendData(ReadOnlySpan<byte> data)
    Parameters
    Type Name Description
    ReadOnlySpan<byte> data

    CreateHMAC(HashAlgorithmName, byte[])

    Create an CpIncrementalHash for the Hash-based Message Authentication Code (HMAC) algorithm utilizing the hash algorithm specified by hashAlgorithm, and a key specified by key.

    Declaration
    public static CpIncrementalHash CreateHMAC(HashAlgorithmName hashAlgorithm, byte[] key)
    Parameters
    Type Name Description
    HashAlgorithmName hashAlgorithm

    The name of the hash algorithm to perform within the HMAC.

    byte[] key

    The secret key for the HMAC. The key can be any length, but a key longer than the output size of the hash algorithm specified by hashAlgorithm will be hashed (using the algorithm specified by hashAlgorithm) to derive a correctly-sized key. Therefore, the recommended size of the secret key is the output size of the hash specified by hashAlgorithm.

    Returns
    Type Description
    CpIncrementalHash

    An CpIncrementalHash instance ready to compute the hash algorithm specified by hashAlgorithm.

    Exceptions
    Type Condition
    ArgumentException

    hashAlgorithm.Name is null, or the empty string.

    CryptographicException

    hashAlgorithm is not a known hash algorithm.

    CreateHash(HashAlgorithmName)

    Create an CpIncrementalHash for the algorithm specified by hashAlgorithm.

    Declaration
    public static CpIncrementalHash CreateHash(HashAlgorithmName hashAlgorithm)
    Parameters
    Type Name Description
    HashAlgorithmName hashAlgorithm

    The name of the hash algorithm to perform.

    Returns
    Type Description
    CpIncrementalHash

    An CpIncrementalHash instance ready to compute the hash algorithm specified by hashAlgorithm.

    Exceptions
    Type Condition
    ArgumentException

    hashAlgorithm.Name is null, or the empty string.

    CryptographicException

    hashAlgorithm is not a known hash algorithm.

    Dispose()

    Release all resources used by the current instance of the CpIncrementalHash class.

    Declaration
    public void Dispose()

    GetHashAndReset()

    Retrieve the hash or HMAC for the data accumulated from prior calls to AppendData(byte[]), and return to the state the object was in at construction.

    Declaration
    public byte[] GetHashAndReset()
    Returns
    Type Description
    byte[]

    The computed hash or HMAC.

    Exceptions
    Type Condition
    ObjectDisposedException

    The object has already been disposed.

    TryGetHashAndReset(Span<byte>, out int)

    Declaration
    public bool TryGetHashAndReset(Span<byte> destination, out int bytesWritten)
    Parameters
    Type Name Description
    Span<byte> destination
    int bytesWritten
    Returns
    Type Description
    bool

    Implements

    IDisposable
    В этом разделе
    Наверх Generated by DocFX