
package fortuna.acumulator;

/**
 *
 * @author Viliam Krizan
 */

import aalg.crypto.IHashFunction;



public class Acumulator {
    private Pool[] pool = new Pool[32];
    
    public Acumulator(final Class<? extends IHashFunction> hashClass) {
        for (int i = 0; i < pool.length; i++) {
            try {
                final IHashFunction hash = hashClass.newInstance();
                pool[i] = new Pool(hash);
            }
            catch (InstantiationException | IllegalAccessException ex) {
                throw new RuntimeException("Cannot create hash function", ex);
            }
        }
    }
        
    
    public void saveToPool(byte[] entropy, int poolNumber){
        pool[poolNumber].addEntropy(entropy);
    }
    
    public Pool getPool(int i){
        return pool[i];
    }
        
}
