/** * Creates a new instance that produces length bytes of random data. * * @param length Number of bytes in generated nonce values. */ public RBGNonce(final int length) { if (length < 1) { throw new IllegalArgumentException("Length must be positive"); } this.length = length; this.rbg = NonceUtil.newRBG(length); }
/** * Creates a new DRBG instance based on a SHA-256 digest. * * @param length Length in bits of values to be produced by DRBG instance. * * @return New DRGB instance. */ public static SP80090DRBG newRBG(final int length) { return newRBG(new SHA256Digest(), length); }
/** * Creates a new hash-based DRBG instance that uses the given digest as the pseudorandom source. * * @param digest Digest algorithm. * @param length Length in bits of values to be produced by DRBG instance. * * @return New DRGB instance. */ public static SP80090DRBG newRBG(final Digest digest, final int length) { return newRBG(digest, length, randomEntropySource(length)); }