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

Dependencies:   mbed SHA256

EntropyPool.h

Committer:
Remco
Date:
2011-06-20
Revision:
0:dda0a8c4ac0c

File content as of revision 0:dda0a8c4ac0c:

#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;
};