public static boolean matchPassword(String hashedPswdAndSalt, String clearPswd) {
        if (StringUtils.isNotEmpty(hashedPswdAndSalt) && StringUtils.isNotEmpty(clearPswd)) {
            int idxOfSep = hashedPswdAndSalt.indexOf(PASSWORD_SEP);
            String storedHash = hashedPswdAndSalt.substring(0, idxOfSep);
            String salt = hashedPswdAndSalt.substring(idxOfSep + 1);
            SimpleDigest digest = new SimpleDigest();

            digest.setBase64Salt(salt);

            return storedHash.equals(digest.digestBase64(clearPswd));
        } else if (hashedPswdAndSalt == null && clearPswd == null) {
            return true;
        } else if (hashedPswdAndSalt.isEmpty() && clearPswd.isEmpty()) {
            return true;
        } else {
            return false;
        }
    }
public static boolean matchPassword ( String hashedPswdAndSalt , String clearPswd ) { if ( StringUtils . isNotEmpty ( hashedPswdAndSalt ) && StringUtils . isNotEmpty ( clearPswd ) ) { int idxOfSep = hashedPswdAndSalt . indexOf ( PASSWORD_SEP ) ; String storedHash = hashedPswdAndSalt . substring ( 0 , idxOfSep ) ; String salt = hashedPswdAndSalt . substring ( idxOfSep + 1 ) ; SimpleDigest digest = new SimpleDigest ( ) ; digest . setBase64Salt ( salt ) ; return storedHash . equals ( digest . digestBase64 ( clearPswd ) ) ; } else if ( hashedPswdAndSalt == null && clearPswd == null ) { return true ; } else if ( hashedPswdAndSalt . isEmpty ( ) && clearPswd . isEmpty ( ) ) { return true ; } else { return false ; } }
Returns true if it's a password match, that is, if the hashed clear password equals the given hash.

@param hashedPswdAndSalt the hashed password + {@link #PASSWORD_SEP} + salt, as returned by
{@link #hashPassword(String)}
@param clearPswd         the password that we're trying to match, in clear
@return if the password matches