All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gnu.crypto.prng.package.html Maven / Gradle / Ivy

The newest version!





Provides a basic API for using cryptographically strong pseudo random number
generation algorithms.


Package overview

Random number generators, used in cryptography, are based on algorithms which output sequences of statically independent and unbiased bits.

The following diagram shows the important classes participating in this package:

The following example shows how to instantiate, use, and clone a PRNG based on the RC4 stream cipher algorithm.

byte[] b1 = new byte[16];
byte[] b2 = new byte[16];
HashMap attrib = new HashMap();
attrib.put(ARCFour.ARCFOUR_KEY_MATERIAL, new byte[0]);

IRandom r1 = PRNGFactory.getInstance(Registry.ARCFOUR_PRNG);
r1.init(attrib);
r1.nextBytes(b1, 0, b1.length);

IRandom r2 = (IRandom) r1.clone();

r1.nextBytes(b1, 0, b1.length);
r2.nextBytes(b2, 0, b1.length);




© 2015 - 2025 Weber Informatics LLC | Privacy Policy