C# Класс Jebtek.RdRand.RdRandom

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
IntToBytes ( uint input ) : byte[]

Описание методов

GenerateAPIKey() публичный статический Метод

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
Результат string

GenerateBytes() публичный статический Метод

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
Результат byte[]

GenerateKey() публичный статический Метод

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
Результат string

GenerateUnsignedInt() публичный статический Метод

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
Результат uint

GeneratorAvailable() публичный статический Метод

Checks for CPU compatibility with the RDRAND instruction. The RDRAND instruction is only available on Intel IvyBridge and higher CPUs.
public static GeneratorAvailable ( ) : bool
Результат bool