//Changes 3.0:// * Repackaging from uk.org.whoami.authme to fr.xephi.authme, please developpers, update! * Rewrite some of parts of the plugin * Some code was already perfect , also did not change it :p * Full support for phpbb3 * Add full support for WordPress + passwordHash: WORDPRESS * Completely rewrite Management system for inventories and tp issues, Thanks to : [[http://dev.bukkit.org/profiles/Possible/|Possible]] * Rework on /passpartu command * Completely rewrite the password encryption method * Add a way for developers to add their own Password Encryption Method on AuthMe via event way (please see fr.xephi.authme.events.PasswordEncryptionEvent) * Add an auto purge with players.dat removing method and essentials files removing ( if you want authme to hook with an another plugin let me know ) * Complete Hook with BungeeCord by removing the /server command before login * message_lang.yml will never be overwritten with English Strings , but correctly update the message_lang.yml when needed to * Fix a lot of issues mentioned in tickets , commants , or by mp, Thanks for all your reports!
33 lines
990 B
Java
33 lines
990 B
Java
package fr.xephi.authme.security.crypts;
|
|
|
|
import java.math.BigInteger;
|
|
import java.security.MessageDigest;
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
import fr.xephi.authme.AuthMe;
|
|
|
|
|
|
public class MYBB implements EncryptionMethod {
|
|
|
|
@Override
|
|
public String getHash(String password, String salt)
|
|
throws NoSuchAlgorithmException {
|
|
return getMD5(getMD5(salt)+ getMD5(password));
|
|
}
|
|
|
|
@Override
|
|
public boolean comparePassword(String hash, String password,
|
|
String playerName) throws NoSuchAlgorithmException {
|
|
String salt = AuthMe.getInstance().database.getAuth(playerName).getSalt();
|
|
return hash.equals(getHash(password, salt));
|
|
}
|
|
|
|
private String getMD5(String message) throws NoSuchAlgorithmException {
|
|
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
|
md5.reset();
|
|
md5.update(message.getBytes());
|
|
byte[] digest = md5.digest();
|
|
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1,digest));
|
|
}
|
|
}
|