public class PasswordHandling extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_CHARSET
the standard password/salt char-set
|
static int |
DEFAULT_PASSWORD_LENGTH
the standard password length
|
static int |
DEFAULT_SALT_LENGTH
the standard salt length
|
Constructor and Description |
---|
PasswordHandling() |
Modifier and Type | Method and Description |
---|---|
static String |
calculateHash(String pattern)
Calculates an MD5 hash of the given string value.
|
static String |
calculatePasswordHash(String password,
String salt)
Returns the has of the given plain-text password and the given salt.
|
static String |
generatePassword()
Generates a random password (e.g.
|
static String |
generateRandomString(String charset,
int length)
Generates a random string value of the given length, which consists
of characters of the given char-set only.
|
static String |
generateSalt()
Generates a random salt (e.g.
|
public static final String DEFAULT_CHARSET
public static final int DEFAULT_PASSWORD_LENGTH
public static final int DEFAULT_SALT_LENGTH
public static String generateRandomString(String charset, int length)
charset
- length
- public static String generatePassword()
DEFAULT_PASSWORD_LENGTH
)
which consists only of members of the standard char-set
(DEFAULT_CHARSET
)).public static String generateSalt()
DEFAULT_SALT_LENGTH
)
which consists only of members of the standard char-set
(DEFAULT_CHARSET
)).public static String calculatePasswordHash(String password, String salt) throws NoSuchAlgorithmException
password
- salt
- NoSuchAlgorithmException
public static String calculateHash(String pattern) throws NoSuchAlgorithmException
pattern
- NoSuchAlgorithmException
Copyright © 2013. All Rights Reserved.