2009-08-11 sponge

* Code Janitor time! Many fixes and documenting fixes that should be
      done in the future. for the most part, this is a general code cleanup.
    * On smaller/embedded systems, the "final" keyword cleanups will have
      more of an impact than on larger systems.
    * Document missing hashCode() methods.
    * Unhide more variables to make code easier to read.
This commit is contained in:
sponge
2009-08-11 21:58:56 +00:00
parent e5eea47b66
commit 3fbff71861
166 changed files with 2575 additions and 2417 deletions

View File

@@ -164,6 +164,7 @@ public abstract class BaseHashStandalone implements IMessageDigestStandalone {
// methods to be implemented by concrete subclasses ------------------------
@Override
public abstract Object clone();
public abstract boolean selfTest();

View File

@@ -47,6 +47,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
}
/** the seed is only propogated once the prng is started with startup() */
@Override
public void seed(byte val[]) {
Map props = new HashMap(1);
props.put(SEED, (Object)val);
@@ -54,6 +55,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
//fillBlock();
}
@Override
protected void allocBuffer() {}
/**
@@ -133,6 +135,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
}
}
@Override
public void fillBlock()
{
rotateBuffer();

View File

@@ -172,6 +172,7 @@ public abstract class BasePRNGStandalone implements IRandomStandalone {
// abstract methods to implement by subclasses -----------------------------
@Override
public Object clone() throws CloneNotSupportedException
{
return super.clone();

View File

@@ -169,6 +169,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
System.out.println("Refilling " + (++refillCount) + " after " + diff + " for the PRNG took " + refillTime);
}
@Override
public void addRandomByte(byte b)
{
pools[pool].update(b);
@@ -177,6 +178,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
pool = (pool + 1) % NUM_POOLS;
}
@Override
public void addRandomBytes(byte[] buf, int offset, int length)
{
pools[pool].update(buf, offset, length);
@@ -244,6 +246,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
cryptixKeyBuf = CryptixAESKeyCache.createNew();
}
@Override
public final byte nextByte()
{
byte[] b = new byte[1];
@@ -251,6 +254,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
return b[0];
}
@Override
public final void nextBytes(byte[] out, int offset, int length)
{
if (!seeded)
@@ -280,11 +284,13 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
ndx = 0;
}
@Override
public final void addRandomByte(byte b)
{
addRandomBytes(new byte[] { b });
}
@Override
public final void addRandomBytes(byte[] seed, int offset, int length)
{
hash.update(key, 0, key.length);