boolean prefix = encryptionPrefix == null || encrypted.startsWith(encryptionPrefix);
boolean suffix = encryptionSuffix == null || encrypted.endsWith(encryptionSuffix);
if (prefix && suffix) {
encrypted = encrypted.substring(encryptionPrefix != null ? encryptionPrefix.length() : 0, encrypted.length()
- (encryptionSuffix != null ? encryptionSuffix.length() : 0));
return encryption.checkPassword(plain, encrypted);
} else {
return plain.equals(encrypted);
}
}
}