Package org.cryptacular.bean
Class BCryptHashBean.BCryptParameters
java.lang.Object
org.cryptacular.bean.BCryptHashBean.BCryptParameters
- Enclosing class:
- BCryptHashBean
Handles encoding and decoding a bcrypt hash of the form
$2n$cost$xxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BCryptParameters
(String bCryptString) Decodes bcrypt parameters from a string. -
Method Summary
-
Constructor Details
-
BCryptParameters
Decodes bcrypt parameters from a string.- Parameters:
bCryptString
- bcrypt hash of the form$2n$cost$xxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
-
-
Method Details
-
getVersion
- Returns:
- bcrypt version.
-
getCost
public int getCost()- Returns:
- bcrypt cost in the range [4, 31].
-
getSalt
public byte[] getSalt()- Returns:
- bcrypt salt.
-
getHash
public byte[] getHash()- Returns:
- bcrypt hash.
-
encode
Produces an encoded bcrypt hash string from bcrypt parameter data.- Returns:
- Bcrypt hash of the form
$2n$cost$xxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
.
-
encode
Produces an encoded bcrypt hash string from bcrypt parameters and a provided hash string.- Parameters:
hash
- Encoded bcrypt hash bytes; e.g. the value produced fromBCryptHashBean.hash(Object...)
.- Returns:
- Bcrypt hash of the form
$2n$cost$xxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
.
-