Crypto.GenerateSalt Method

Generates a cryptographically strong sequence of random byte values.

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

public static string GenerateSalt(
	int byteLength


Type: System.Int32
The number of cryptographically random bytes to generate.

Return Value

Type: System.String
The generated salt value as a base-64-encoded string.

Due to base-64 encoding, the returned string will contain more characters than the number of bytes requested.

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