forked from I2P_Developers/i2p.i2p
2006-02-17 jrandom
* Disable the message history log file by default (duh - feel free to delete messageHistory.txt after upgrading. thanks deathfatty!) * Limit the size of the inbound tunnel build request queue so we don't get an insane backlog of requests that we're bound to reject, and adjust the queue processing so we keep on churning through them when we've got a backlog. * Small fixes for the multiuser syndie operation (thanks Complication!) * Renamed modified PRNG classes that were imported from gnu-crypto so we don't conflict with JVMs using that as a JCE provider (thanks blx!)
This commit is contained in:
@ -47,9 +47,9 @@ import java.util.Map;
|
||||
* <p>An abstract class to facilitate implementing PRNG algorithms.</p>
|
||||
*
|
||||
* Modified slightly by jrandom for I2P (removing unneeded exceptions)
|
||||
* @version $Revision: 1.12 $
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
public abstract class BasePRNG implements IRandom {
|
||||
public abstract class BasePRNGStandalone implements IRandom {
|
||||
|
||||
// Constants and variables
|
||||
// -------------------------------------------------------------------------
|
||||
@ -74,7 +74,7 @@ public abstract class BasePRNG implements IRandom {
|
||||
*
|
||||
* @param name the canonical name of this instance.
|
||||
*/
|
||||
protected BasePRNG(String name) {
|
||||
protected BasePRNGStandalone(String name) {
|
||||
super();
|
||||
|
||||
this.name = name;
|
@ -93,10 +93,11 @@ import net.i2p.crypto.CryptixAESKeyCache;
|
||||
*
|
||||
* Modified by jrandom for I2P to use Bouncycastle's SHA256, Cryptix's AES,
|
||||
* to strip out some unnecessary dependencies and increase the buffer size.
|
||||
* Renamed from Fortuna to FortunaStandalone so it doesn't conflict with the
|
||||
* gnu-crypto implementation, which has been imported into GNU/classpath
|
||||
*
|
||||
*/
|
||||
public class Fortuna extends BasePRNG
|
||||
implements Serializable, RandomEventListener
|
||||
public class FortunaStandalone extends BasePRNGStandalone implements Serializable, RandomEventListener
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 0xFACADE;
|
||||
@ -113,7 +114,7 @@ public class Fortuna extends BasePRNG
|
||||
|
||||
public static final String SEED = "gnu.crypto.prng.fortuna.seed";
|
||||
|
||||
public Fortuna()
|
||||
public FortunaStandalone()
|
||||
{
|
||||
super("Fortuna i2p");
|
||||
generator = new Generator();
|
||||
@ -215,7 +216,7 @@ public class Fortuna extends BasePRNG
|
||||
* right; Fortuna itself is basically a wrapper around this generator
|
||||
* that manages reseeding in a secure way.
|
||||
*/
|
||||
public static class Generator extends BasePRNG implements Cloneable
|
||||
public static class Generator extends BasePRNGStandalone implements Cloneable
|
||||
{
|
||||
|
||||
private static final int LIMIT = 1 << 20;
|
||||
@ -341,7 +342,7 @@ public class Fortuna extends BasePRNG
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
Fortuna f = new Fortuna();
|
||||
FortunaStandalone f = new FortunaStandalone();
|
||||
java.util.HashMap props = new java.util.HashMap();
|
||||
byte initSeed[] = new byte[1234];
|
||||
new java.util.Random().nextBytes(initSeed);
|
@ -14,7 +14,7 @@ import java.security.SecureRandom;
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.crypto.EntropyHarvester;
|
||||
|
||||
import gnu.crypto.prng.Fortuna;
|
||||
import gnu.crypto.prng.FortunaStandalone;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
@ -26,13 +26,13 @@ import java.io.IOException;
|
||||
*
|
||||
*/
|
||||
public class FortunaRandomSource extends RandomSource implements EntropyHarvester {
|
||||
private Fortuna _fortuna;
|
||||
private FortunaStandalone _fortuna;
|
||||
private double _nextGaussian;
|
||||
private boolean _haveNextGaussian;
|
||||
|
||||
public FortunaRandomSource(I2PAppContext context) {
|
||||
super(context);
|
||||
_fortuna = new Fortuna();
|
||||
_fortuna = new FortunaStandalone();
|
||||
byte seed[] = new byte[1024];
|
||||
if (initSeed(seed)) {
|
||||
_fortuna.seed(seed);
|
||||
|
Reference in New Issue
Block a user