ljacqu c0a393b8b3 Minor - rename EncryptedPassword to HashedPassword
- We hash passwords; we don't encrypt them
2015-12-30 22:51:59 +01:00

28 lines
839 B
Java

package fr.xephi.authme.security.crypts;
import fr.xephi.authme.security.HashUtils;
import fr.xephi.authme.security.crypts.description.Recommendation;
import fr.xephi.authme.security.crypts.description.Usage;
@Recommendation(Usage.RECOMMENDED)
public class JOOMLA extends HexSaltedMethod {
@Override
public String computeHash(String password, String salt, String name) {
return HashUtils.md5(password + salt) + ":" + salt;
}
@Override
public boolean comparePassword(String password, HashedPassword hashedPassword, String unusedName) {
String hash = hashedPassword.getHash();
String[] hashParts = hash.split(":");
return hashParts.length == 2 && hash.equals(computeHash(password, hashParts[1], null));
}
@Override
public int getSaltLength() {
return 32;
}
}