public class OpenBSDBCrypt extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
checkPassword(String bcryptString,
byte[] password)
Checks if a password corresponds to a 60 character Bcrypt String
|
static boolean |
checkPassword(String bcryptString,
char[] password)
Checks if a password corresponds to a 60 character Bcrypt String
|
static String |
generate(byte[] password,
byte[] salt,
int cost)
Creates a 60 character Bcrypt String, including
version, cost factor, salt and hash, separated by '$' using version
'2y'.
|
static String |
generate(char[] password,
byte[] salt,
int cost)
Creates a 60 character Bcrypt String, including
version, cost factor, salt and hash, separated by '$' using version
'2y'.
|
static String |
generate(String version,
byte[] password,
byte[] salt,
int cost)
Creates a 60 character Bcrypt String, including
version, cost factor, salt and hash, separated by '$'
|
static String |
generate(String version,
char[] password,
byte[] salt,
int cost)
Creates a 60 character Bcrypt String, including
version, cost factor, salt and hash, separated by '$'
|
public static String generate(char[] password, byte[] salt, int cost)
cost
- the cost factor, treated as an exponent of 2salt
- a 16 byte saltpassword
- the passwordpublic static String generate(byte[] password, byte[] salt, int cost)
cost
- the cost factor, treated as an exponent of 2salt
- a 16 byte saltpassword
- the passwordpublic static String generate(String version, char[] password, byte[] salt, int cost)
version
- the version, may be 2b, 2y or 2a. (2a is not backwards compatible.)cost
- the cost factor, treated as an exponent of 2salt
- a 16 byte saltpassword
- the passwordpublic static String generate(String version, byte[] password, byte[] salt, int cost)
version
- the version, may be 2b, 2y or 2a. (2a is not backwards compatible.)cost
- the cost factor, treated as an exponent of 2salt
- a 16 byte saltpassword
- the password already encoded as a byte array.public static boolean checkPassword(String bcryptString, char[] password)
bcryptString
- a 60 character Bcrypt String, including
version, cost factor, salt and hash,
separated by '$'password
- the password as an array of charspublic static boolean checkPassword(String bcryptString, byte[] password)
bcryptString
- a 60 character Bcrypt String, including
version, cost factor, salt and hash,
separated by '$'password
- the password as an array of bytesCopyright © 2021 BouncyCastle.org. All rights reserved.