Share via


Crypto.HashPassword Method

Returns an RFC 2898 hash value for the specified password.

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

Syntax

'Declaration
Public Shared Function HashPassword ( _
    password As String _
) As String
'Usage
Dim password As String 
Dim returnValue As String 

returnValue = Crypto.HashPassword(password)
public static string HashPassword(
    string password
)
public:
static String^ HashPassword(
    String^ password
)
static member HashPassword : 
        password:string -> string
public static function HashPassword(
    password : String
) : String

Parameters

  • password
    Type: System.String
    The password to generate a hash value for.

Return Value

Type: System.String
The hash value for password as a base-64-encoded string.

Exceptions

Exception Condition
ArgumentNullException

password is null reference (Nothing in Visual Basic).

Remarks

The password hash is generated with the RFC 2898 algorithm using a 128-bit salt, a 256-bit subkey, and 1000 iterations. The format of the generated hash bytestream is {0x00, salt, subkey}, which is base-64 encoded before it is returned.

See Also

Reference

Crypto Class

System.Web.Helpers Namespace