de.upb.swtpra05.group03.crypto
Class SharedSeedRNG

java.lang.Object
  extended byde.upb.swtpra05.group03.crypto.SharedSeedRNG

public class SharedSeedRNG
extends java.lang.Object

provides random number generators all with the same seed

Version:
$Revision: 1.3 $

Field Summary
protected static java.lang.String ALGORITHM
          algorithm used by the pseudo random number generator
protected static java.lang.String HOME_DIR
          home directory of the user
protected static byte[] SEED
          common seed used by all shuttles
protected static java.io.File SEED_DIR
          our settings dir to save the seed in
protected static java.io.File SEED_FILE
          file to save the seed in
 
Constructor Summary
SharedSeedRNG()
           
 
Method Summary
static java.security.SecureRandom getRandom()
          returns a random number generator seeded with the common seed
protected static byte[] loadSeed()
          load the seed from the seed file
static void saveSeed(byte[] seed)
          saves a seed into the seed file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HOME_DIR

protected static final java.lang.String HOME_DIR
home directory of the user


SEED_DIR

protected static final java.io.File SEED_DIR
our settings dir to save the seed in


SEED_FILE

protected static final java.io.File SEED_FILE
file to save the seed in


ALGORITHM

protected static final java.lang.String ALGORITHM
algorithm used by the pseudo random number generator

See Also:
Constant Field Values

SEED

protected static final byte[] SEED
common seed used by all shuttles

Constructor Detail

SharedSeedRNG

public SharedSeedRNG()
Method Detail

getRandom

public static java.security.SecureRandom getRandom()
                                            throws java.security.NoSuchAlgorithmException
returns a random number generator seeded with the common seed

Returns:
random number generator
Throws:
java.security.NoSuchAlgorithmException

saveSeed

public static void saveSeed(byte[] seed)
saves a seed into the seed file

Parameters:
seed - seed as a bytearray

loadSeed

protected static byte[] loadSeed()
load the seed from the seed file

Returns:
seed as a bytearray