Share via


Crypto.Hash Method (Byte[], String)

Returns a hash value for the specified byte array.

Namespace:  System.Web.Helpers
Assembly:  System.Web.Helpers (in System.Web.Helpers.dll)

Syntax

'Declaration
Public Shared Function Hash ( _
    input As Byte(), _
    algorithm As String _
) As String
'Usage
Dim input As Byte()
Dim algorithm As String 
Dim returnValue As String 

returnValue = Crypto.Hash(input, algorithm)
public static string Hash(
    byte[] input,
    string algorithm
)
public:
static String^ Hash(
    array<unsigned char>^ input, 
    String^ algorithm
)
static member Hash : 
        input:byte[] * 
        algorithm:string -> string
public static function Hash(
    input : byte[], 
    algorithm : String
) : String

Parameters

  • input
    Type: System.Byte[]
    The data to provide a hash value for.
  • algorithm
    Type: System.String
    The algorithm that is used to generate the hash value. The default is "sha256".

Return Value

Type: System.String
The hash value for input as a string of hexadecimal characters.

Exceptions

Exception Condition
ArgumentNullException

input is null reference (Nothing in Visual Basic).

See Also

Reference

Crypto Class

Hash Overload

System.Web.Helpers Namespace