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 |
MAX_PW_LENGTH_BYTE
The max length of the password in bytes excluding lats null-terminator byte
|
static int |
MIN_COST
Minimum allowed cost factor
|
static int |
SALT_LENGTH
Fixed lenght 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.Hasher |
with(BCrypt.Version version)
Create a new instance of bcrypt hash with given
BCrypt.Version. |
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 MAX_PW_LENGTH_BYTE
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 MAX_PW_LENGTH_BYTE.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 MAX_PW_LENGTH_BYTE.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 MAX_PW_LENGTH_BYTE.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
MAX_PW_LENGTH_BYTElongPasswordStrategy - 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()
Copyright © 2018–2019. All rights reserved.