11/**
22 * OWASP Enterprise Security API (ESAPI)
3- *
3+ *
44 * This file is part of the Open Web Application Security Project (OWASP)
55 * Enterprise Security API (ESAPI) project. For details, please see
66 * <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
77 *
88 * Copyright (c) 2007 - The OWASP Foundation
9- *
9+ *
1010 * The ESAPI is published by OWASP under the BSD license. You should read and accept the
1111 * LICENSE before you use, modify, and/or redistribute this software.
12- *
12+ *
1313 * @author Jeff Williams <a href="http://www.aspectsecurity.com">Aspect Security</a>
1414 * @created 2007
1515 */
@@ -32,91 +32,91 @@ public interface Randomizer {
3232
3333 /**
3434 * Gets a random string of a desired length and character set. The use of java.security.SecureRandom
35- * is recommended because it provides a cryptographically strong pseudo-random number generator.
36- * If SecureRandom is not used, the pseudo-random number generator used should comply with the
35+ * is recommended because it provides a cryptographically strong pseudo-random number generator.
36+ * If SecureRandom is not used, the pseudo-random number generator used should comply with the
3737 * statistical random number generator tests specified in <a href="http://csrc.nist.gov/cryptval/140-2.htm">
3838 * FIPS 140-2, Security Requirements for Cryptographic Modules</a>, section 4.9.1.
39- *
40- * @param length
39+ *
40+ * @param length
4141 * the length of the string
42- * @param characterSet
42+ * @param characterSet
4343 * the set of characters to include in the created random string
44- *
45- * @return
44+ *
45+ * @return
4646 * the random string of the desired length and character set
4747 */
4848 String getRandomString (int length , char [] characterSet );
4949
5050 /**
5151 * Returns a random boolean. The use of java.security.SecureRandom
52- * is recommended because it provides a cryptographically strong pseudo-random number generator.
53- * If SecureRandom is not used, the pseudo-random number generator used should comply with the
52+ * is recommended because it provides a cryptographically strong pseudo-random number generator.
53+ * If SecureRandom is not used, the pseudo-random number generator used should comply with the
5454 * statistical random number generator tests specified in <a href="http://csrc.nist.gov/cryptval/140-2.htm">
5555 * FIPS 140-2, Security Requirements for Cryptographic Modules</a>, section 4.9.1.
56- *
57- * @return
56+ *
57+ * @return
5858 * true or false, randomly
5959 */
6060 boolean getRandomBoolean ();
61-
61+
6262 /**
63- * Gets the random integer. The use of java.security.SecureRandom
64- * is recommended because it provides a cryptographically strong pseudo-random number generator.
65- * If SecureRandom is not used, the pseudo-random number generator used should comply with the
63+ * Gets the random integer in the range of [min, max) . The use of java.security.SecureRandom
64+ * is recommended because it provides a cryptographically strong pseudo-random number generator.
65+ * If SecureRandom is not used, the pseudo-random number generator used should comply with the
6666 * statistical random number generator tests specified in <a href="http://csrc.nist.gov/cryptval/140-2.htm">
6767 * FIPS 140-2, Security Requirements for Cryptographic Modules</a>, section 4.9.1.
68- *
69- * @param min
70- * the minimum integer that will be returned
71- * @param max
72- * the maximum integer that will be returned
73- *
74- * @return
68+ *
69+ * @param min
70+ * the minimum integer that will be returned, inclusive
71+ * @param max
72+ * the maximum integer that will be returned, exclusive
73+ *
74+ * @return
7575 * the random integer
7676 */
7777 int getRandomInteger (int min , int max );
7878
79-
79+
8080 /**
8181 * Gets the random long. The use of java.security.SecureRandom
82- * is recommended because it provides a cryptographically strong pseudo-random number generator.
83- * If SecureRandom is not used, the pseudo-random number generator used should comply with the
82+ * is recommended because it provides a cryptographically strong pseudo-random number generator.
83+ * If SecureRandom is not used, the pseudo-random number generator used should comply with the
8484 * statistical random number generator tests specified in <a href="http://csrc.nist.gov/cryptval/140-2.htm">
8585 * FIPS 140-2, Security Requirements for Cryptographic Modules</a>, section 4.9.1.
86- *
87- * @return
86+ *
87+ * @return
8888 * the random long
8989 */
9090 long getRandomLong ();
91-
92-
91+
92+
9393 /**
9494 * Returns an unguessable random filename with the specified extension. This method could call
9595 * getRandomString(length, charset) from this Class with the desired length and alphanumerics as the charset
9696 * then merely append "." + extension.
97- *
98- * @param extension
97+ *
98+ * @param extension
9999 * extension to add to the random filename
100- *
101- * @return
100+ *
101+ * @return
102102 * a random unguessable filename ending with the specified extension
103103 */
104104 String getRandomFilename ( String extension );
105-
106-
105+
106+
107107 /**
108- * Gets the random real. The use of java.security.SecureRandom
109- * is recommended because it provides a cryptographically strong pseudo-random number generator.
110- * If SecureRandom is not used, the pseudo-random number generator used should comply with the
108+ * Gets the random real in the range of [min, max] . The use of java.security.SecureRandom
109+ * is recommended because it provides a cryptographically strong pseudo-random number generator.
110+ * If SecureRandom is not used, the pseudo-random number generator used should comply with the
111111 * statistical random number generator tests specified in <a href="http://csrc.nist.gov/cryptval/140-2.htm">
112112 * FIPS 140-2, Security Requirements for Cryptographic Modules</a>, section 4.9.1.
113- *
114- * @param min
115- * the minimum real number that will be returned
116- * @param max
117- * the maximum real number that will be returned
118- *
119- * @return
113+ *
114+ * @param min
115+ * the minimum real number that will be returned, inclusive
116+ * @param max
117+ * the maximum real number that will be returned, inclusive
118+ *
119+ * @return
120120 * the random real
121121 */
122122 float getRandomReal (float min , float max );
@@ -129,19 +129,19 @@ public interface Randomizer {
129129 * For more information including algorithms used to create <tt>UUID</tt>s,
130130 * see the Internet-Draft <a href="http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-03.txt">UUIDs and GUIDs</a>
131131 * or the standards body definition at <a href="http://www.iso.ch/cate/d2229.html">ISO/IEC 11578:1996</a>.
132- * @return
132+ * @return
133133 * the GUID
134- *
135- * @throws
136- * EncryptionException if hashing or encryption fails
134+ *
135+ * @throws
136+ * EncryptionException if hashing or encryption fails
137137 */
138138 String getRandomGUID () throws EncryptionException ;
139-
139+
140140 /**
141141 * Generates a specified number of random bytes.
142142 * @param n The requested number of random bytes.
143143 * @return The {@code n} random bytes are returned.
144144 */
145145 byte [] getRandomBytes (int n );
146-
146+
147147}
0 commit comments