Share via


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)

Syntax

'Declaration
Public Shared Function GenerateSalt ( _
    byteLength As Integer _
) As String
'Usage
Dim byteLength As Integer 
Dim returnValue As String 

returnValue = Crypto.GenerateSalt(byteLength)
public static string GenerateSalt(
    int byteLength
)
public:
static String^ GenerateSalt(
    int byteLength
)
static member GenerateSalt : 
        byteLength:int -> string
public static function GenerateSalt(
    byteLength : int
) : String

Parameters

  • 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.

Remarks

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

See Also

Reference

Crypto Class

System.Web.Helpers Namespace