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)

public static string HashPassword(
	string 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.


password is null.

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.

  • Medium trust for the immediate caller. This member can be used by partially trusted code.