@Override public boolean check(final String input, final String hash) { return pbkdf2Hash.validatePassword(input, hash); } };
/** * Validates a password using a hash. * * @param password the password to check * @param goodHash the hash of the valid password * @return true if the password is correct, false if not */ public boolean validatePassword(final String password, final String goodHash) { return validatePassword(password.toCharArray(), goodHash); }
@Test void simpleTest() { PBKDF2Hash pbkdf2Hash = new PBKDF2Hash(); String hash = pbkdf2Hash.createHash("secret"); assertFalse(pbkdf2Hash.validatePassword("bad", hash)); assertTrue(pbkdf2Hash.validatePassword("secret", hash)); } }
@Override public boolean check(final String input, final String hash) { return pbkdf2Hash.validatePassword(input, hash); } };
/** * Validates a password using a hash. * * @param password the password to check * @param goodHash the hash of the valid password * @return true if the password is correct, false if not */ public boolean validatePassword(final String password, final String goodHash) { return validatePassword(password.toCharArray(), goodHash); }