|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectcom.fasteasytrade.JRandTest.IO.FileRandomStream
com.fasteasytrade.JRandTest.IO.FileAlgoRandomStream
com.fasteasytrade.JRandTest.Algo.MicaliSchnorr
Micali-Schnorr algorithm as a random stream.
Use MicaliSchnorrPrng class.
Implements algorithm directly from public published book.
The following program implements and tests the Micali-Schnorr random bits generator. The test suite is according to FIPS 140-1. See "Handbook of Applied Cryptography" by Alfred J. Menezes et al Section 5.4.4 pages 181 - 183 and 5.37 Algorithm page 186.
| Field Summary | |
(package private) MicaliSchnorrPrng |
algo
|
(package private) byte[] |
outAlgoBuffer
|
(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 | |
MicaliSchnorr()
|
|
MicaliSchnorr(String keyFileName)
|
|
| Method Summary | |
static void |
main(String[] args)
|
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 |
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 |
getFilename, setFilename, 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 |
MicaliSchnorrPrng algo
byte[] outAlgoBuffer
int outAlgoBufferIx
| Constructor Detail |
public MicaliSchnorr()
public MicaliSchnorr(String keyFileName)
| Method Detail |
public void setupKeys()
AlgoRandomStreamwill be implemented by each algorithm
setupKeys in interface AlgoRandomStreamsetupKeys in class FileAlgoRandomStreamAlgoRandomStream.setupKeys()public void setup()
FileAlgoRandomStream
setup in interface AlgoRandomStreamsetup in class FileAlgoRandomStreamAlgoRandomStream.setup()
public boolean openInputStream()
throws Exception
RandomStream
openInputStream in interface RandomStreamopenInputStream in class FileRandomStreamException
if filename exists (not null), we open file and later will encrypt
it. Else, algorithm will generate random data (as PRNG).
public byte readByte()
throws Exception
RandomStreamfirst time ( if !isOpen() ) open file/stream, and return byte
at end of file close stream and returns -1
readByte in interface RandomStreamreadByte in class FileAlgoRandomStreamExceptionRandomStream.readByte()
public int readInt()
throws Exception
RandomStream
readInt in interface RandomStreamreadInt in class FileAlgoRandomStreamExceptionRandomStream.readInt()
public long readLong()
throws Exception
RandomStream
readLong in interface RandomStreamreadLong in class FileAlgoRandomStreamExceptionRandomStream.readLong()public static void main(String[] args)
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||