* FortunaRandomSource:

- Fix bug that wasted entropy in nextInt()
    - Improved synchronization
This commit is contained in:
zzz
2012-09-11 19:40:20 +00:00
parent d7b48a2256
commit db42d9ec37
3 changed files with 73 additions and 42 deletions

View File

@@ -14,7 +14,7 @@ import net.i2p.util.Log;
*
* Note that this class is not fully Thread safe!
* The following methods must be synchronized externally, they are not
* sycned here or in super():
* synced here or in super():
* addRandomByte(), addRandomBytes(), nextByte(), nextBytes(), seed()
*
*/

View File

@@ -55,7 +55,7 @@ public abstract class BasePRNGStandalone implements IRandomStandalone {
// -------------------------------------------------------------------------
/** The canonical name prefix of the PRNG algorithm. */
protected String name;
protected final String name;
/** Indicate if this instance has already been initialised or not. */
protected boolean initialised;
@@ -75,10 +75,7 @@ public abstract class BasePRNGStandalone implements IRandomStandalone {
* @param name the canonical name of this instance.
*/
protected BasePRNGStandalone(String name) {
super();
this.name = name;
initialised = false;
buffer = new byte[0];
}