#358 Handle hash + salt as one "unit"
- Rename HashResult to EncryptedPassword to reflect its broader use - Use EncryptedPassword in methods that require the hash and the salt, instead of passing them as strings separately - Store EncryptedPassword as field in PlayerAuth; updatePassword() thus processes the entire data in the EncryptedPassword object
This commit is contained in:
@@ -15,8 +15,8 @@ public abstract class UnsaltedMethod implements EncryptionMethod {
|
||||
public abstract String computeHash(String password);
|
||||
|
||||
@Override
|
||||
public HashResult computeHash(String password, String name) {
|
||||
return new HashResult(computeHash(password));
|
||||
public EncryptedPassword computeHash(String password, String name) {
|
||||
return new EncryptedPassword(computeHash(password));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -25,8 +25,8 @@ public abstract class UnsaltedMethod implements EncryptionMethod {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password, String salt, String name) {
|
||||
return hash.equals(computeHash(password));
|
||||
public boolean comparePassword(String password, EncryptedPassword encryptedPassword, String name) {
|
||||
return encryptedPassword.getHash().equals(computeHash(password));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user