Java Randomness Test Suite

JRandTest at SourceForge

com.fasteasytrade.JRandTest.IO
Class FileAlgoRandomStream

java.lang.Object
  extended bycom.fasteasytrade.JRandTest.IO.FileRandomStream
      extended bycom.fasteasytrade.JRandTest.IO.FileAlgoRandomStream
All Implemented Interfaces:
AlgoRandomStream, RandomStream
Direct Known Subclasses:
AES, ARC4, BBS, BlowFish, CubicResidue, DES, JavaRandom, JavaSecuredRandom, Lcg1, MicaliSchnorr, ModulusExponent, MT19937, QuadraticResidue1, QuadraticResidue2, RSA, SHA1Random, SkipjackRandom, TripleDES, ZAC3Random, ZAC5Random

public class FileAlgoRandomStream
extends FileRandomStream
implements AlgoRandomStream

Author:
Zur Aougav

Field Summary
 int maxCount
           
 byte[] privateKey
           
 int privateKeyLength
           
 byte[] publicKey
           
 int publicKeyLength
           
 
Fields inherited from class com.fasteasytrade.JRandTest.IO.FileRandomStream
actualSize, buffer, count, countLastRead, filename, infile, open, SIZE
 
Constructor Summary
FileAlgoRandomStream()
           
FileAlgoRandomStream(String s)
           
 
Method Summary
 String getFilename()
          get the file name to be processed. this file is the raw data to be read, or the input file processed by algorithm.
 byte readByte()
          read one byte from a file.
 int readInt()
          Processing is similar to readByte.
 long readLong()
          Processing is similar to readByte.
 void setFilename(String s)
          set file name to be processed. this file is the raw data to be read, or the input file processed by algorithm.
 void setPrivateKey(byte[] k)
          Set private key, if any, to algorithm
 void setPrivateKeyFromFile(String f)
          Set private key, if any, to algorithm from file
 void setPublicKey(byte[] k)
          Set public or symetric key to algorithm
 void setPublicKeyFromFile(String f)
          Set public or symetric key to algorithm from file
 void setup()
          setup will be implemented by each subclass
 void setupKeys()
          set up length and new arrays to public and private keys will be implemented by each algorithm
 
Methods inherited from class com.fasteasytrade.JRandTest.IO.FileRandomStream
closeInputStream, finalize, isOpen, openInputStream
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.fasteasytrade.JRandTest.IO.RandomStream
closeInputStream, isOpen, openInputStream
 

Field Detail

publicKeyLength

public int publicKeyLength

publicKey

public byte[] publicKey

privateKeyLength

public int privateKeyLength

privateKey

public byte[] privateKey

maxCount

public int maxCount
Constructor Detail

FileAlgoRandomStream

public FileAlgoRandomStream()

FileAlgoRandomStream

public FileAlgoRandomStream(String s)
Method Detail

setupKeys

public void setupKeys()
Description copied from interface: AlgoRandomStream
set up length and new arrays to public and private keys

will be implemented by each algorithm

Specified by:
setupKeys in interface AlgoRandomStream
See Also:
AlgoRandomStream.setupKeys()

setPublicKeyFromFile

public void setPublicKeyFromFile(String f)
Description copied from interface: AlgoRandomStream
Set public or symetric key to algorithm from file

Specified by:
setPublicKeyFromFile in interface AlgoRandomStream
Parameters:
f - file name with public or symetric key
See Also:
AlgoRandomStream.setPublicKeyFromFile(java.lang.String)

setPublicKey

public void setPublicKey(byte[] k)
Description copied from interface: AlgoRandomStream
Set public or symetric key to algorithm

Specified by:
setPublicKey in interface AlgoRandomStream
Parameters:
k - byte array of public or symetric key
See Also:
AlgoRandomStream.setPublicKey(byte[])

setPrivateKeyFromFile

public void setPrivateKeyFromFile(String f)
Description copied from interface: AlgoRandomStream
Set private key, if any, to algorithm from file

Specified by:
setPrivateKeyFromFile in interface AlgoRandomStream
Parameters:
f - file name with private key
See Also:
AlgoRandomStream.setPrivateKeyFromFile(java.lang.String)

setPrivateKey

public void setPrivateKey(byte[] k)
Description copied from interface: AlgoRandomStream
Set private key, if any, to algorithm

Specified by:
setPrivateKey in interface AlgoRandomStream
Parameters:
k - byte array of private key
See Also:
AlgoRandomStream.setPrivateKey(byte[])

setup

public void setup()
setup will be implemented by each subclass

Specified by:
setup in interface AlgoRandomStream
See Also:
AlgoRandomStream.setup()

setFilename

public void setFilename(String s)
Description copied from interface: RandomStream
set file name to be processed. this file is the raw data to be read, or the input file processed by algorithm.

Specified by:
setFilename in interface RandomStream
Overrides:
setFilename in class FileRandomStream
Parameters:
s - set algorithm input filename file
See Also:
RandomStream.setFilename(java.lang.String)

getFilename

public String getFilename()
Description copied from interface: RandomStream
get the file name to be processed. this file is the raw data to be read, or the input file processed by algorithm.

Specified by:
getFilename in interface RandomStream
Overrides:
getFilename in class FileRandomStream
Returns:
algorithm input filename file
See Also:
RandomStream.getFilename()

readByte

public byte readByte()
              throws Exception
Description copied from interface: RandomStream
read one byte from a file.

first time ( if !isOpen() ) open file/stream, and return byte

at end of file close stream and returns -1

Specified by:
readByte in interface RandomStream
Overrides:
readByte in class FileRandomStream
Throws:
Exception
See Also:
RandomStream.readByte()

readInt

public int readInt()
            throws Exception
Description copied from interface: RandomStream
Processing is similar to readByte.

Specified by:
readInt in interface RandomStream
Overrides:
readInt in class FileRandomStream
Throws:
Exception
See Also:
RandomStream.readInt()

readLong

public long readLong()
              throws Exception
Description copied from interface: RandomStream
Processing is similar to readByte.

Specified by:
readLong in interface RandomStream
Overrides:
readLong in class FileRandomStream
Throws:
Exception
See Also:
RandomStream.readLong()

Java Randomness Test Suite

JRandTest at SourceForge

JRandTest at SourceForge
Copyright © 2005 Zur Aougav. All Rights Reserved.