Update 3.1.1
//Changes 3.1.1:// * Do /login correctly in the correct thread * Add a way to force some commands after /login * Try a fix for bungeecord , let's see ... * Fix Logout command ( pos + inventory ) * Fix PHPBB support + random salt * Add a bypass antibot perm : authme.bypassantibot * Translation file will automatically update now * Some other fixes
This commit is contained in:
@@ -18,9 +18,6 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
|
||||
|
||||
/**
|
||||
* BCrypt implements OpenBSD-style Blowfish password hashing using
|
||||
* the scheme described in "A Future-Adaptable Password Scheme" by
|
||||
@@ -762,7 +759,6 @@ public class BCRYPT implements EncryptionMethod {
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
String salt = AuthMe.getInstance().database.getAuth(playerName).getSalt();
|
||||
return hash.equals(hashpw(password, salt));
|
||||
return checkpw(password, hash);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@ public class PHPBB implements EncryptionMethod {
|
||||
private String itoa64 =
|
||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
public String phpbb_hash(String password) {
|
||||
String random_state = unique_id();
|
||||
public String phpbb_hash(String password, String salt) {
|
||||
String random_state = salt;
|
||||
String random = "";
|
||||
int count = 6;
|
||||
if (random.length() < count) {
|
||||
random = "";
|
||||
for (int i = 0; i < count; i += 16) {
|
||||
random_state = md5(unique_id() + random_state);
|
||||
random_state = md5(salt + random_state);
|
||||
random += pack(md5(random_state));
|
||||
}
|
||||
random = random.substring(0, count);
|
||||
@@ -37,15 +37,6 @@ public class PHPBB implements EncryptionMethod {
|
||||
return md5(password);
|
||||
}
|
||||
|
||||
private String unique_id() {
|
||||
return unique_id("c");
|
||||
}
|
||||
|
||||
private String unique_id(String extra) {
|
||||
//TODO: Maybe check the salt?
|
||||
return "1234567890abcdef";
|
||||
}
|
||||
|
||||
private String _hash_gensalt_private(String input, String itoa64) {
|
||||
return _hash_gensalt_private(input, itoa64, 6);
|
||||
}
|
||||
@@ -162,7 +153,7 @@ private String _hash_gensalt_private(
|
||||
@Override
|
||||
public String getHash(String password, String salt)
|
||||
throws NoSuchAlgorithmException {
|
||||
return phpbb_hash(password);
|
||||
return phpbb_hash(password, salt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -61,8 +61,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class WHIRLPOOL implements EncryptionMethod {
|
||||
|
||||
public WHIRLPOOL() {}
|
||||
|
||||
/**
|
||||
* The message digest size (in bits)
|
||||
@@ -181,6 +179,9 @@ public class WHIRLPOOL implements EncryptionMethod {
|
||||
protected long[] block = new long[8];
|
||||
protected long[] state = new long[8];
|
||||
|
||||
public WHIRLPOOL() {
|
||||
}
|
||||
|
||||
/**
|
||||
* The core Whirlpool transform.
|
||||
*/
|
||||
|
||||
@@ -7,8 +7,7 @@ public class XAUTH implements EncryptionMethod {
|
||||
@Override
|
||||
public String getHash(String password, String salt)
|
||||
throws NoSuchAlgorithmException {
|
||||
WHIRLPOOL w = new WHIRLPOOL();
|
||||
String hash = w.getHash((salt + password).toLowerCase(), "");
|
||||
String hash = getWhirlpool(salt + password).toLowerCase();
|
||||
int saltPos = (password.length() >= hash.length() ? hash.length() - 1 : password.length());
|
||||
return hash.substring(0, saltPos) + salt + hash.substring(saltPos);
|
||||
}
|
||||
@@ -21,4 +20,13 @@ public class XAUTH implements EncryptionMethod {
|
||||
return hash.equals(getHash(password, salt));
|
||||
}
|
||||
|
||||
public static String getWhirlpool(String message) {
|
||||
WHIRLPOOL w = new WHIRLPOOL();
|
||||
byte[] digest = new byte[WHIRLPOOL.DIGESTBYTES];
|
||||
w.NESSIEinit();
|
||||
w.NESSIEadd(message);
|
||||
w.NESSIEfinalize(digest);
|
||||
return WHIRLPOOL.display(digest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user