class Pbkdf2 extends HexSaltedMethod {

    @Override
    public boolean comparePassword(String password, HashedPassword hashedPassword, String unusedName) {
        String[] line = hashedPassword.getHash().split("\\$");
        if (line.length != 4) {
            return false;
        }
        int iterations;
        try {
            iterations = Integer.parseInt(line[1]);
        } catch (NumberFormatException e) {
            ConsoleLogger.logException("Cannot read number of rounds for Pbkdf2", e);
            return false;
        }
        String salt = line[2];
        byte[] derivedKey = BinTools.hex2bin(line[3]);
        PBKDF2Parameters params = new PBKDF2Parameters("HmacSHA256", "UTF-8", salt.getBytes(), iterations, derivedKey);
        PBKDF2Engine engine = new PBKDF2Engine(params);
        return engine.verifyKey(password);
    }

    @Inject  Pbkdf2(Settings settings);

}