Crypto.Hash 方法

定义

重载

Hash(Byte[], String)

返回指定字节数组的哈希值。

Hash(String, String)

返回指定字符串的哈希值。

Hash(Byte[], String)

返回指定字节数组的哈希值。

public static string Hash (byte[] input, string algorithm = "sha256");
static member Hash : byte[] * string -> string
Public Shared Function Hash (input As Byte(), Optional algorithm As String = "sha256") As String

参数

input
Byte[]

要为其提供哈希值的数据。

algorithm
String

用于生成哈希值的算法。 默认值为“sha256”。

返回

作为 input 十六进制字符字符串的 哈希值。

例外

input 为 null。

适用于

Hash(String, String)

返回指定字符串的哈希值。

public static string Hash (string input, string algorithm = "sha256");
static member Hash : string * string -> string
Public Shared Function Hash (input As String, Optional algorithm As String = "sha256") As String

参数

input
String

要为其提供哈希值的数据。

algorithm
String

用于生成哈希值的算法。 默认值为“sha256”。

返回

作为 input 十六进制字符字符串的 哈希值。

例外

input 为 null。

适用于