CryptographicOperations.HashDataAsync 方法

定义

异步计算流的哈希。

重载

HashDataAsync(HashAlgorithmName, Stream, CancellationToken)

Source:
CryptographicOperations.cs
Source:
CryptographicOperations.cs
Source:
CryptographicOperations.cs

异步计算流的哈希。

public static System.Threading.Tasks.ValueTask<byte[]> HashDataAsync(System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default);
static member HashDataAsync : System.Security.Cryptography.HashAlgorithmName * System.IO.Stream * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<byte[]>
Public Shared Function HashDataAsync (hashAlgorithm As HashAlgorithmName, source As Stream, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Byte())

参数

hashAlgorithm
HashAlgorithmName

用于计算哈希的算法。

source
Stream

要哈希的流。

cancellationToken
CancellationToken

用于监视取消请求的令牌。 默认值为 None

返回

数据的哈希。

例外

sourcenull

-或者-

hashAlgorithm 有一个 Name 就是 null

hashAlgorithm 有一个 Name 为空的。

-或者-

source 不支持读取。

hashAlgorithm 指定当前平台不支持的哈希算法。

hashAlgorithm 指定未知哈希算法。

cancellationToken 已取消。

适用于

HashDataAsync(HashAlgorithmName, Stream, Memory<Byte>, CancellationToken)

Source:
CryptographicOperations.cs
Source:
CryptographicOperations.cs
Source:
CryptographicOperations.cs

异步计算流的哈希。

public static System.Threading.Tasks.ValueTask<int> HashDataAsync(System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.IO.Stream source, Memory<byte> destination, System.Threading.CancellationToken cancellationToken = default);
static member HashDataAsync : System.Security.Cryptography.HashAlgorithmName * System.IO.Stream * Memory<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<int>
Public Shared Function HashDataAsync (hashAlgorithm As HashAlgorithmName, source As Stream, destination As Memory(Of Byte), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Integer)

参数

hashAlgorithm
HashAlgorithmName

用于计算哈希的算法。

source
Stream

要哈希的流。

destination
Memory<Byte>

要接收哈希值的缓冲区。

cancellationToken
CancellationToken

用于监视取消请求的令牌。 默认值为 None

返回

写入到 destination的字节总数。

例外

sourcenull

-或者-

hashAlgorithm 有一个 Name 就是 null

缓冲区 destination 太小,无法容纳计算的哈希大小。

-或者-

hashAlgorithm 有一个 Name 为空的。

-或者-

source 不支持读取。

hashAlgorithm 指定当前平台不支持的哈希算法。

hashAlgorithm 指定未知哈希算法。

cancellationToken 已取消。

适用于