Java Randomness Test Suite

JRandTest at SourceForge

com.fasteasytrade.JRandTest.Algo
Class BlowFish

java.lang.Object
  extended bycom.fasteasytrade.JRandTest.IO.FileRandomStream
      extended bycom.fasteasytrade.JRandTest.IO.FileAlgoRandomStream
          extended bycom.fasteasytrade.JRandTest.Algo.BlowFish
All Implemented Interfaces:
AlgoRandomStream, RandomStream

public class BlowFish
extends FileAlgoRandomStream

Stream of random bytes from BFcipher class

Author:
Zur Aougav

Field Summary
(package private)  BFcipher bf
          actual class algorithm
(package private)  byte[] defaultPublicKey
          default key
(package private)  byte[] inAlgoBuffer
          input buffer to algorithm.
(package private)  byte[] iv
          iv array to algorthm
(package private)  byte[] outAlgoBuffer
          output buffer to algorithm.
(package private)  int outAlgoBufferIx
           
 
Fields inherited from class com.fasteasytrade.JRandTest.IO.FileAlgoRandomStream
maxCount, privateKey, privateKeyLength, publicKey, publicKeyLength
 
Fields inherited from class com.fasteasytrade.JRandTest.IO.FileRandomStream
actualSize, buffer, count, countLastRead, filename, open, SIZE
 
Constructor Summary
BlowFish()
           
BlowFish(String keyFileName)
           
 
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.
 boolean openInputStream()
          open the input stream.
 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 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.FileAlgoRandomStream
setPrivateKey, setPrivateKeyFromFile, setPublicKey, setPublicKeyFromFile
 
Methods inherited from class com.fasteasytrade.JRandTest.IO.FileRandomStream
closeInputStream, finalize, isOpen
 
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
 

Field Detail

bf

BFcipher bf
actual class algorithm


defaultPublicKey

byte[] defaultPublicKey
default key


inAlgoBuffer

byte[] inAlgoBuffer
input buffer to algorithm. Always full of 0x00's.


outAlgoBuffer

byte[] outAlgoBuffer
output buffer to algorithm. CBC fill it with different values.


outAlgoBufferIx

int outAlgoBufferIx

iv

byte[] iv
iv array to algorthm

Constructor Detail

BlowFish

public BlowFish()

BlowFish

public BlowFish(String keyFileName)
Method Detail

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 FileAlgoRandomStream
Returns:
algorithm input filename file
See Also:
RandomStream.getFilename()

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 FileAlgoRandomStream
Parameters:
s - set algorithm input filename file
See Also:
RandomStream.setFilename(java.lang.String)

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
Overrides:
setupKeys in class FileAlgoRandomStream
See Also:
AlgoRandomStream.setupKeys()

setup

public void setup()
Description copied from class: FileAlgoRandomStream
setup will be implemented by each subclass

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

openInputStream

public boolean openInputStream()
                        throws Exception
Description copied from interface: RandomStream
open the input stream.

Specified by:
openInputStream in interface RandomStream
Overrides:
openInputStream in class FileRandomStream
Throws:
Exception
See Also:

if filename exists (not null), we open file and later will encrypt it. Else, algorithm will generate random data (as PRNG).


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 FileAlgoRandomStream
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 FileAlgoRandomStream
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 FileAlgoRandomStream
Throws:
Exception
See Also:
RandomStream.readLong()

Java Randomness Test Suite

JRandTest at SourceForge

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