DSA.TryHashData 方法

定義

嘗試在所提供緩衝區中計算所提供資料的雜湊值。

C#
protected virtual bool TryHashData(ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten);

參數

data
ReadOnlySpan<Byte>

要雜湊的資料。

destination
Span<Byte>

要接收雜湊值的位元組範圍。

hashAlgorithm
HashAlgorithmName

要使用的雜湊演算法的名稱。

bytesWritten
Int32

當此方法傳回時,會包含一個值,指出寫入 destination 的位元組數。

傳回

destination 夠大可接收結果,則為 true;否則為 false

備註

此方法預設實作是呼叫 HashData(Byte[], Int32, Int32, HashAlgorithmName) 並將結果 destination複製到 。

衍生型別應該覆寫這個方法,以避免建立中繼陣列。

適用於

產品 版本
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1