Language

RandomNumberGenerator.GetHexString Method

Definition

Fills a buffer with cryptographically random hexadecimal characters.

Overloads

Name Description
GetHexString(Int32, Boolean)

Creates a string filled with cryptographically random hexadecimal characters.

GetHexString(Span, Boolean)

Fills a buffer with cryptographically random hexadecimal characters.

GetHexString(Int32, Boolean)

Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs
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, Int32) and specifying hexadecimal characters as the choices. This implementation is optimized specifically for hexadecimal characters.

Applies to

GetHexString(Span, Boolean)

Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs

Fills a buffer with cryptographically random hexadecimal characters.

public static void GetHexString(Span destination, bool lowercase = false);
static member GetHexString : Span * 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(ReadOnlySpan, Span) and specifying hexadecimal characters as the choices. This implementation is optimized specifically for hexadecimal characters.

Applies to