org.random.rjgodoy.trng
Enum GeneratorMode

java.lang.Object
  extended by java.lang.Enum<GeneratorMode>
      extended by org.random.rjgodoy.trng.GeneratorMode
All Implemented Interfaces:
Serializable, Comparable<GeneratorMode>

public enum GeneratorMode
extends Enum<GeneratorMode>

Values for the org.random.rjgodoy.trng.mode property.

Depending on the intended use of the generator, it may or may be not be acceptable using non-private random bits (e.g., if the generator is used for private key generation). Therefore, two operation modes are provided: The generator may return random bits as obtained from random.org (TRNG mode) or it may xor them with random bits from a local PRNG (TRNG_XOR_PRNG mode).

Author:
Javier Godoy

Enum Constant Summary
TRNG
          The RNG will return true random numbers from the remote source
TRNG_XOR_PRNG
          The RNG will obtain true random numbers from the remote source, and will XOR them with pseudo-random numbers obtained from a local PRNG.
 
Method Summary
static GeneratorMode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static GeneratorMode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

TRNG

public static final GeneratorMode TRNG
The RNG will return true random numbers from the remote source. * This mode is recommended if you trust in the remote source.


TRNG_XOR_PRNG

public static final GeneratorMode TRNG_XOR_PRNG
The RNG will obtain true random numbers from the remote source, and will XOR them with pseudo-random numbers obtained from a local PRNG. This mode is recommended if you are paranoiac about the remote source.

The PRNG must be seed by the application code, by calling SecureRandom.setSeed(byte[]) on the instantiated SecureRandom object.

Method Detail

values

public static GeneratorMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (GeneratorMode c : GeneratorMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static GeneratorMode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


Submit a bug or request a featureCopyright © (2008-2011) Roberto Javier Godoy
Project Web Hosted by SourceForge.netSouceForge.net is registered trademark of SourceForge, Inc., in the United States and other countries.