Package com.atlassian.crowd.util
Class SecureRandomStringUtils
java.lang.Object
com.atlassian.crowd.util.SecureRandomStringUtils
Generates random
Strings by selecting characters from
an alphabet using a cryptographically secure PRNG.
Methods on this class are thread-safe.-
Method Summary
Modifier and TypeMethodDescriptionstatic SecureRandomStringUtilsrandomAlphanumericString(int length) Generates a randomStringby randomly selecting characters from the the alphabet of characters in the range 0-9, A-Z and a-z.randomString(int length, char[] alphabet) Generates a randomStringby randomly selecting characters from the providedalphabetuntil the desiredlengthis reached.
-
Method Details
-
getInstance
- Returns:
- shared instance of
SecureRandomStringUtils.
-
randomString
Generates a randomStringby randomly selecting characters from the providedalphabetuntil the desiredlengthis reached.The method for selecting a random character is specified by the implementation.
Unicode surrogate-pairing is not supported. All the provided characters should be in the Unicode BMP, if you wish to avoid generating Strings with invalid UTF-16 surrogates.
-
randomAlphanumericString
Generates a randomStringby randomly selecting characters from the the alphabet of characters in the range 0-9, A-Z and a-z.The method for selecting a random character is specified by the implementation.
-