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

定義

嘗試在雜湊演算法處理最後資料後完成雜湊計算。

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>

緩衝區用來接收雜湊值。

bytesWritten
Int32

當此方法回傳時,包含寫入 destination的總位元組數。 此參數被視為未初始化。

傳回

true 如果 destination 足夠長以接收雜湊值;否則, false

備註

此方法的預設實作是呼叫 HashFinal() 並將結果複製到 destination

衍生型別應覆寫此方法,以避免中間陣列建立。

所有類別 HashAlgorithm 呼叫此方法時,根據性質已驗證其 destination 長度足夠 HashSize ,因此 false 回傳值是意料之外的。

適用於