HashAlgorithm.TryComputeHash(ReadOnlySpan<Byte>, Span<Byte>, Int32) 方法

定义

尝试计算指定字节数组的哈希值。Attempts to compute the hash value for the specified byte array.

public:
 bool TryComputeHash(ReadOnlySpan<System::Byte> source, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public bool TryComputeHash (ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten);
member this.TryComputeHash : ReadOnlySpan<byte> * Span<byte> * int -> bool
Public Function TryComputeHash (source As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

参数

source
ReadOnlySpan<Byte>

要计算其哈希代码的输入。The input to compute the hash code for.

destination
Span<Byte>

要接收哈希值的缓冲区。The buffer to receive the hash value.

bytesWritten
Int32

此方法返回时,为写入 destination 的字节总数。When this method returns, the total number of bytes written into destination. 将此参数视为未初始化。This parameter is treated as uninitialized.

返回

true 的长度不足以接收哈希值,则为 destination;否则为 falsetrue if destination is long enough to receive the hash value; otherwise, false.

适用于