public class Password extends Object
verify(String, String) along with the stored value originally
produced by hash(String).
This password hashing and verification is done in the same way as Jasypt, but
uses "PBKDF2WithHmacSHA1", rather than MD5.| Modifier and Type | Field and Description |
|---|---|
static String |
ALGORITHM
The password hashing function.
|
static int |
HASH_SIZE
The number of bytes to produce in the hash.
|
static int |
ITERATION_COUNT
The iteration count for the function.
|
| Constructor and Description |
|---|
Password() |
| Modifier and Type | Method and Description |
|---|---|
static String |
hash(String password)
Produces a good hash of the given password, using "PBKDF2WithHmacSHA1", an
iteration count of 1024 and a random salt value of
bytes.
|
static boolean |
verify(String password,
String hash)
Verifies the given plaintext password against a value that
hash(String) produced. |
public static final String ALGORITHM
public static final int ITERATION_COUNT
public static final int HASH_SIZE
public static String hash(String password)
verify(String, String) along with the plaintext password.password - The password to be hashed.public static boolean verify(String password, String hash)
hash(String) produced.password - A plaintext password. If this is null, false will be returned.hash - A value previously produced by hash(String). If this
is empty or shorter than expected, false will be returned.Copyright © 2016 Carboni. All rights reserved.