mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
commit
fbd246a338
2 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@ public boolean check(String encryptedPassword, String password) {
|
|||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance(algo);
|
||||
byte[] bytes = SecurityHelper.fromHex(encryptedPassword);
|
||||
return Arrays.equals(password.getBytes(StandardCharsets.UTF_8), digest.digest(bytes));
|
||||
return Arrays.equals(bytes, digest.digest(password.getBytes(StandardCharsets.UTF_8)));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
logger.error("Digest algorithm {} not supported", algo);
|
||||
return false;
|
||||
|
|
|
@ -18,9 +18,9 @@ public class DoubleDigestPasswordVerifier extends PasswordVerifier {
|
|||
public boolean check(String encryptedPassword, String password) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance(algo);
|
||||
byte[] bytes = SecurityHelper.fromHex(encryptedPassword);
|
||||
byte[] bytes = SecurityHelper.fromHex(password);
|
||||
byte[] firstDigest = digest.digest(bytes);
|
||||
return Arrays.equals(password.getBytes(StandardCharsets.UTF_8), toHexMode ? digest.digest(SecurityHelper.toHex(firstDigest).getBytes(StandardCharsets.UTF_8)) : digest.digest(firstDigest));
|
||||
return Arrays.equals(encryptedPassword.getBytes(StandardCharsets.UTF_8), toHexMode ? digest.digest(SecurityHelper.toHex(firstDigest).getBytes(StandardCharsets.UTF_8)) : digest.digest(firstDigest));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
logger.error("Digest algorithm {} not supported", algo);
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue