类 BCryptUtil
java.lang.Object
cn.bbwres.biscuit.utils.BCryptUtil
加密工具
- 作者:
- zhanglinfeng
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static booleanCheck that a password (as a byte array) matches a previously hashed onestatic booleanCheck that a plaintext password matches a previously hashed onestatic Stringgensalt()Generate a salt for use with the BCrypt.hashpw() method, selecting a reasonable default for the number of hashing rounds to applystatic Stringgensalt(int log_rounds) Generate a salt for use with the BCrypt.hashpw() methodstatic Stringgensalt(int log_rounds, SecureRandom random) Generate a salt for use with the BCrypt.hashpw() methodstatic Stringstatic StringGenerate a salt for use with the BCrypt.hashpw() methodstatic Stringgensalt(String prefix, int log_rounds, SecureRandom random) Generate a salt for use with the BCrypt.hashpw() methodstatic StringHash a password using the OpenBSD bcrypt schemestatic StringHash a password using the OpenBSD bcrypt scheme
-
构造器详细资料
-
BCryptUtil
public BCryptUtil()
-
-
方法详细资料
-
hashpw
Hash a password using the OpenBSD bcrypt scheme- 参数:
password- the password to hashsalt- the salt to hash with (perhaps generated using BCrypt.gensalt)- 返回:
- the hashed password
-
hashpw
Hash a password using the OpenBSD bcrypt scheme- 参数:
passwordb- the password to hash, as a byte arraysalt- the salt to hash with (perhaps generated using BCrypt.gensalt)- 返回:
- the hashed password
-
gensalt
public static String gensalt(String prefix, int log_rounds, SecureRandom random) throws IllegalArgumentException Generate a salt for use with the BCrypt.hashpw() method- 参数:
prefix- the prefix value (default $2a)log_rounds- the log2 of the number of rounds of hashing to apply - the work factor therefore increases as 2**log_rounds.random- an instance of SecureRandom to use- 返回:
- an encoded salt value
- 抛出:
IllegalArgumentException- if prefix or log_rounds is invalid
-
gensalt
Generate a salt for use with the BCrypt.hashpw() method- 参数:
prefix- the prefix value (default $2a)log_rounds- the log2 of the number of rounds of hashing to apply - the work factor therefore increases as 2**log_rounds.- 返回:
- an encoded salt value
- 抛出:
IllegalArgumentException- if prefix or log_rounds is invalid
-
gensalt
Generate a salt for use with the BCrypt.hashpw() method- 参数:
log_rounds- the log2 of the number of rounds of hashing to apply - the work factor therefore increases as 2**log_rounds.random- an instance of SecureRandom to use- 返回:
- an encoded salt value
- 抛出:
IllegalArgumentException- if log_rounds is invalid
-
gensalt
Generate a salt for use with the BCrypt.hashpw() method- 参数:
log_rounds- the log2 of the number of rounds of hashing to apply - the work factor therefore increases as 2**log_rounds.- 返回:
- an encoded salt value
- 抛出:
IllegalArgumentException- if log_rounds is invalid
-
gensalt
-
gensalt
Generate a salt for use with the BCrypt.hashpw() method, selecting a reasonable default for the number of hashing rounds to apply- 返回:
- an encoded salt value
-
checkpw
Check that a plaintext password matches a previously hashed one- 参数:
plaintext- the plaintext password to verifyhashed- the previously-hashed password- 返回:
- true if the passwords match, false otherwise
-
checkpw
Check that a password (as a byte array) matches a previously hashed one- 参数:
passwordb- the password to verify, as a byte arrayhashed- the previously-hashed password- 返回:
- true if the passwords match, false otherwise
- 从以下版本开始:
- 5.3
-