Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://www.aoindustries.com/contact
public class HashedPassword extends Object
https://crackstation.net/hashing-security.htm| Modifier and Type | Field and Description |
|---|---|
static int |
HASH_BYTES
The number of bytes in the hash.
|
static int |
RECOMMENDED_ITERATIONS
The recommended number of iterations for typical usage.
|
static int |
SALT_BYTES
The number of bytes in the random salt.
|
| Constructor and Description |
|---|
HashedPassword(byte[] salt,
int iterations,
byte[] hash) |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
generateSalt()
Generates a random salt of
SALT_BYTES bytes in length. |
static byte[] |
hash(String password,
byte[] salt,
int iterations)
Hash the given password
|
boolean |
matches(String password)
Checks if this matches the provided password.
|
String |
toString() |
public static final int SALT_BYTES
public static final int HASH_BYTES
public static final int RECOMMENDED_ITERATIONS
We may change this value between releases without notice. Only use this value for new password hashes. Always store the iterations with the salt and hash, and use the stored iterations when checking password matches.
public HashedPassword(byte[] salt,
int iterations,
byte[] hash)
salt - The provided parameter is zeroediterations - hash - The provided parameter is zeroedpublic static byte[] generateSalt()
SALT_BYTES bytes in length.hash(java.lang.String, byte[], int)public static byte[] hash(String password, byte[] salt, int iterations)
generateSalt(),
RECOMMENDED_ITERATIONSpublic boolean matches(String password)
https://crackstation.net/hashing-security.htmCopyright © 2000–2016 AO Industries, Inc.. All rights reserved.