Update of /cvsroot/freenet/freenet/src/freenet/crypt In directory sc8-pr-cvs1:/tmp/cvs-serv24701/src/freenet/crypt
Modified Files: Yarrow.java Added Files: ThrottledAsyncEntropyYarrow.java Log Message: Unfinalized Yarrow. Added another version of the Yarrow PRNG. --- NEW FILE: ThrottledAsyncEntropyYarrow.java --- /* * Created on Oct 27, 2003 */ package freenet.crypt; import freenet.support.BlockingQueue; /** * @author Iakin * * Exactly the same as Yarrow except that supplied entropy will be added asynchronously and that some * entropy additions might be ignored * */ public class ThrottledAsyncEntropyYarrow extends Yarrow { long maxEntropyQueueSize; Thread entropyProcessor; BlockingQueue entropy= new BlockingQueue(); private class EntropyQueueItem { EntropySource source; long data; int entropyGuess; EntropyQueueItem(EntropySource source, long data, int entropyGuess) { this.source = source; this.data = data; this.entropyGuess = entropyGuess; } } public ThrottledAsyncEntropyYarrow(String seed, String digest, String cipher,long maxEntropyQueueSize) { super(seed,digest,cipher); this.maxEntropyQueueSize = maxEntropyQueueSize; entropyProcessor = new Thread(new Runnable() { public void run(){ while(true) try{ EntropyQueueItem e = (EntropyQueueItem)entropy.dequeue(); ThrottledAsyncEntropyYarrow.super.acceptEntropy(e.source, e.data, e.entropyGuess); }catch(InterruptedException e){} } }); entropyProcessor.setDaemon(true); entropyProcessor.setName("PRNG/Yarrow entropy processing thread"); entropyProcessor.start(); } public int acceptEntropy(EntropySource source, long data, int entropyGuess) { int i; if(entropy.size() < maxEntropyQueueSize) entropy.enqueue(new EntropyQueueItem(source,data,entropyGuess)); else i = 0; return 32; //TODO: What should we do here.. seem like no part of fred currently uses the retuned value /[EMAIL PROTECTED] } } Index: Yarrow.java =================================================================== RCS file: /cvsroot/freenet/freenet/src/freenet/crypt/Yarrow.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- Yarrow.java 7 Oct 2003 20:03:39 -0000 1.9 +++ Yarrow.java 27 Oct 2003 13:39:00 -0000 1.10 @@ -39,7 +39,7 @@ * * @author Scott G. Miller <[EMAIL PROTECTED]> */ -public final class Yarrow extends RandomSource { +public class Yarrow extends RandomSource { /** * Security parameters _______________________________________________ cvs mailing list [EMAIL PROTECTED] http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs