Arduino Cryptography Library
|
Processes the signal from a transistor-based noise source. More...
#include <TransistorNoiseSource.h>
Public Member Functions | |
TransistorNoiseSource (uint8_t pin) | |
Constructs a new transitor-based noise source handler. More... | |
bool | calibrating () const |
Determine if the noise source is still calibrating itself. More... | |
void | stir () |
Stirs entropy from this noise source into the global random number pool. More... | |
Public Member Functions inherited from NoiseSource | |
NoiseSource () | |
Constructs a new random noise source. | |
virtual | ~NoiseSource () |
Destroys this random noise source. | |
virtual void | added () |
Called when the noise source is added to RNG with RNG.addNoiseSource(). More... | |
Additional Inherited Members | |
Protected Member Functions inherited from NoiseSource | |
virtual void | output (const uint8_t *data, size_t len, unsigned int credit) |
Called from subclasses to output noise to the global random number pool. More... | |
Processes the signal from a transistor-based noise source.
This class processes input from a transistor-based noise source, such as that described by Rob Seward. See that Web page for full details on how such noise sources work, how the output should be used, and caveats for the unwary. For convenience, Rob's circuit is reproduced below:
The following example shows how to initialize a transistor-based noise source and use it with RNG. The noise is read from the A1 pin on the Arduino and stirred into the random number pool on a regular basis. For more information, see the documentation for RNG.
Definition at line 29 of file TransistorNoiseSource.h.
|
explicit |
Constructs a new transitor-based noise source handler.
pin | The analog input pin that the noise will appear on. |
Definition at line 138 of file TransistorNoiseSource.cpp.
|
virtual |
Determine if the noise source is still calibrating itself.
Noise sources that require calibration start doing so at system startup and then switch over to random data generation once calibration is complete. Since no random data is being generated during calibration, the output from RNG.rand() may be predictable. Use RNG.available() to determine when sufficient entropy is available to generate good random values.
It is possible that the noise source never exits calibration. This can happen if the input voltage is insufficient to trigger noise or if the noise source is not connected. Noise sources may also periodically recalibrate themselves.
Implements NoiseSource.
Definition at line 156 of file TransistorNoiseSource.cpp.
|
virtual |
Stirs entropy from this noise source into the global random number pool.
This function should call output() to add the entropy from this noise source to the global random number pool.
The noise source should batch up the entropy data, providing between 16 and 48 bytes of data each time. If the noise source does not have sufficient entropy data at the moment, it should return without stiring the current data in.
Implements NoiseSource.
Definition at line 161 of file TransistorNoiseSource.cpp.