public class BCrypt extends Object
| 构造器和说明 |
|---|
BCrypt() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
checkpw(byte[] passwordb,
String hashed)
Check that a password (as a byte array) matches a previously hashed one
param passwordb the password to verify, as a byte array
param hashed the previously-hashed password
return true if the passwords match, false otherwise
|
static boolean |
checkpw(String plaintext,
String hashed)
Check that a plaintext password matches a previously hashed one
param plaintext the plaintext password to verify
param hashed the previously-hashed password
return true if the passwords match, false otherwise
|
static String |
gensalt()
Generate a salt for use with the BCrypt.hashpw() method, selecting a reasonable
default for the number of hashing rounds to apply
return an encoded salt value
|
static String |
gensalt(int log_rounds)
Generate a salt for use with the BCrypt.hashpw() method
param log_rounds the log2 of the number of rounds of hashing to apply - the work
factor therefore increases as 2**log_rounds.
|
static String |
gensalt(int log_rounds,
SecureRandom random)
Generate a salt for use with the BCrypt.hashpw() method
param log_rounds the log2 of the number of rounds of hashing to apply - the work
factor therefore increases as 2**log_rounds.
|
static String |
gensalt(String prefix) |
static String |
gensalt(String prefix,
int log_rounds)
Generate a salt for use with the BCrypt.hashpw() method
param prefix the prefix value (default $2a)
param log_rounds the log2 of the number of rounds of hashing to apply - the work
factor therefore increases as 2**log_rounds.
|
static String |
gensalt(String prefix,
int log_rounds,
SecureRandom random)
Generate a salt for use with the BCrypt.hashpw() method
param prefix the prefix value (default $2a)
param log_rounds the log2 of the number of rounds of hashing to apply - the work
factor therefore increases as 2**log_rounds.
|
static String |
hashpw(byte[] passwordb,
String salt)
Hash a password using the OpenBSD bcrypt scheme
param passwordb the password to hash, as a byte array
param salt the salt to hash with (perhaps generated using BCrypt.gensalt)
return the hashed password
|
static String |
hashpw(String password,
String salt)
Hash a password using the OpenBSD bcrypt scheme
param password the password to hash
param salt the salt to hash with (perhaps generated using BCrypt.gensalt)
return the hashed password
|
public static String hashpw(String password, String salt)
public static String hashpw(byte[] passwordb, String salt)
public static String gensalt(String prefix, int log_rounds, SecureRandom random) throws IllegalArgumentException
IllegalArgumentException - if prefix or log_rounds is invalidpublic static String gensalt(String prefix, int log_rounds) throws IllegalArgumentException
IllegalArgumentException - if prefix or log_rounds is invalidpublic static String gensalt(int log_rounds, SecureRandom random) throws IllegalArgumentException
IllegalArgumentException - if log_rounds is invalidpublic static String gensalt(int log_rounds) throws IllegalArgumentException
IllegalArgumentException - if log_rounds is invalidpublic static String gensalt()
public static boolean checkpw(String plaintext, String hashed)
public static boolean checkpw(byte[] passwordb,
String hashed)
Copyright © 2023. All rights reserved.