Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Security.​Cryptography.​RNGCryptoServiceProvider
Assembly: System.Security.Cryptography
Inheritance: object → RandomNumberGenerator → RNGCryptoServiceProvider
Implemented Interfaces
- IDisposable Implemented by: RandomNumberGenerator
Implements a cryptographic Random Number Generator (RNG) using the implementation provided by the cryptographic service provider (CSP). This class cannot be inherited.
Methods
protected
void
Dispose​(bool disposing)
public
void
GetBytes​(byte[] data)
Fills an array of bytes with a cryptographically strong sequence of random values.
data
The array to fill with a cryptographically strong sequence of random values.
public
void
GetBytes​(byte[] data,
int offset,
int count)
Fills the specified byte array with a cryptographically strong random sequence of values starting at a specified index for a specified number of bytes.
data
The array to fill with cryptographically strong random bytes.
offset
The index of the array to start the fill operation.
count
The number of bytes to fill.
public
void
GetBytes​(Span<​byte> data)
Fills a span with cryptographically strong random bytes.
data
The span to fill with cryptographically strong random bytes.
public
void
GetNonZeroBytes​(byte[] data)
Fills an array of bytes with a cryptographically strong sequence of random nonzero values.
data
The array to fill with a cryptographically strong sequence of random nonzero values.
public
void
GetNonZeroBytes​(Span<​byte> data)
Fills a byte span with a cryptographically strong random sequence of nonzero values.
data
The span to fill with cryptographically strong random nonzero bytes.
public
void
Dispose​()
Inherited from RandomNumberGenerator
When overridden in a derived class, releases all resources used by the current instance of the <see cref="T:System.Security.Cryptography.RandomNumberGenerator" /> class.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object