Use your mbed and it\'s noisy analog inputs as a hardware random number generator!

Dependencies:   mbed SHA256

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EntropyPool.h Source File

EntropyPool.h

00001 #pragma once
00002 #include <SHA256.h>
00003 #include "mbed.h"
00004 
00005 class EntropyPool: protected SHA256 {
00006 public:
00007     EntropyPool();
00008     
00009     int entropy() { return e; }
00010     
00011     void gather();
00012     
00013     void gatherAnalogNoise(AnalogIn& input, int entropy = 8);
00014     
00015     char* produce(int bytes);
00016 
00017     FunctionPointer gatherer;
00018     
00019 protected:
00020     Timer  timer;
00021     int    e;
00022 };