HMACSHA256.TryHashData 方法

定义

尝试使用 SHA256 算法计算数据的 HMAC。

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

参数

key
ReadOnlySpan<Byte>

HMAC 密钥。

source
ReadOnlySpan<Byte>

HMAC 的数据。

destination
Span<Byte>

要接收 HMAC 值的缓冲区。

bytesWritten
Int32

此方法返回时,为写入 destination 的字节总数。

返回

如果 destination 太小,无法容纳计算所得的哈希,则为 false;否则为 true

适用于