Struct WrappedStreamRNG
Takes a RandomStream (ex: SystemEntropyStream
or HashDRBGStream
) and
wraps it into a UniformRNG InputRange.
Note that to conform to the expected InputRange interface, this must keep a
copy of the last generated value in memory. If using this for security-related
purposes, it may occasionally be appropriate to make an extra popFront
()
call before and/or after retreiving entropy values. This may decrease the
chance of using a compromized entropy value in the event of a
memory-sniffing attacker.
Fields
Name | Type | Description |
---|---|---|
empty
|
void |
Infinite range. Never empty .
|
inited
|
bool |
|
isUniformRandom
|
void |
Mark this as a Rng |
min
|
void |
Smallest generated value. |
stream
|
RandomStream |
Access to underlying RandomStream so RNG-specific functionality can be accessed. |
_front
|
StaticUByteArr |
Methods
Name | Description |
---|---|
front
|
Implements an InputRange |
max
|
Largest generated value. |
popFront
|
Implements an InputRange |
Declaration
struct WrappedStreamRNG(RandomStream, StaticUByteArr) if(isRandomStream!RandomStream && isStaticArray!StaticUByteArr && is(ElementType!StaticUByteArr==ubyte)) {...}