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

定義

使用指定的演算法來,將結果寫入提供的緩衝區,以嘗試計算所提供資料的雜湊。Attempts to compute the hash of the provided data by using the specified algorithm, writing the results 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 buffer to receive the hash value.

hashAlgorithm
HashAlgorithmName

要用來雜湊資料的演算法。The algorithm to use in hash the data.

bytesWritten
Int32

當這個方法傳回時,寫入 destination 的位元組總數。When this method returns, the total number of bytes written into destination. 這個參數會被視為未初始化。This parameter is treated as uninitialized.

傳回

Boolean

如果 destination 的長度足以接收雜湊值,則為 true;否則為 falsetrue if destination is long enough to receive the hash value; otherwise, false.

備註

這個方法的預設執行會呼叫 HashData(Byte[], Int32, Int32, HashAlgorithmName) 並將結果複製到 destinationThe default implementation of this method calls HashData(Byte[], Int32, Int32, HashAlgorithmName) and copies the result to destination. 衍生類型應覆寫這個方法,以避免建立中繼陣列。Derived types should override this method to avoid the intermediate array creation.

適用於