class PhpBB implements EncryptionMethod {

    @Override
    public boolean comparePassword(String password, HashedPassword hashedPassword, String name) {
        final String hash = hashedPassword.getHash();
        if (HashUtils.isValidBcryptHash(hash)) {
            return bCrypt2y.comparePassword(password, hashedPassword, name);
        } else if (hash.length() == 34) {
            return PhpassSaltedMd5.phpbb_check_hash(password, hash);
        } else {
            return PhpassSaltedMd5.md5(password).equals(hash);
        }
    }

}