DSA.TryHashData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, Int32) 方法

定义

尝试将所提供数据的哈希值计算到所提供的缓冲区中。Attempts to compute the hash value of the provided data into a provided buffer.

protected:
 virtual bool TryHashData(ReadOnlySpan<System::Byte> data, Span<System::Byte> destination, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, [Runtime::InteropServices::Out] int % bytesWritten);
protected virtual bool TryHashData (ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten);
abstract member TryHashData : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.HashAlgorithmName * int -> bool
override this.TryHashData : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.HashAlgorithmName * int -> bool
Protected Overridable Function TryHashData (data As ReadOnlySpan(Of Byte), destination As Span(Of Byte), hashAlgorithm As HashAlgorithmName, ByRef bytesWritten As Integer) As Boolean

参数

data
ReadOnlySpan<Byte>

要进行哈希处理的数据。The data to be hashed.

destination
Span<Byte>

接收哈希值的字节范围。The byte span to receive the hash value.

hashAlgorithm
HashAlgorithmName

要使用的哈希算法的名称。The name of the hash algorithm to use.

bytesWritten
Int32

此方法返回时,包含一个指示写入 destination 的字节数的值。When this method returns, contains a value that indicates the number of bytes written to destination.

返回

如果 true 足够大可以接收结果,则为 destination;否则为 falsetrue if destination is large enough to receive the result; otherwise, false.

注解

此方法的默认实现是调用 HashData(Byte[], Int32, Int32, HashAlgorithmName),并将结果复制到 destinationThe default implementation of this method is to call HashData(Byte[], Int32, Int32, HashAlgorithmName) and copy the result to destination.

派生类型应重写此方法,以避免中间数组创建。Derived types should override this method to avoid the intermediate array creation.

适用于