diff options
Diffstat (limited to 'libjava/classpath/gnu/java/security/util/PRNG.java')
-rw-r--r-- | libjava/classpath/gnu/java/security/util/PRNG.java | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/libjava/classpath/gnu/java/security/util/PRNG.java b/libjava/classpath/gnu/java/security/util/PRNG.java index 138cc6bcb0c..7bb27cbf452 100644 --- a/libjava/classpath/gnu/java/security/util/PRNG.java +++ b/libjava/classpath/gnu/java/security/util/PRNG.java @@ -45,27 +45,20 @@ import gnu.java.security.prng.LimitReachedException; import gnu.java.security.prng.MDGenerator; /** - * A useful hash-based (SHA) pseudo-random number generator used - * throughout this library. + * A useful hash-based (SHA) pseudo-random number generator used throughout this + * library. * * @see MDGenerator */ public class PRNG { - // Constans and fields - // -------------------------------------------------------------------------- - /** The underlying {@link IRandom}. */ private IRandom delegate; - // Constructor(s) - // -------------------------------------------------------------------------- - /** * Private constructor to enforce using the Factory method. * - * @param delegate - * the undelying {@link IRandom} object used. + * @param delegate the undelying {@link IRandom} object used. */ private PRNG(IRandom delegate) { @@ -74,9 +67,6 @@ public class PRNG this.delegate = delegate; } - // Class methods - // -------------------------------------------------------------------------- - public static final PRNG getInstance() { IRandom delegate = new MDGenerator(); @@ -86,10 +76,10 @@ public class PRNG // initialise it with a seed long t = System.currentTimeMillis(); byte[] seed = new byte[] { - (byte) (t >>> 56), (byte) (t >>> 48), - (byte) (t >>> 40), (byte) (t >>> 32), - (byte) (t >>> 24), (byte) (t >>> 16), - (byte) (t >>> 8), (byte) t}; + (byte)(t >>> 56), (byte)(t >>> 48), + (byte)(t >>> 40), (byte)(t >>> 32), + (byte)(t >>> 24), (byte)(t >>> 16), + (byte)(t >>> 8), (byte) t }; map.put(MDGenerator.SEEED, seed); delegate.init(map); // default is to use SHA-1 hash } @@ -97,19 +87,14 @@ public class PRNG { throw new ExceptionInInitializerError(x); } - return new PRNG(delegate); } - // Instance methods - // -------------------------------------------------------------------------- - /** * Completely fills the designated <code>buffer</code> with random data * generated by the underlying delegate. * - * @param buffer - * the place holder of random bytes generated by the underlying + * @param buffer the place holder of random bytes generated by the underlying * delegate. On output, the contents of <code>buffer</code> are * replaced with pseudo-random data, iff the <code>buffer</code> * size is not zero. |