Class BouncyCastleRandom
- java.lang.Object
-
- org.apache.sshd.common.random.AbstractRandom
-
- org.apache.sshd.common.util.security.bouncycastle.BouncyCastleRandom
-
- All Implemented Interfaces:
NamedResource
,Random
public final class BouncyCastleRandom extends AbstractRandom
BouncyCastleRandom
. This pseudo random number generator uses the a very fast PRNG from BouncyCastle. The JRE random will be used when creating a new generator to add some random data to the seed.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NAME
private org.bouncycastle.crypto.prng.RandomGenerator
random
-
Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR
-
-
Constructor Summary
Constructors Constructor Description BouncyCastleRandom()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fill(byte[] bytes, int start, int len)
Fill part of bytes with random values.java.lang.String
getName()
private int
next(int numBits)
int
random(int n)
Returns a pseudo-random uniformly distributedint
in the half-open range [0, n).-
Methods inherited from class org.apache.sshd.common.random.AbstractRandom
toString
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
random
private final org.bouncycastle.crypto.prng.RandomGenerator random
-
-
Method Detail
-
getName
public java.lang.String getName()
- Returns:
- The resource name
-
fill
public void fill(byte[] bytes, int start, int len)
Description copied from interface:Random
Fill part of bytes with random values.- Parameters:
bytes
- byte array to be filled.start
- index to start filling at.len
- length of segment to fill.
-
random
public int random(int n)
Returns a pseudo-random uniformly distributedint
in the half-open range [0, n).- Parameters:
n
- The range upper limit- Returns:
- The randomly selected value in the range
-
next
private int next(int numBits)
-
-