|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.owasp.esapi.reference.DefaultRandomizer
public class DefaultRandomizer
Reference implementation of the Randomizer interface. This implementation builds on the JCE provider to provide a cryptographically strong source of entropy. The specific algorithm used is configurable in ESAPI.properties.
Randomizer| Method Summary | |
|---|---|
static Randomizer |
getInstance()
|
boolean |
getRandomBoolean()
Returns a random boolean. |
byte[] |
getRandomBytes(int n)
Generates a specified number of random bytes. |
java.lang.String |
getRandomFilename(java.lang.String extension)
Returns an unguessable random filename with the specified extension. |
java.lang.String |
getRandomGUID()
Generates a random GUID. |
int |
getRandomInteger(int min,
int max)
Gets the random integer. |
long |
getRandomLong()
Gets the random long. |
float |
getRandomReal(float min,
float max)
Gets the random real. |
java.lang.String |
getRandomString(int length,
char[] characterSet)
Gets a random string of a desired length and character set. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Randomizer getInstance()
public java.lang.String getRandomString(int length,
char[] characterSet)
getRandomString in interface Randomizerlength - the length of the stringcharacterSet - the set of characters to include in the created random string
public boolean getRandomBoolean()
getRandomBoolean in interface Randomizer
public int getRandomInteger(int min,
int max)
getRandomInteger in interface Randomizermin - the minimum integer that will be returnedmax - the maximum integer that will be returned
public long getRandomLong()
getRandomLong in interface Randomizer
public float getRandomReal(float min,
float max)
getRandomReal in interface Randomizermin - the minimum real number that will be returnedmax - the maximum real number that will be returned
public java.lang.String getRandomFilename(java.lang.String extension)
getRandomFilename in interface Randomizerextension - extension to add to the random filename
public java.lang.String getRandomGUID()
throws EncryptionException
For more information including algorithms used to create UUIDs, see the Internet-Draft UUIDs and GUIDs or the standards body definition at ISO/IEC 11578:1996.
getRandomGUID in interface RandomizerEncryptionException - if hashing or encryption failspublic byte[] getRandomBytes(int n)
getRandomBytes in interface Randomizern - The requested number of random bytes.
n random bytes are returned.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||