RandomNumberGenerator.GetHexString Method

Definition

Overloads

GetHexString(Int32, Boolean)

Creates a string filled with cryptographically random hexadecimal characters.

GetHexString(Span<Char>, Boolean)

Fills a buffer with cryptographically random hexadecimal characters.

GetHexString(Int32, Boolean)

Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs

Creates a string filled with cryptographically random hexadecimal characters.

public static string GetHexString (int stringLength, bool lowercase = false);
static member GetHexString : int * bool -> string
Public Shared Function GetHexString (stringLength As Integer, Optional lowercase As Boolean = false) As String

Parameters

stringLength
Int32

The length of string to create.

lowercase
Boolean

true if the hexadecimal characters should be lowercase; false if they should be uppercase. The default is false.

Returns

A string populated with random hexadecimal characters.

Remarks

The behavior of this is the same as using GetString(ReadOnlySpan<Char>, Int32) and specifying hexadecimal characters as the choices. This implementation is optimized specifically for hexadecimal characters.

Applies to

GetHexString(Span<Char>, Boolean)

Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs

Fills a buffer with cryptographically random hexadecimal characters.

public static void GetHexString (Span<char> destination, bool lowercase = false);
static member GetHexString : Span<char> * bool -> unit
Public Shared Sub GetHexString (destination As Span(Of Char), Optional lowercase As Boolean = false)

Parameters

destination
Span<Char>

The buffer to receive the characters.

lowercase
Boolean

true if the hexadecimal characters should be lowercase; false if they should be uppercase. The default is false.

Remarks

The behavior of this is the same as using GetItems<T>(ReadOnlySpan<T>, Span<T>) and specifying hexadecimal characters as the choices. This implementation is optimized specifically for hexadecimal characters.

Applies to