|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.randomness.Randomness
org.randomness.Truerandomness
org.randomness.TruerandomnessSharedLock
public class TruerandomnessSharedLock
Constructor Summary | |
---|---|
TruerandomnessSharedLock()
|
Method Summary | |
---|---|
void |
close()
The uninstantiate function zeroizes (i.e., erases) the internal state of TRNG (possibly close the entropy source). |
boolean |
isOpen()
Tells whether or not this TRNG entropy source is open. |
int |
minlen()
Minlen is the minimum block of bytes essentially produced per one iteration of generate function (optional operation). |
int |
read(java.nio.ByteBuffer buffer)
The generate function harvest random bits from entropy source per request, can determine entropy of requested bits (optional) and reduce to independent bits if requested bits has low quality entropy. |
void |
reset()
The instantiate function determines the initial internal state of TRNG using the instantiate algorithm (possibly opens the entropy source). |
java.lang.String |
toString()
Returns the name of the algorithm (or process) implemented by this RBG object (optional operation). |
int |
tryRead(java.nio.ByteBuffer buffer)
Attempts to read from this RBG into the given buffer, if generate function is not owned by other thread. |
Methods inherited from class org.randomness.Truerandomness |
---|
current, equals, fromCOMM, fromUSB, hashCode, readAssessment, readConditionally, reset, shared, test |
Methods inherited from class org.randomness.Randomness |
---|
asRandom, bind, map, mixing, newBuffer, nextBoolean, nextByte, nextChar, nextCharASCII, nextDouble, nextFloat, nextHexString, nextInt, nextInt, nextLong, nextLong, nextProbability, nextShort, read, read, read, readFuture, readSink, reversed, shuffle |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TruerandomnessSharedLock()
Method Detail |
---|
public void reset()
Truerandomness
Opposite to uninstantiate function.
reset
in class Truerandomness
public int read(java.nio.ByteBuffer buffer)
Truerandomness
The process to obtain true-random bits from entropy source typically involves the following steps:
read
in interface java.nio.channels.ReadableByteChannel
read
in class Truerandomness
buffer
- The buffer into which entropy are to be transferred.
public void close()
Truerandomness
Opposite to instantiate function.
After a TRNG is closed, any further attempt to invoke
read operations upon it will
cause a NonReadableChannelException
to be thrown.
If this TRNG is already closed then invoking this method has no effect. This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.
close
in interface java.io.Closeable
close
in interface java.nio.channels.Channel
close
in class Truerandomness
public boolean isOpen()
Truerandomness
isOpen
in interface java.nio.channels.Channel
isOpen
in class Truerandomness
public int tryRead(java.nio.ByteBuffer buffer)
Randomness
This method behaves exactly as specified in the generate function except that returns immediately if generate function is owned by other thread.
tryRead
in class Randomness
buffer
- The buffer into which random bytes are to be transferred.
public java.lang.String toString()
Randomness
In general case, toString
description can contain all
necessary information about RNG. If type of current RBG is undefined use
UNKNOWN
as type mark instead.
toString
in class Randomness
UNKNOWN
if the
algorithm name cannot be determined.public int minlen()
Randomness
This method may provide additional information about generator to configure generation process more essential for generator. For example, this method should used as follows:
Randomness rnd = Cryptorandomness.from(CSPRNG.SHA1);
ByteBuffer buffer = ByteBuffer.allocate(rnd.minlen() * MULTIPLIER);
rnd.read(buffer); // essential for generator. may be optimized.
minlen
in class Randomness
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |