C# Class Demot.RandomOrgApi.RandomOrgApiClient

A wrapper for the Random.org API.
Datei anzeigen Open project: ProActiveGames/randraw

Public Methods

Method Description
GenerateBlobs ( int n, int size, bool signed, string format = "base64" ) : System.Net.Response

Generates Binary Large Objects (BLOBs) containing true random data.

GenerateBlobs ( int n, int size, int id, bool signed, string format = "base64" ) : System.Net.Response

Generates Binary Large Objects (BLOBs) containing true random data.

GenerateBlobs ( int n, int size, int id, string format = "base64" ) : System.Net.Response

Generates Binary Large Objects (BLOBs) containing true random data.

GenerateBlobs ( int n, int size, string format = "base64" ) : System.Net.Response

Generates Binary Large Objects (BLOBs) containing true random data.

GenerateDecimalFractions ( int n, byte decimalPlaces, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random decimal fractions.

GenerateDecimalFractions ( int n, byte decimalPlaces, bool signed, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random decimal fractions.

GenerateDecimalFractions ( int n, byte decimalPlaces, int id, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random decimal fractions.

GenerateDecimalFractions ( int n, byte decimalPlaces, int id, bool signed, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random decimal fractions.

GenerateGaussians ( int n, double mean, double standardDeviation, byte significantDigits ) : System.Net.Response

Generates true random numbers from a gaussian distribution.

GenerateGaussians ( int n, double mean, double standardDeviation, byte significantDigits, bool signed ) : System.Net.Response

Generates true random numbers from a gaussian distribution.

GenerateGaussians ( int n, double mean, double standardDeviation, byte significantDigits, int id ) : System.Net.Response

Generates true random numbers from a gaussian distribution.

GenerateGaussians ( int n, double mean, double standardDeviation, byte significantDigits, int id, bool signed ) : System.Net.Response

Generates true random numbers from a gaussian distribution.

GenerateIntegers ( int n, int min, int max, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random integers.

GenerateIntegers ( int n, int min, int max, bool signed, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random integers.

GenerateIntegers ( int n, int min, int max, int id, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random integers.

GenerateIntegers ( int n, int min, int max, int id, bool signed, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random integers.

GenerateStrings ( int n, int length, bool signed, string characters = StringCharacters, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random strings.

GenerateStrings ( int n, int length, int id, bool signed, string characters = StringCharacters, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random strings.

GenerateStrings ( int n, int length, int id, string characters = StringCharacters, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random strings.

GenerateStrings ( int n, int length, string characters = StringCharacters, bool replacement = DefaultReplacement ) : System.Net.Response

Generates true random strings.

GenerateUUIDs ( int n ) : System.Net.Response

Generates true random Universally Unique IDentifiers (UUIDs) specified by RFC 4122.

GenerateUUIDs ( int n, bool signed ) : System.Net.Response

Generates true random Universally Unique IDentifiers (UUIDs) specified by RFC 4122.

GenerateUUIDs ( int n, int id ) : System.Net.Response

Generates true random Universally Unique IDentifiers (UUIDs) specified by RFC 4122.

GenerateUUIDs ( int n, int id, bool signed ) : System.Net.Response

Generates true random Universally Unique IDentifiers (UUIDs) specified by RFC 4122.

GetUsage ( ) : System.Net.Response

Returns information about the usage of the given API key.

GetUsage ( int id ) : System.Net.Response

Returns information about the usage of the given API key.

RandomOrgApiClient ( string apiKey ) : System

Intializes a new instance of the RandomOrgApiClient.

VerifySignature ( object>.System.Collections.Generic.Dictionary recievedObject, string signature ) : bool

Verifies the signature of a signed response previously recieved by random.org.

Private Methods

Method Description
createResponse ( object>.System.Collections.Generic.Dictionary rawResponse, RandomOrgDataType dataType ) : System.Net.Response
createSHA512Hash ( string value ) : string
extractVerification ( object>.System.Collections.Generic.Dictionary rawResponse ) : bool
post ( string request ) : object>.System.Collections.Generic.Dictionary
removeUsageData ( object>.System.Collections.Generic.Dictionary rawResult ) : void
sendRequest ( string method, string methodParams, int id ) : object>.System.Collections.Generic.Dictionary

Method Details

GenerateBlobs() public method

Generates Binary Large Objects (BLOBs) containing true random data.
public GenerateBlobs ( int n, int size, bool signed, string format = "base64" ) : System.Net.Response
n int Number of blobs to generate, must be within the [1, 100] range.
size int Size of each blob, must be within the [1, 2^20] range and must be divisable by 8.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
format string Format to display the blobs, values allow are "base64" and "hex".
return System.Net.Response

GenerateBlobs() public method

Generates Binary Large Objects (BLOBs) containing true random data.
public GenerateBlobs ( int n, int size, int id, bool signed, string format = "base64" ) : System.Net.Response
n int Number of blobs to generate, must be within the [1, 100] range.
size int Size of each blob, must be within the [1, 2^20] range and must be divisable by 8.
id int User defined number which will be returned in the response.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
format string Format to display the blobs, values allow are "base64" and "hex".
return System.Net.Response

GenerateBlobs() public method

Generates Binary Large Objects (BLOBs) containing true random data.
public GenerateBlobs ( int n, int size, int id, string format = "base64" ) : System.Net.Response
n int Number of blobs to generate, must be within the [1, 100] range.
size int Size of each blob, must be within the [1, 2^20] range and must be divisable by 8.
id int User defined number which will be returned in the response.
format string Format to display the blobs, values allow are "base64" and "hex".
return System.Net.Response

GenerateBlobs() public method

Generates Binary Large Objects (BLOBs) containing true random data.
public GenerateBlobs ( int n, int size, string format = "base64" ) : System.Net.Response
n int Number of blobs to generate, must be within the [1, 100] range.
size int Size of each blob, must be within the [1, 2^20] range.
format string Format to display the blobs, values allow are "base64" and "hex".
return System.Net.Response

GenerateDecimalFractions() public method

Generates true random decimal fractions.
public GenerateDecimalFractions ( int n, byte decimalPlaces, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of decimal fractions to generate, must be within the [1, 1e4] range.
decimalPlaces byte Number of decimal places to use, must be within the [1, 20] range.
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateDecimalFractions() public method

Generates true random decimal fractions.
public GenerateDecimalFractions ( int n, byte decimalPlaces, bool signed, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of decimal fractions to generate, must be within the [1, 1e4] range.
decimalPlaces byte Number of decimal places to use, must be within the [1, 20] range.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateDecimalFractions() public method

Generates true random decimal fractions.
public GenerateDecimalFractions ( int n, byte decimalPlaces, int id, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of decimal fractions to generate, must be within the [1, 1e4] range.
decimalPlaces byte Number of decimal places to use, must be within the [1, 20] range.
id int User defined number which will be returned in the response.
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateDecimalFractions() public method

Generates true random decimal fractions.
public GenerateDecimalFractions ( int n, byte decimalPlaces, int id, bool signed, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of decimal fractions to generate, must be within the [1, 1e4] range.
decimalPlaces byte Number of decimal places to use, must be within the [1, 20] range.
id int User defined number which will be returned in the response.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateGaussians() public method

Generates true random numbers from a gaussian distribution.
public GenerateGaussians ( int n, double mean, double standardDeviation, byte significantDigits ) : System.Net.Response
n int Number of gaussians to generate, must be within the [1, 1e4] range.
mean double Distribution's mean, must be within the [-1e6, 1e6] range.
standardDeviation double Distribution's standard deviation, must be within the [-1e6, 1e6] range.
significantDigits byte Number of significant digits to use, must be within the [2, 20] range.
return System.Net.Response

GenerateGaussians() public method

Generates true random numbers from a gaussian distribution.
public GenerateGaussians ( int n, double mean, double standardDeviation, byte significantDigits, bool signed ) : System.Net.Response
n int Number of gaussians to generate, must be within the [1, 1e4] range.
mean double Distribution's mean, must be within the [-1e6, 1e6] range.
standardDeviation double Distribution's standard deviation, must be within the [-1e6, 1e6] range.
significantDigits byte Number of significant digits to use, must be within the [2, 20] range.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
return System.Net.Response

GenerateGaussians() public method

Generates true random numbers from a gaussian distribution.
public GenerateGaussians ( int n, double mean, double standardDeviation, byte significantDigits, int id ) : System.Net.Response
n int Number of gaussians to generate, must be within the [1, 1e4] range.
mean double Distribution's mean, must be within the [-1e6, 1e6] range.
standardDeviation double Distribution's standard deviation, must be within the [-1e6, 1e6] range.
significantDigits byte Number of significant digits to use, must be within the [2, 20] range.
id int User defined number which will be returned in the response.
return System.Net.Response

GenerateGaussians() public method

Generates true random numbers from a gaussian distribution.
public GenerateGaussians ( int n, double mean, double standardDeviation, byte significantDigits, int id, bool signed ) : System.Net.Response
n int Number of gaussians to generate, must be within the [1, 1e4] range.
mean double Distribution's mean, must be within the [-1e6, 1e6] range.
standardDeviation double Distribution's standard deviation, must be within the [-1e6, 1e6] range.
significantDigits byte Number of significant digits to use, must be within the [2, 20] range.
id int User defined number which will be returned in the response.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
return System.Net.Response

GenerateIntegers() public method

Generates true random integers.
public GenerateIntegers ( int n, int min, int max, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of integers to generate, must be within the [1, 1e4] range.
min int Lower boundary for the range, must be within the [-1e9, 1e9] range.
max int Upper boundary for the range, must be within the [-1e9, 1e9] range.
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateIntegers() public method

Generates true random integers.
public GenerateIntegers ( int n, int min, int max, bool signed, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of integers to generate, must be within the [1, 1e4] range.
min int Lower boundary for the range, must be within the [-1e9, 1e9] range.
max int Upper boundary for the range, must be within the [-1e9, 1e9] range.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateIntegers() public method

Generates true random integers.
public GenerateIntegers ( int n, int min, int max, int id, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of integers to generate, must be within the [1, 1e4] range.
min int Lower boundary for the range, must be within the [-1e9, 1e9] range.
max int Upper boundary for the range, must be within the [-1e9, 1e9] range.
id int User defined number which will be returned in the response.
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateIntegers() public method

Generates true random integers.
public GenerateIntegers ( int n, int min, int max, int id, bool signed, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of integers to generate, must be within the [1, 1e4] range.
min int Lower boundary for the range, must be within the [-1e9, 1e9] range.
max int Upper boundary for the range, must be within the [-1e9, 1e9] range.
id int User defined number which will be returned in the response.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateStrings() public method

Generates true random strings.
public GenerateStrings ( int n, int length, bool signed, string characters = StringCharacters, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of strings to generate, must be within the [1, 1e4] range.
length int Length of each generated string, must be within the [1, 20] range.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
characters string Characters to occur in the random strings, maximal length: 80 UTF-8 encoded /// characters. If the value is null, the default value will be used
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateStrings() public method

Generates true random strings.
public GenerateStrings ( int n, int length, int id, bool signed, string characters = StringCharacters, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of strings to generate, must be within the [1, 1e4] range.
length int Length of each generated string, must be within the [1, 20] range.
id int User defined number which will be returned in the response.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
characters string Characters to occur in the random strings, maximal length: 80 UTF-8 encoded /// characters. If the value is null, the default value will be used
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateStrings() public method

Generates true random strings.
public GenerateStrings ( int n, int length, int id, string characters = StringCharacters, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of strings to generate, must be within the [1, 1e4] range.
length int Length of each generated string, must be within the [1, 20] range.
id int User defined number which will be returned in the response.
characters string Characters to occur in the random strings, maximal length: 80 UTF-8 encoded /// characters. If the value is null, the default value will be used
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateStrings() public method

Generates true random strings.
public GenerateStrings ( int n, int length, string characters = StringCharacters, bool replacement = DefaultReplacement ) : System.Net.Response
n int Number of strings to generate, must be within the [1, 1e4] range.
length int Length of each generated string, must be within the [1, 20] range.
characters string Characters to occur in the random strings, maximal length: 80 UTF-8 encoded /// characters. If the value is null, the default value will be used
replacement bool Specifies if numbers should be picked with replacement. If true, the generated numbers may contain /// duplicates, otherwise the picked numbers are unique.
return System.Net.Response

GenerateUUIDs() public method

Generates true random Universally Unique IDentifiers (UUIDs) specified by RFC 4122.
public GenerateUUIDs ( int n ) : System.Net.Response
n int Number of UUIDs to generate, must be within the [1, 1e3] range.
return System.Net.Response

GenerateUUIDs() public method

Generates true random Universally Unique IDentifiers (UUIDs) specified by RFC 4122.
public GenerateUUIDs ( int n, bool signed ) : System.Net.Response
n int Number of UUIDs to generate, must be within the [1, 1e3] range.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
return System.Net.Response

GenerateUUIDs() public method

Generates true random Universally Unique IDentifiers (UUIDs) specified by RFC 4122.
public GenerateUUIDs ( int n, int id ) : System.Net.Response
n int Number of UUIDs to generate, must be within the [1, 1e3] range.
id int User defined number which will be returned in the response.
return System.Net.Response

GenerateUUIDs() public method

Generates true random Universally Unique IDentifiers (UUIDs) specified by RFC 4122.
public GenerateUUIDs ( int n, int id, bool signed ) : System.Net.Response
n int Number of UUIDs to generate, must be within the [1, 1e3] range.
id int User defined number which will be returned in the response.
signed bool Specifies if the result should be signed with a SHA-512 key which you can use to verify it against /// random.org's public key.
return System.Net.Response

GetUsage() public method

Returns information about the usage of the given API key.
public GetUsage ( ) : System.Net.Response
return System.Net.Response

GetUsage() public method

Returns information about the usage of the given API key.
public GetUsage ( int id ) : System.Net.Response
id int User defined number which will be returned in the response.
return System.Net.Response

RandomOrgApiClient() public method

Intializes a new instance of the RandomOrgApiClient.
public RandomOrgApiClient ( string apiKey ) : System
apiKey string API key, used to keep track of the true random bit usage.
return System

VerifySignature() public method

Verifies the signature of a signed response previously recieved by random.org.
public VerifySignature ( object>.System.Collections.Generic.Dictionary recievedObject, string signature ) : bool
recievedObject object>.System.Collections.Generic.Dictionary Signed package previously recieved.
signature string SHA-512 signature to check against with.
return bool