Table of Contents

Class RandomNumberGenerator

Namespace
CryptoHives.Foundation.Security.Cryptography.Rng
Assembly
CryptoHives.Foundation.Security.Cryptography.dll

Polyfill for RandomNumberGenerator.

public class RandomNumberGenerator : IDisposable
Inheritance
RandomNumberGenerator
Implements
Inherited Members

Methods

Create()

When overridden in a derived class, creates an instance of the default implementation of a cryptographic random number generator that can be used to generate random data.

public static RandomNumberGenerator Create()

Returns

RandomNumberGenerator

A new instance of a cryptographic random number generator.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

When overridden in a derived class, releases the unmanaged resources used by the RandomNumberGenerator and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Fill(byte[])

Fills the specified span with cryptographically strong random bytes.

public static void Fill(byte[] data)

Parameters

data byte[]

Fill(Span<byte>)

Fills the specified span with cryptographically strong random bytes.

public static void Fill(Span<byte> data)

Parameters

data Span<byte>

GetBytes(byte[])

When overridden in a derived class, fills an array of bytes with a cryptographically strong random sequence of values.

public void GetBytes(byte[] data)

Parameters

data byte[]

The array to fill with cryptographically strong random bytes.

GetBytes(byte[], int, int)

Fills the specified byte array with a cryptographically strong random sequence of values.

public void GetBytes(byte[] data, int offset, int count)

Parameters

data byte[]

The array to fill with cryptographically strong random bytes.

offset int

The index of the array to start the fill operation.

count int

The number of bytes to fill.

Exceptions

ArgumentNullException

data is null.

ArgumentOutOfRangeException

offset or count is less than 0

ArgumentException

offset plus count exceeds the length of data.

GetBytes(Span<byte>)

Fills a span with cryptographically strong random bytes.

public void GetBytes(Span<byte> data)

Parameters

data Span<byte>