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

定义

在哈希算法处理最后一个数据后,尝试结束哈希计算。Attempts to finalize the hash computation after the last data is processed by the hash algorithm.

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

参数

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.

注解

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

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

HashAlgorithm 类对此方法的所有调用都已经验证 destination 的时间是否足以根据 HashSize 属性,因此 false 返回值是意外的。All calls to this method by the HashAlgorithm class have already verified that destination is long enough based on the HashSize property, so false return values are unexpected.

适用于