Class BouncyCastleBackupRng
+RNG which uses backup RNGs on error (not seedable!)
+Inherited Members
+ + + +Namespace: wan24.Crypto.BC
+Assembly: wan24CryptoBC.dll
+Syntax
+public class BouncyCastleBackupRng : IBouncyCastleRng, IRandomGenerator, ISeedableRng, IRng, ISeedConsumer
+ Constructors +
+ + | + Edit this page + + + View Source + + +BouncyCastleBackupRng(params IBouncyCastleRng[])
+Constructor
+Declaration
+public BouncyCastleBackupRng(params IBouncyCastleRng[] rngs)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
IBouncyCastleRng[] | +rngs | +RNGs + |
+
Properties +
+ + | + Edit this page + + + View Source + + +RNGs
+RNGs
+Declaration
+public FrozenSet<IBouncyCastleRng> RNGs { get; }
+ Property Value
+Type | +Description | +
---|---|
FrozenSet<IBouncyCastleRng> | ++ |
Methods +
+ + | + Edit this page + + + View Source + + +AddSeed(ReadOnlySpan<byte>)
+Add seed to the RNG
+Declaration
+public void AddSeed(ReadOnlySpan<byte> seed)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
ReadOnlySpan<byte> | +seed | +Seed + |
+
AddSeedAsync(ReadOnlyMemory<byte>, CancellationToken)
+Add seed to the RNG
+Declaration
+public Task AddSeedAsync(ReadOnlyMemory<byte> seed, CancellationToken cancellationToken = default)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
ReadOnlyMemory<byte> | +seed | +Seed + |
+
CancellationToken | +cancellationToken | +Cancellation token + |
+
Returns
+Type | +Description | +
---|---|
Task | ++ |
AddSeedMaterial(byte[])
+Add more seed material to the generator.
+Declaration
+public void AddSeedMaterial(byte[] seed)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
byte[] | +seed | +A byte array to be mixed into the generator's state. + |
+
AddSeedMaterial(long)
+Add more seed material to the generator.
+Declaration
+public void AddSeedMaterial(long seed)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
long | +seed | +A long value to be mixed into the generator's state. + |
+
AddSeedMaterial(ReadOnlySpan<byte>)
+ + +Declaration
+public void AddSeedMaterial(ReadOnlySpan<byte> seed)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
ReadOnlySpan<byte> | +seed | ++ |
FillBytes(in Span<byte>)
+Fill random bytes
+Declaration
+public Span<byte> FillBytes(in Span<byte> buffer)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
Span<byte> | +buffer | +Buffer + |
+
Returns
+Type | +Description | +
---|---|
Span<byte> | +Random bytes + |
+
FillBytesAsync(Memory<byte>, CancellationToken)
+Fill random bytes
+Declaration
+public Task<Memory<byte>> FillBytesAsync(Memory<byte> buffer, CancellationToken cancellationToken = default)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
Memory<byte> | +buffer | +Buffer + |
+
CancellationToken | +cancellationToken | +Cancellation token + |
+
Returns
+Type | +Description | +
---|---|
Task<Memory<byte>> | +Random bytes + |
+
GetBytes(in int)
+Get random bytes
+Declaration
+public byte[] GetBytes(in int count)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
int | +count | +Count + |
+
Returns
+Type | +Description | +
---|---|
byte[] | +Random bytes + |
+
GetBytesAsync(int, CancellationToken)
+Get random bytes
+Declaration
+public Task<byte[]> GetBytesAsync(int count, CancellationToken cancellationToken = default)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
int | +count | +Count + |
+
CancellationToken | +cancellationToken | +Cancellation token + |
+
Returns
+Type | +Description | +
---|---|
Task<byte[]> | +Random bytes + |
+
NextBytes(byte[])
+Fill byte array with random values.
+Declaration
+public void NextBytes(byte[] bytes)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
byte[] | +bytes | +Array to be filled. + |
+
NextBytes(byte[], int, int)
+Fill byte array with random values.
+Declaration
+public void NextBytes(byte[] bytes, int start, int len)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
byte[] | +bytes | +Array to receive bytes. + |
+
int | +start | +Index to start filling at. + |
+
int | +len | +Length of segment to fill. + |
+
NextBytes(Span<byte>)
+ + +Declaration
+public void NextBytes(Span<byte> bytes)
+ Parameters
+Type | +Name | +Description | +
---|---|---|
Span<byte> | +bytes | ++ |