I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 688dd231 authored by str4d's avatar str4d
Browse files

gnu.crypto.prng.*: type arguments

parent e38db5eb
No related branches found
No related tags found
No related merge requests found
...@@ -42,8 +42,8 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl ...@@ -42,8 +42,8 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
super(); super();
_bufferCount = Math.max(context.getProperty("prng.buffers", DEFAULT_BUFFERS), 2); _bufferCount = Math.max(context.getProperty("prng.buffers", DEFAULT_BUFFERS), 2);
_bufferSize = Math.max(context.getProperty("prng.bufferSize", DEFAULT_BUFSIZE), 16*1024); _bufferSize = Math.max(context.getProperty("prng.bufferSize", DEFAULT_BUFSIZE), 16*1024);
_emptyBuffers = new LinkedBlockingQueue(_bufferCount); _emptyBuffers = new LinkedBlockingQueue<AsyncBuffer>(_bufferCount);
_fullBuffers = new LinkedBlockingQueue(_bufferCount); _fullBuffers = new LinkedBlockingQueue<AsyncBuffer>(_bufferCount);
_context = context; _context = context;
context.statManager().createRequiredRateStat("prng.bufferWaitTime", "Delay for random number buffer (ms)", "Encryption", new long[] { 60*1000, 10*60*1000, 60*60*1000 } ); context.statManager().createRequiredRateStat("prng.bufferWaitTime", "Delay for random number buffer (ms)", "Encryption", new long[] { 60*1000, 10*60*1000, 60*60*1000 } );
context.statManager().createRequiredRateStat("prng.bufferFillTime", "Time to fill random number buffer (ms)", "Encryption", new long[] { 60*1000, 10*60*1000, 60*60*1000 } ); context.statManager().createRequiredRateStat("prng.bufferFillTime", "Time to fill random number buffer (ms)", "Encryption", new long[] { 60*1000, 10*60*1000, 60*60*1000 } );
...@@ -77,7 +77,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl ...@@ -77,7 +77,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
/** the seed is only propogated once the prng is started with startup() */ /** the seed is only propogated once the prng is started with startup() */
@Override @Override
public void seed(byte val[]) { public void seed(byte val[]) {
Map props = Collections.singletonMap(SEED, val); Map<String, byte[]> props = Collections.singletonMap(SEED, val);
init(props); init(props);
//fillBlock(); //fillBlock();
} }
......
...@@ -91,7 +91,7 @@ public abstract class BasePRNGStandalone implements IRandomStandalone { ...@@ -91,7 +91,7 @@ public abstract class BasePRNGStandalone implements IRandomStandalone {
return name; return name;
} }
public void init(Map attributes) { public void init(Map<String, byte[]> attributes) {
this.setup(attributes); this.setup(attributes);
ndx = 0; ndx = 0;
...@@ -179,7 +179,7 @@ public abstract class BasePRNGStandalone implements IRandomStandalone { ...@@ -179,7 +179,7 @@ public abstract class BasePRNGStandalone implements IRandomStandalone {
return super.clone(); return super.clone();
} }
public abstract void setup(Map attributes); public abstract void setup(Map<String, byte[]> attributes);
public abstract void fillBlock(); //throws LimitReachedException; public abstract void fillBlock(); //throws LimitReachedException;
} }
...@@ -131,12 +131,12 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl ...@@ -131,12 +131,12 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
} }
public void seed(byte val[]) { public void seed(byte val[]) {
Map props = Collections.singletonMap(SEED, val); Map<String, byte[]> props = Collections.singletonMap(SEED, val);
init(props); init(props);
fillBlock(); fillBlock();
} }
public void setup(Map attributes) public void setup(Map<String, byte[]> attributes)
{ {
lastReseed = 0; lastReseed = 0;
reseedCount = 0; reseedCount = 0;
...@@ -312,7 +312,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl ...@@ -312,7 +312,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
incrementCounter(); incrementCounter();
} }
public void setup(Map attributes) public void setup(Map<String, byte[]> attributes)
{ {
seeded = false; seeded = false;
Arrays.fill(key, (byte) 0); Arrays.fill(key, (byte) 0);
......
...@@ -107,7 +107,7 @@ public interface IRandomStandalone extends Cloneable { ...@@ -107,7 +107,7 @@ public interface IRandomStandalone extends Cloneable {
* @exception IllegalArgumentException if at least one of the defined name/ * @exception IllegalArgumentException if at least one of the defined name/
* value pairs contains invalid data. * value pairs contains invalid data.
*/ */
void init(Map attributes); void init(Map<String, byte[]> attributes);
/** /**
* <p>Returns the next 8 bits of random data generated from this instance.</p> * <p>Returns the next 8 bits of random data generated from this instance.</p>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment