C# Class Jebtek.RdRand.RdRandom

Afficher le fichier Open project: JebteK/RdRand Class Usage Examples

Méthodes publiques

Méthode Description
GenerateAPIKey ( ) : string

Generates a 64 character long key that can be used as an API key. This can only be run on compatible Intel CPUs.

GenerateBytes ( int length ) : byte[]

Uses the RDRAND instrution on Intel IvyBridge and higher CPUs to return truely random byte arrays. CAUTION: If this code is executed on non IvyBridge CPUs, it will return null!

GenerateKey ( int length ) : string

Returns a base64 encoded string of a series of random(perhaps ish) bytes. On Intel IvyBridge and higher CPUs, the byte array is truely random, using the RDRAND assembly instruction to get the CPU to retrieve them. On other processors, the byte array is pseudo random, using the current time as a seed value.

GenerateUnsignedInt ( ) : uint

Uses the RDRAND instrution on Intel IvyBridge and higher CPUs to return truely random integers. CAUTION: If this code is executed on non IvyBridge CPUs, it will return null!

GeneratorAvailable ( ) : bool

Checks for CPU compatibility with the RDRAND instruction. The RDRAND instruction is only available on Intel IvyBridge and higher CPUs.

Private Methods

Méthode Description
IntToBytes ( uint input ) : byte[]

Method Details

GenerateAPIKey() public static méthode

Generates a 64 character long key that can be used as an API key. This can only be run on compatible Intel CPUs.
public static GenerateAPIKey ( ) : string
Résultat string

GenerateBytes() public static méthode

Uses the RDRAND instrution on Intel IvyBridge and higher CPUs to return truely random byte arrays. CAUTION: If this code is executed on non IvyBridge CPUs, it will return null!
public static GenerateBytes ( int length ) : byte[]
length int Size of the byte array
Résultat byte[]

GenerateKey() public static méthode

Returns a base64 encoded string of a series of random(perhaps ish) bytes. On Intel IvyBridge and higher CPUs, the byte array is truely random, using the RDRAND assembly instruction to get the CPU to retrieve them. On other processors, the byte array is pseudo random, using the current time as a seed value.
public static GenerateKey ( int length ) : string
length int Length (in bytes) / size of the byte array
Résultat string

GenerateUnsignedInt() public static méthode

Uses the RDRAND instrution on Intel IvyBridge and higher CPUs to return truely random integers. CAUTION: If this code is executed on non IvyBridge CPUs, it will return null!
public static GenerateUnsignedInt ( ) : uint
Résultat uint

GeneratorAvailable() public static méthode

Checks for CPU compatibility with the RDRAND instruction. The RDRAND instruction is only available on Intel IvyBridge and higher CPUs.
public static GeneratorAvailable ( ) : bool
Résultat bool