Botan

EntropySource

License
Botan is released under the Simplified BSD License (see LICENSE.md)

Class used to accumulate the poll results of EntropySources


this(bool delegate(const(ubyte)*, size_t len, double) accum);

Initialize an EntropyAccumulator

Parameters
bool delegate(const(ubyte)*, size_t len, double) accum a delegate to send the bytes and entropy value

ref SecureVector!ubyte  getIoBuffer(size_t size);

Get a cached I/O buffer (purely for minimizing allocation overhead to polls)

Parameters
size_t size requested size for the I/O buffer
Returns
cached I/O buffer for repeated polls

const bool  pollingGoalAchieved();

Returns
if our polling goal has been achieved

void  add(const void* bytes, size_t length, double entropy_bits_per_byte);

Add entropy to the accumulator

Parameters
void* bytes the input bytes
size_t length specifies how many bytes the input is
double entropy_bits_per_byte is a best guess at how much entropy per ubyte is in this input

void  add(T)(in T v, double entropy_bits_per_byte);

Add entropy to the accumulator

Parameters
T v is some value
double entropy_bits_per_byte is a best guess at how much entropy per ubyte is in this input

interface  EntropySource;

Abstract interface to a source of entropy


abstract const @property string  name();

Returns
 name identifying this entropy source

abstract void  poll(ref EntropyAccumulator accum);

Perform an entropy gathering  poll

Parameters
EntropyAccumulator accum is an accumulator object that will be given entropy