mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-20 07:37:47 +01:00
#704 Remove reloading from hash algorithms
- A new instance is created for every hash operation, so reloading will never happen on those classes
This commit is contained in:
parent
7229a8b02b
commit
92a8a5dd41
@ -1,7 +1,6 @@
|
||||
package fr.xephi.authme.security.crypts;
|
||||
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.security.crypts.description.HasSalt;
|
||||
import fr.xephi.authme.security.crypts.description.Recommendation;
|
||||
import fr.xephi.authme.security.crypts.description.SaltType;
|
||||
@ -14,13 +13,13 @@ import javax.inject.Inject;
|
||||
|
||||
@Recommendation(Usage.RECOMMENDED) // provided the salt length is >= 8
|
||||
@HasSalt(value = SaltType.TEXT) // length depends on the bcryptLog2Rounds setting
|
||||
public class BCRYPT implements EncryptionMethod, SettingsDependent {
|
||||
public class BCRYPT implements EncryptionMethod {
|
||||
|
||||
private int bCryptLog2Rounds;
|
||||
private final int bCryptLog2Rounds;
|
||||
|
||||
@Inject
|
||||
public BCRYPT(NewSetting settings) {
|
||||
loadSettings(settings);
|
||||
bCryptLog2Rounds = settings.getProperty(HooksSettings.BCRYPT_LOG2_ROUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,8 +53,4 @@ public class BCRYPT implements EncryptionMethod, SettingsDependent {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSettings(NewSetting settings) {
|
||||
bCryptLog2Rounds = settings.getProperty(HooksSettings.BCRYPT_LOG2_ROUND);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package fr.xephi.authme.security.crypts;
|
||||
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.security.RandomString;
|
||||
import fr.xephi.authme.security.crypts.description.HasSalt;
|
||||
import fr.xephi.authme.security.crypts.description.Recommendation;
|
||||
@ -15,13 +14,13 @@ import static fr.xephi.authme.security.HashUtils.md5;
|
||||
|
||||
@Recommendation(Usage.ACCEPTABLE) // presuming that length is something sensible (>= 8)
|
||||
@HasSalt(value = SaltType.TEXT) // length defined by the doubleMd5SaltLength setting
|
||||
public class SALTED2MD5 extends SeparateSaltMethod implements SettingsDependent {
|
||||
public class SALTED2MD5 extends SeparateSaltMethod {
|
||||
|
||||
private int saltLength;
|
||||
private final int saltLength;
|
||||
|
||||
@Inject
|
||||
public SALTED2MD5(NewSetting settings) {
|
||||
loadSettings(settings);
|
||||
saltLength = settings.getProperty(SecuritySettings.DOUBLE_MD5_SALT_LENGTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -34,9 +33,5 @@ public class SALTED2MD5 extends SeparateSaltMethod implements SettingsDependent
|
||||
return RandomString.generateHex(saltLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadSettings(NewSetting settings) {
|
||||
saltLength = settings.getProperty(SecuritySettings.DOUBLE_MD5_SALT_LENGTH);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user