Remco Bloemen
/
EntropySource
Use your mbed and it\'s noisy analog inputs as a hardware random number generator!
Diff: EntropyPool.h
- Revision:
- 0:dda0a8c4ac0c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EntropyPool.h Mon Jun 20 13:23:03 2011 +0000 @@ -0,0 +1,22 @@ +#pragma once +#include <SHA256.h> +#include "mbed.h" + +class EntropyPool: protected SHA256 { +public: + EntropyPool(); + + int entropy() { return e; } + + void gather(); + + void gatherAnalogNoise(AnalogIn& input, int entropy = 8); + + char* produce(int bytes); + + FunctionPointer gatherer; + +protected: + Timer timer; + int e; +}; \ No newline at end of file