SHA256.HashData 方法

定义

重载

HashData(Byte[])

使用 SHA256 算法计算数据的哈希值。Computes the hash of data using the SHA256 algorithm.

HashData(ReadOnlySpan<Byte>)

使用 SHA256 算法计算数据的哈希值。Computes the hash of data using the SHA256 algorithm.

HashData(ReadOnlySpan<Byte>, Span<Byte>)

使用 SHA256 算法计算数据的哈希值。Computes the hash of data using the SHA256 algorithm.

HashData(Byte[])

使用 SHA256 算法计算数据的哈希值。Computes the hash of data using the SHA256 algorithm.

public:
 static cli::array <System::Byte> ^ HashData(cli::array <System::Byte> ^ source);
public static byte[] HashData (byte[] source);
static member HashData : byte[] -> byte[]
Public Shared Function HashData (source As Byte()) As Byte()

参数

source
Byte[]

要进行哈希处理的数据。The data to hash.

返回

Byte[]

数据的哈希。The hash of the data.

例外

source 上声明的默认值为 nullsource is null.

适用于

HashData(ReadOnlySpan<Byte>)

使用 SHA256 算法计算数据的哈希值。Computes the hash of data using the SHA256 algorithm.

public:
 static cli::array <System::Byte> ^ HashData(ReadOnlySpan<System::Byte> source);
public static byte[]? HashData (ReadOnlySpan<byte> source);
static member HashData : ReadOnlySpan<byte> -> byte[]
Public Shared Function HashData (source As ReadOnlySpan(Of Byte)) As Byte()

参数

source
ReadOnlySpan<Byte>

要进行哈希处理的数据。The data to hash.

返回

Byte[]

数据的哈希。The hash of the data.

适用于

HashData(ReadOnlySpan<Byte>, Span<Byte>)

使用 SHA256 算法计算数据的哈希值。Computes the hash of data using the SHA256 algorithm.

public:
 static int HashData(ReadOnlySpan<System::Byte> source, Span<System::Byte> destination);
public static int HashData (ReadOnlySpan<byte> source, Span<byte> destination);
static member HashData : ReadOnlySpan<byte> * Span<byte> -> int
Public Shared Function HashData (source As ReadOnlySpan(Of Byte), destination As Span(Of Byte)) As Integer

参数

source
ReadOnlySpan<Byte>

要进行哈希处理的数据。The data to hash.

destination
Span<Byte>

要接收哈希值的缓冲区。The buffer to receive the hash value.

返回

Int32

写入 destination 的总字节数。The total number of bytes written to destination.

例外

destination 中的缓冲区太小,无法容纳计算所得的哈希大小。The buffer in destination is too small to hold the calculated hash size. SHA256 算法始终会生成 256 位的哈希或 32 个字节。The SHA256 algorithm always produces a 256-bit hash, or 32 bytes.

适用于