public final class BCrypt extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
BCrypt.HashData
Holds the raw data of a bcrypt hash
|
static class |
BCrypt.Hasher
Can create bcrypt hashes
|
static class |
BCrypt.Result
Result of a bcrypt hash verification
|
static class |
BCrypt.Verifyer
Can verify bcrypt hashes
|
static class |
BCrypt.Version
The supported version identifiers for bcrypt according to the modular crypt format.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_COST
Maximum allowed cost factor
|
static int |
MIN_COST
Minimum allowed cost factor
|
static int |
SALT_LENGTH
Fixed length of the bcrypt salt
|
| Modifier and Type | Method and Description |
|---|---|
static BCrypt.Verifyer |
verifyer()
Creates a new instance of bcrypt verifier to verify a password against a given hash.
|
static BCrypt.Verifyer |
verifyer(BCrypt.Version version)
Creates a new instance of bcrypt verifier to verify a password against a given hash.
|
static BCrypt.Verifyer |
verifyer(BCrypt.Version version,
LongPasswordStrategy longPasswordStrategy)
Creates a new instance of bcrypt verifier to verify a password against a given hash.
|
static BCrypt.Hasher |
with(BCrypt.Version version)
Create a new instance of bcrypt hash with given
BCrypt.Version. |
static BCrypt.Hasher |
with(BCrypt.Version version,
LongPasswordStrategy longPasswordStrategy)
Create a new instance with custom version and long password strategy
|
static BCrypt.Hasher |
with(BCrypt.Version version,
SecureRandom secureRandom,
LongPasswordStrategy longPasswordStrategy)
Create a new instance with custom version, secureRandom and long password strategy
|
static BCrypt.Hasher |
with(LongPasswordStrategy longPasswordStrategy)
Create a new instance of bcrypt hash with default version
BCrypt.Version.VERSION_2A. |
static BCrypt.Hasher |
with(SecureRandom secureRandom)
Create a new instance of bcrypt hash with default version
BCrypt.Version.VERSION_2A. |
static BCrypt.Hasher |
withDefaults()
Create a new instance of bcrypt hash with default version
BCrypt.Version.VERSION_2A. |
public static final int SALT_LENGTH
public static final int MIN_COST
public static final int MAX_COST
public static BCrypt.Hasher withDefaults()
BCrypt.Version.VERSION_2A.
Will throw an exception if given password is longer than the max length support for bycrpt of BCrypt.Version.allowedMaxPwLength.public static BCrypt.Hasher with(BCrypt.Version version)
BCrypt.Version.
Will throw an exception if given password is longer than the max length support for bycrpt of BCrypt.Version.allowedMaxPwLength.version - defines what version of bcrypt will be generated (mostly the version identifier changes)public static BCrypt.Hasher with(SecureRandom secureRandom)
BCrypt.Version.VERSION_2A.
The passed SecureRandom is used for generating the random salt.
Will throw an exception if given password is longer than the max length support for bycrpt of BCrypt.Version.allowedMaxPwLength.secureRandom - to use for random salt generationpublic static BCrypt.Hasher with(LongPasswordStrategy longPasswordStrategy)
BCrypt.Version.VERSION_2A.
The passed LongPasswordStrategy will decide what to do when the password is longer than the supported
BCrypt.Version.allowedMaxPwLengthlongPasswordStrategy - decides what to do on pw that are too longpublic static BCrypt.Hasher with(BCrypt.Version version, LongPasswordStrategy longPasswordStrategy)
version - defines what version of bcrypt will be generated (mostly the version identifier changes)longPasswordStrategy - decides what to do on pw that are too longpublic static BCrypt.Hasher with(BCrypt.Version version, SecureRandom secureRandom, LongPasswordStrategy longPasswordStrategy)
version - defines what version of bcrypt will be generated (mostly the version identifier changes)secureRandom - to use for random salt generationlongPasswordStrategy - decides what to do on pw that are too longpublic static BCrypt.Verifyer verifyer()
public static BCrypt.Verifyer verifyer(BCrypt.Version version)
version - to use, also matters in BCrypt.Verifyer.verifyStrict(byte[], byte[])public static BCrypt.Verifyer verifyer(BCrypt.Version version, LongPasswordStrategy longPasswordStrategy)
LongPasswordStrategy for creating the reference hash - use this
if you use one while hashing.version - to use, also matters in BCrypt.Verifyer.verifyStrict(byte[], byte[])longPasswordStrategy - used to create the reference hash.Copyright © 2018–2023. All rights reserved.