#1128 Rename to camel case (PR #235)

* rename classes according to cammel case and make code reflect these updates

* rename according to cammel case

* rename to camel case more accuratley

* rename to camel case try 3; fix Ipb4 java doc

* retry rename camel case

* rename to camel case
This commit is contained in:
ljacqu 2017-03-17 18:49:30 +01:00 committed by GitHub
parent 18dbcfde89
commit 731d085ccd
56 changed files with 168 additions and 167 deletions

View File

@ -24,7 +24,7 @@ import fr.xephi.authme.listener.PlayerListener19;
import fr.xephi.authme.listener.ServerListener; import fr.xephi.authme.listener.ServerListener;
import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.permission.PermissionsSystemType; import fr.xephi.authme.permission.PermissionsSystemType;
import fr.xephi.authme.security.crypts.SHA256; import fr.xephi.authme.security.crypts.Sha256;
import fr.xephi.authme.service.BackupService; import fr.xephi.authme.service.BackupService;
import fr.xephi.authme.service.BukkitService; import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.service.GeoIpService; import fr.xephi.authme.service.GeoIpService;
@ -219,7 +219,7 @@ public class AuthMe extends JavaPlugin {
instantiateServices(injector); instantiateServices(injector);
// Convert deprecated PLAINTEXT hash entries // Convert deprecated PLAINTEXT hash entries
MigrationService.changePlainTextToSha256(settings, database, new SHA256()); MigrationService.changePlainTextToSha256(settings, database, new Sha256());
// TODO: does this still make sense? -sgdc3 // TODO: does this still make sense? -sgdc3
// If the server is empty (fresh start) just set all the players as unlogged // If the server is empty (fresh start) just set all the players as unlogged

View File

@ -7,7 +7,7 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.data.auth.PlayerAuth; import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.security.crypts.HashedPassword; import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.security.crypts.XFBCRYPT; import fr.xephi.authme.security.crypts.XfBCrypt;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.settings.properties.HooksSettings;
@ -286,7 +286,7 @@ public class MySQL implements DataSource {
if (rs.next()) { if (rs.next()) {
Blob blob = rs.getBlob("data"); Blob blob = rs.getBlob("data");
byte[] bytes = blob.getBytes(1, (int) blob.length()); byte[] bytes = blob.getBytes(1, (int) blob.length());
auth.setPassword(new HashedPassword(XFBCRYPT.getHashFromBlob(bytes))); auth.setPassword(new HashedPassword(XfBCrypt.getHashFromBlob(bytes)));
} }
} }
} }
@ -482,8 +482,8 @@ public class MySQL implements DataSource {
sql = "INSERT INTO xf_user_authenticate (user_id, scheme_class, data) VALUES (?,?,?)"; sql = "INSERT INTO xf_user_authenticate (user_id, scheme_class, data) VALUES (?,?,?)";
pst2 = con.prepareStatement(sql); pst2 = con.prepareStatement(sql);
pst2.setInt(1, id); pst2.setInt(1, id);
pst2.setString(2, XFBCRYPT.SCHEME_CLASS); pst2.setString(2, XfBCrypt.SCHEME_CLASS);
String serializedHash = XFBCRYPT.serializeHash(auth.getPassword().getHash()); String serializedHash = XfBCrypt.serializeHash(auth.getPassword().getHash());
byte[] bytes = serializedHash.getBytes(); byte[] bytes = serializedHash.getBytes();
Blob blob = con.createBlob(); Blob blob = con.createBlob();
blob.setBytes(1, bytes); blob.setBytes(1, bytes);
@ -538,7 +538,7 @@ public class MySQL implements DataSource {
// Insert password in the correct table // Insert password in the correct table
sql = "UPDATE xf_user_authenticate SET data=? WHERE " + col.ID + "=?;"; sql = "UPDATE xf_user_authenticate SET data=? WHERE " + col.ID + "=?;";
PreparedStatement pst2 = con.prepareStatement(sql); PreparedStatement pst2 = con.prepareStatement(sql);
String serializedHash = XFBCRYPT.serializeHash(password.getHash()); String serializedHash = XfBCrypt.serializeHash(password.getHash());
byte[] bytes = serializedHash.getBytes(); byte[] bytes = serializedHash.getBytes();
Blob blob = con.createBlob(); Blob blob = con.createBlob();
blob.setBytes(1, bytes); blob.setBytes(1, bytes);
@ -549,7 +549,7 @@ public class MySQL implements DataSource {
// ... // ...
sql = "UPDATE xf_user_authenticate SET scheme_class=? WHERE " + col.ID + "=?;"; sql = "UPDATE xf_user_authenticate SET scheme_class=? WHERE " + col.ID + "=?;";
pst2 = con.prepareStatement(sql); pst2 = con.prepareStatement(sql);
pst2.setString(1, XFBCRYPT.SCHEME_CLASS); pst2.setString(1, XfBCrypt.SCHEME_CLASS);
pst2.setInt(2, id); pst2.setInt(2, id);
pst2.executeUpdate(); pst2.executeUpdate();
pst2.close(); pst2.close();
@ -824,7 +824,7 @@ public class MySQL implements DataSource {
if (rs2.next()) { if (rs2.next()) {
Blob blob = rs2.getBlob("data"); Blob blob = rs2.getBlob("data");
byte[] bytes = blob.getBytes(1, (int) blob.length()); byte[] bytes = blob.getBytes(1, (int) blob.length());
pAuth.setPassword(new HashedPassword(XFBCRYPT.getHashFromBlob(bytes))); pAuth.setPassword(new HashedPassword(XfBCrypt.getHashFromBlob(bytes)));
} }
rs2.close(); rs2.close();
} }
@ -856,7 +856,7 @@ public class MySQL implements DataSource {
if (rs2.next()) { if (rs2.next()) {
Blob blob = rs2.getBlob("data"); Blob blob = rs2.getBlob("data");
byte[] bytes = blob.getBytes(1, (int) blob.length()); byte[] bytes = blob.getBytes(1, (int) blob.length());
pAuth.setPassword(new HashedPassword(XFBCRYPT.getHashFromBlob(bytes))); pAuth.setPassword(new HashedPassword(XfBCrypt.getHashFromBlob(bytes)));
} }
rs2.close(); rs2.close();
} }

View File

@ -7,36 +7,36 @@ import fr.xephi.authme.security.crypts.EncryptionMethod;
*/ */
public enum HashAlgorithm { public enum HashAlgorithm {
BCRYPT(fr.xephi.authme.security.crypts.BCRYPT.class), BCRYPT(fr.xephi.authme.security.crypts.BCrypt.class),
BCRYPT2Y(fr.xephi.authme.security.crypts.BCRYPT2Y.class), BCRYPT2Y(fr.xephi.authme.security.crypts.BCrypt2y.class),
CRAZYCRYPT1(fr.xephi.authme.security.crypts.CRAZYCRYPT1.class), CRAZYCRYPT1(fr.xephi.authme.security.crypts.CrazyCrypt1.class),
DOUBLEMD5(fr.xephi.authme.security.crypts.DOUBLEMD5.class), DOUBLEMD5(fr.xephi.authme.security.crypts.DoubleMd5.class),
IPB3(fr.xephi.authme.security.crypts.IPB3.class), IPB3(fr.xephi.authme.security.crypts.Ipb3.class),
IPB4(fr.xephi.authme.security.crypts.IPB4.class), IPB4(fr.xephi.authme.security.crypts.Ipb4.class),
JOOMLA(fr.xephi.authme.security.crypts.JOOMLA.class), JOOMLA(fr.xephi.authme.security.crypts.Joomla.class),
MD5(fr.xephi.authme.security.crypts.MD5.class), MD5(fr.xephi.authme.security.crypts.Md5.class),
MD5VB(fr.xephi.authme.security.crypts.MD5VB.class), MD5VB(fr.xephi.authme.security.crypts.Md5vB.class),
MYBB(fr.xephi.authme.security.crypts.MYBB.class), MYBB(fr.xephi.authme.security.crypts.MyBB.class),
PBKDF2(fr.xephi.authme.security.crypts.Pbkdf2.class), PBKDF2(fr.xephi.authme.security.crypts.Pbkdf2.class),
PBKDF2DJANGO(fr.xephi.authme.security.crypts.Pbkdf2Django.class), PBKDF2DJANGO(fr.xephi.authme.security.crypts.Pbkdf2Django.class),
PHPBB(fr.xephi.authme.security.crypts.PHPBB.class), PHPBB(fr.xephi.authme.security.crypts.PhpBB.class),
PHPFUSION(fr.xephi.authme.security.crypts.PHPFUSION.class), PHPFUSION(fr.xephi.authme.security.crypts.PhpFusion.class),
@Deprecated @Deprecated
PLAINTEXT(fr.xephi.authme.security.crypts.PLAINTEXT.class), PLAINTEXT(fr.xephi.authme.security.crypts.PlainText.class),
ROYALAUTH(fr.xephi.authme.security.crypts.ROYALAUTH.class), ROYALAUTH(fr.xephi.authme.security.crypts.RoyalAuth.class),
SALTED2MD5(fr.xephi.authme.security.crypts.SALTED2MD5.class), SALTED2MD5(fr.xephi.authme.security.crypts.Salted2Md5.class),
SALTEDSHA512(fr.xephi.authme.security.crypts.SALTEDSHA512.class), SALTEDSHA512(fr.xephi.authme.security.crypts.SaltedSha512.class),
SHA1(fr.xephi.authme.security.crypts.SHA1.class), SHA1(fr.xephi.authme.security.crypts.Sha1.class),
SHA256(fr.xephi.authme.security.crypts.SHA256.class), SHA256(fr.xephi.authme.security.crypts.Sha256.class),
SHA512(fr.xephi.authme.security.crypts.SHA512.class), SHA512(fr.xephi.authme.security.crypts.Sha512.class),
SMF(fr.xephi.authme.security.crypts.SMF.class), SMF(fr.xephi.authme.security.crypts.Smf.class),
TWO_FACTOR(fr.xephi.authme.security.crypts.TwoFactor.class), TWO_FACTOR(fr.xephi.authme.security.crypts.TwoFactor.class),
WBB3(fr.xephi.authme.security.crypts.WBB3.class), WBB3(fr.xephi.authme.security.crypts.Wbb3.class),
WBB4(fr.xephi.authme.security.crypts.WBB4.class), WBB4(fr.xephi.authme.security.crypts.Wbb4.class),
WHIRLPOOL(fr.xephi.authme.security.crypts.WHIRLPOOL.class), WHIRLPOOL(fr.xephi.authme.security.crypts.Whirlpool.class),
WORDPRESS(fr.xephi.authme.security.crypts.WORDPRESS.class), WORDPRESS(fr.xephi.authme.security.crypts.Wordpress.class),
XAUTH(fr.xephi.authme.security.crypts.XAUTH.class), XAUTH(fr.xephi.authme.security.crypts.XAuth.class),
XFBCRYPT(fr.xephi.authme.security.crypts.XFBCRYPT.class), XFBCRYPT(fr.xephi.authme.security.crypts.XfBCrypt.class),
CUSTOM(null); CUSTOM(null);
private final Class<? extends EncryptionMethod> clazz; private final Class<? extends EncryptionMethod> clazz;

View File

@ -14,12 +14,12 @@ import javax.inject.Inject;
@Recommendation(Usage.RECOMMENDED) // provided the salt length is >= 8 @Recommendation(Usage.RECOMMENDED) // provided the salt length is >= 8
@HasSalt(value = SaltType.TEXT) // length depends on the bcryptLog2Rounds setting @HasSalt(value = SaltType.TEXT) // length depends on the bcryptLog2Rounds setting
public class BCRYPT implements EncryptionMethod { public class BCrypt implements EncryptionMethod {
private final int bCryptLog2Rounds; private final int bCryptLog2Rounds;
@Inject @Inject
public BCRYPT(Settings settings) { public BCrypt(Settings settings) {
bCryptLog2Rounds = settings.getProperty(HooksSettings.BCRYPT_LOG2_ROUND); bCryptLog2Rounds = settings.getProperty(HooksSettings.BCRYPT_LOG2_ROUND);
} }

View File

@ -4,7 +4,7 @@ import fr.xephi.authme.security.crypts.description.Recommendation;
import fr.xephi.authme.security.crypts.description.Usage; import fr.xephi.authme.security.crypts.description.Usage;
@Recommendation(Usage.RECOMMENDED) @Recommendation(Usage.RECOMMENDED)
public class BCRYPT2Y extends HexSaltedMethod { public class BCrypt2y extends HexSaltedMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -6,7 +6,7 @@ import fr.xephi.authme.security.MessageDigestAlgorithm;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
public class CRAZYCRYPT1 extends UsernameSaltMethod { public class CrazyCrypt1 extends UsernameSaltMethod {
private static final char[] CRYPTCHARS = private static final char[] CRYPTCHARS =
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};

View File

@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
import static fr.xephi.authme.security.HashUtils.md5; import static fr.xephi.authme.security.HashUtils.md5;
public class DOUBLEMD5 extends UnsaltedMethod { public class DoubleMd5 extends UnsaltedMethod {
@Override @Override
public String computeHash(String password) { public String computeHash(String password) {

View File

@ -10,7 +10,7 @@ import static fr.xephi.authme.security.HashUtils.md5;
@Recommendation(Usage.ACCEPTABLE) @Recommendation(Usage.ACCEPTABLE)
@HasSalt(value = SaltType.TEXT, length = 5) @HasSalt(value = SaltType.TEXT, length = 5)
public class IPB3 extends SeparateSaltMethod { public class Ipb3 extends SeparateSaltMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -11,15 +11,15 @@ import fr.xephi.authme.util.StringUtils;
/** /**
* Implementation for IPB4 (Invision Power Board 4). * Implementation for Ipb4 (Invision Power Board 4).
* <p> * <p>
* The hash uses standard BCrypt with 13 as log<sub>2</sub> number of rounds. Additionally, * The hash uses standard BCrypt with 13 as log<sub>2</sub> number of rounds. Additionally,
* IPB4 requires that the salt be stored additionally in the column "members_pass_hash" * Ipb4 requires that the salt be stored additionally in the column "members_pass_hash"
* (even though BCrypt hashes already have the salt in the result). * (even though BCrypt hashes already have the salt in the result).
*/ */
@Recommendation(Usage.DOES_NOT_WORK) @Recommendation(Usage.DOES_NOT_WORK)
@HasSalt(value = SaltType.TEXT, length = 22) @HasSalt(value = SaltType.TEXT, length = 22)
public class IPB4 implements EncryptionMethod { public class Ipb4 implements EncryptionMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -5,7 +5,7 @@ import fr.xephi.authme.security.crypts.description.Recommendation;
import fr.xephi.authme.security.crypts.description.Usage; import fr.xephi.authme.security.crypts.description.Usage;
@Recommendation(Usage.ACCEPTABLE) @Recommendation(Usage.ACCEPTABLE)
public class JOOMLA extends HexSaltedMethod { public class Joomla extends HexSaltedMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
import fr.xephi.authme.security.HashUtils; import fr.xephi.authme.security.HashUtils;
public class MD5 extends UnsaltedMethod { public class Md5 extends UnsaltedMethod {
@Override @Override
public String computeHash(String password) { public String computeHash(String password) {

View File

@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
import static fr.xephi.authme.security.HashUtils.md5; import static fr.xephi.authme.security.HashUtils.md5;
public class MD5VB extends HexSaltedMethod { public class Md5vB extends HexSaltedMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -10,7 +10,7 @@ import static fr.xephi.authme.security.HashUtils.md5;
@Recommendation(Usage.ACCEPTABLE) @Recommendation(Usage.ACCEPTABLE)
@HasSalt(value = SaltType.TEXT, length = 8) @HasSalt(value = SaltType.TEXT, length = 8)
public class MYBB extends SeparateSaltMethod { public class MyBB extends SeparateSaltMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -9,7 +9,7 @@ import java.security.MessageDigest;
/** /**
* @author stefano * @author stefano
*/ */
public class PHPBB extends HexSaltedMethod { public class PhpBB extends HexSaltedMethod {
private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

View File

@ -14,7 +14,7 @@ import java.security.NoSuchAlgorithmException;
@Recommendation(Usage.DO_NOT_USE) @Recommendation(Usage.DO_NOT_USE)
@AsciiRestricted @AsciiRestricted
public class PHPFUSION extends SeparateSaltMethod { public class PhpFusion extends SeparateSaltMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -6,7 +6,7 @@ package fr.xephi.authme.security.crypts;
* @deprecated Using this is no longer supported. AuthMe will migrate to SHA256 on startup. * @deprecated Using this is no longer supported. AuthMe will migrate to SHA256 on startup.
*/ */
@Deprecated @Deprecated
public class PLAINTEXT extends UnsaltedMethod { public class PlainText extends UnsaltedMethod {
@Override @Override
public String computeHash(String password) { public String computeHash(String password) {

View File

@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
import fr.xephi.authme.security.HashUtils; import fr.xephi.authme.security.HashUtils;
public class ROYALAUTH extends UnsaltedMethod { public class RoyalAuth extends UnsaltedMethod {
@Override @Override
public String computeHash(String password) { public String computeHash(String password) {

View File

@ -14,12 +14,12 @@ import static fr.xephi.authme.security.HashUtils.md5;
@Recommendation(Usage.ACCEPTABLE) // presuming that length is something sensible (>= 8) @Recommendation(Usage.ACCEPTABLE) // presuming that length is something sensible (>= 8)
@HasSalt(value = SaltType.TEXT) // length defined by the doubleMd5SaltLength setting @HasSalt(value = SaltType.TEXT) // length defined by the doubleMd5SaltLength setting
public class SALTED2MD5 extends SeparateSaltMethod { public class Salted2Md5 extends SeparateSaltMethod {
private final int saltLength; private final int saltLength;
@Inject @Inject
public SALTED2MD5(Settings settings) { public Salted2Md5(Settings settings) {
saltLength = settings.getProperty(SecuritySettings.DOUBLE_MD5_SALT_LENGTH); saltLength = settings.getProperty(SecuritySettings.DOUBLE_MD5_SALT_LENGTH);
} }

View File

@ -6,7 +6,7 @@ import fr.xephi.authme.security.crypts.description.Recommendation;
import fr.xephi.authme.security.crypts.description.Usage; import fr.xephi.authme.security.crypts.description.Usage;
@Recommendation(Usage.RECOMMENDED) @Recommendation(Usage.RECOMMENDED)
public class SALTEDSHA512 extends SeparateSaltMethod { public class SaltedSha512 extends SeparateSaltMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
import fr.xephi.authme.security.HashUtils; import fr.xephi.authme.security.HashUtils;
public class SHA1 extends UnsaltedMethod { public class Sha1 extends UnsaltedMethod {
@Override @Override
public String computeHash(String password) { public String computeHash(String password) {

View File

@ -6,7 +6,7 @@ import fr.xephi.authme.security.crypts.description.Usage;
import static fr.xephi.authme.security.HashUtils.sha256; import static fr.xephi.authme.security.HashUtils.sha256;
@Recommendation(Usage.RECOMMENDED) @Recommendation(Usage.RECOMMENDED)
public class SHA256 extends HexSaltedMethod { public class Sha256 extends HexSaltedMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
import fr.xephi.authme.security.HashUtils; import fr.xephi.authme.security.HashUtils;
public class SHA512 extends UnsaltedMethod { public class Sha512 extends UnsaltedMethod {
@Override @Override
public String computeHash(String password) { public String computeHash(String password) {

View File

@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
import fr.xephi.authme.security.HashUtils; import fr.xephi.authme.security.HashUtils;
public class SMF extends UsernameSaltMethod { public class Smf extends UsernameSaltMethod {
@Override @Override
public HashedPassword computeHash(String password, String name) { public HashedPassword computeHash(String password, String name) {

View File

@ -10,7 +10,7 @@ import static fr.xephi.authme.security.HashUtils.sha1;
@Recommendation(Usage.ACCEPTABLE) @Recommendation(Usage.ACCEPTABLE)
@HasSalt(value = SaltType.TEXT, length = 40) @HasSalt(value = SaltType.TEXT, length = 40)
public class WBB3 extends SeparateSaltMethod { public class Wbb3 extends SeparateSaltMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -6,7 +6,7 @@ import fr.xephi.authme.security.crypts.description.Usage;
import static fr.xephi.authme.security.crypts.BCryptService.hashpw; import static fr.xephi.authme.security.crypts.BCryptService.hashpw;
@Recommendation(Usage.RECOMMENDED) @Recommendation(Usage.RECOMMENDED)
public class WBB4 extends HexSaltedMethod { public class Wbb4 extends HexSaltedMethod {
@Override @Override
public String computeHash(String password, String salt, String name) { public String computeHash(String password, String salt, String name) {

View File

@ -61,7 +61,7 @@ package fr.xephi.authme.security.crypts;
import java.util.Arrays; import java.util.Arrays;
public class WHIRLPOOL extends UnsaltedMethod { public class Whirlpool extends UnsaltedMethod {
/** /**
* The message digest size (in bits) * The message digest size (in bits)
@ -158,7 +158,7 @@ public class WHIRLPOOL extends UnsaltedMethod {
protected final long[] block = new long[8]; protected final long[] block = new long[8];
protected final long[] state = new long[8]; protected final long[] state = new long[8];
public WHIRLPOOL() { public Whirlpool() {
} }
protected static String display(byte[] array) { protected static String display(byte[] array) {

View File

@ -16,7 +16,7 @@ import java.util.Arrays;
@HasSalt(value = SaltType.TEXT, length = 9) @HasSalt(value = SaltType.TEXT, length = 9)
// Note ljacqu 20151228: Wordpress is actually a salted algorithm but salt generation is handled internally // Note ljacqu 20151228: Wordpress is actually a salted algorithm but salt generation is handled internally
// and isn't exposed to the outside, so we treat it as an unsalted implementation // and isn't exposed to the outside, so we treat it as an unsalted implementation
public class WORDPRESS extends UnsaltedMethod { public class Wordpress extends UnsaltedMethod {
private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
private final SecureRandom randomGen = new SecureRandom(); private final SecureRandom randomGen = new SecureRandom();

View File

@ -4,15 +4,15 @@ import fr.xephi.authme.security.crypts.description.Recommendation;
import fr.xephi.authme.security.crypts.description.Usage; import fr.xephi.authme.security.crypts.description.Usage;
@Recommendation(Usage.RECOMMENDED) @Recommendation(Usage.RECOMMENDED)
public class XAUTH extends HexSaltedMethod { public class XAuth extends HexSaltedMethod {
private static String getWhirlpool(String message) { private static String getWhirlpool(String message) {
WHIRLPOOL w = new WHIRLPOOL(); Whirlpool w = new Whirlpool();
byte[] digest = new byte[WHIRLPOOL.DIGESTBYTES]; byte[] digest = new byte[Whirlpool.DIGESTBYTES];
w.NESSIEinit(); w.NESSIEinit();
w.NESSIEadd(message); w.NESSIEadd(message);
w.NESSIEfinalize(digest); w.NESSIEfinalize(digest);
return WHIRLPOOL.display(digest); return Whirlpool.display(digest);
} }
@Override @Override

View File

@ -7,7 +7,7 @@ import fr.xephi.authme.util.StringUtils;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class XFBCRYPT implements EncryptionMethod { public class XfBCrypt implements EncryptionMethod {
public static final String SCHEME_CLASS = "XenForo_Authentication_Core12"; public static final String SCHEME_CLASS = "XenForo_Authentication_Core12";
private static final Pattern HASH_PATTERN = Pattern.compile("\"hash\";s.*\"(.*)?\""); private static final Pattern HASH_PATTERN = Pattern.compile("\"hash\";s.*\"(.*)?\"");

View File

@ -5,7 +5,7 @@ import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.security.crypts.HashedPassword; import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.security.crypts.SHA256; import fr.xephi.authme.security.crypts.Sha256;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.settings.properties.SecuritySettings;
@ -20,14 +20,14 @@ public final class MigrationService {
} }
/** /**
* Hash all passwords to SHA256 and updated the setting if the password hash is set to the deprecated PLAINTEXT. * Hash all passwords to Sha256 and updated the setting if the password hash is set to the deprecated PLAINTEXT.
* *
* @param settings The settings instance * @param settings The settings instance
* @param dataSource The data source * @param dataSource The data source
* @param authmeSha256 Instance to the AuthMe SHA256 encryption method implementation * @param authmeSha256 Instance to the AuthMe Sha256 encryption method implementation
*/ */
public static void changePlainTextToSha256(Settings settings, DataSource dataSource, public static void changePlainTextToSha256(Settings settings, DataSource dataSource,
SHA256 authmeSha256) { Sha256 authmeSha256) {
if (HashAlgorithm.PLAINTEXT == settings.getProperty(SecuritySettings.PASSWORD_HASH)) { if (HashAlgorithm.PLAINTEXT == settings.getProperty(SecuritySettings.PASSWORD_HASH)) {
ConsoleLogger.warning("Your HashAlgorithm has been detected as plaintext and is now deprecated;" ConsoleLogger.warning("Your HashAlgorithm has been detected as plaintext and is now deprecated;"
+ " it will be changed and hashed now to the AuthMe default hashing method"); + " it will be changed and hashed now to the AuthMe default hashing method");

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link BCRYPT2Y}. * Test for {@link BCrypt2y}.
*/ */
public class BCRYPT2YTest extends AbstractEncryptionMethodTest { public class BCrypt2yTest extends AbstractEncryptionMethodTest {
public BCRYPT2YTest() { public BCrypt2yTest() {
super(new BCRYPT2Y(), super(new BCrypt2y(),
"$2y$10$da641e404b982edf1c7c0uTU9BcKzfA2vWKV05q6r.dCvm/93wqVK", // password "$2y$10$da641e404b982edf1c7c0uTU9BcKzfA2vWKV05q6r.dCvm/93wqVK", // password
"$2y$10$e52c48a76f5b86f5da899uiK/HYocyPsfQXESNbP278rIz08LKEP2", // PassWord1 "$2y$10$e52c48a76f5b86f5da899uiK/HYocyPsfQXESNbP278rIz08LKEP2", // PassWord1
"$2y$10$be6f11548dc5fb4088410ONdC0dXnJ04y1RHcJh5fVF3XK5d.qgqK", // &^%te$t?Pw@_ "$2y$10$be6f11548dc5fb4088410ONdC0dXnJ04y1RHcJh5fVF3XK5d.qgqK", // &^%te$t?Pw@_

View File

@ -7,12 +7,12 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
/** /**
* Test for {@link BCRYPT}. * Test for {@link BCrypt}.
*/ */
public class BcryptTest extends AbstractEncryptionMethodTest { public class BCryptTest extends AbstractEncryptionMethodTest {
public BcryptTest() { public BCryptTest() {
super(new BCRYPT(mockSettings()), super(new BCrypt(mockSettings()),
"$2a$10$6iATmYgwJVc3YONhVcZFve3Cfb5GnwvKhJ20r.hMjmcNkIT9.Uh9K", // password "$2a$10$6iATmYgwJVc3YONhVcZFve3Cfb5GnwvKhJ20r.hMjmcNkIT9.Uh9K", // password
"$2a$10$LOhUxhEcS0vgDPv/jkXvCurNb7LjP9xUlEolJGk.Uhgikqc6FtIOi", // PassWord1 "$2a$10$LOhUxhEcS0vgDPv/jkXvCurNb7LjP9xUlEolJGk.Uhgikqc6FtIOi", // PassWord1
"$2a$10$j9da7SGiaakWhzIms9BtwemLUeIhSEphGUQ3XSlvYgpYsGnGCKRBa", // &^%te$t?Pw@_ "$2a$10$j9da7SGiaakWhzIms9BtwemLUeIhSEphGUQ3XSlvYgpYsGnGCKRBa", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link CRAZYCRYPT1}. * Test for {@link CrazyCrypt1}.
*/ */
public class CRAZYCRYPT1Test extends AbstractEncryptionMethodTest { public class CrazyCrypt1Test extends AbstractEncryptionMethodTest {
public CRAZYCRYPT1Test() { public CrazyCrypt1Test() {
super(new CRAZYCRYPT1(), super(new CrazyCrypt1(),
"d5c76eb36417d4e97ec62609619e40a9e549a2598d0dab5a7194fd997a9305af78de2b93f958e150d19dd1e7f821043379ddf5f9c7f352bf27df91ae4913f3e8", // password "d5c76eb36417d4e97ec62609619e40a9e549a2598d0dab5a7194fd997a9305af78de2b93f958e150d19dd1e7f821043379ddf5f9c7f352bf27df91ae4913f3e8", // password
"49c63f827c88196871e344e589bd46cc4fa6db3c27801bbad5374c0d216381977627c1d76f2114667d5dd117e046f7493eb06e4f461f4f848aa08f6f40a3e934", // PassWord1 "49c63f827c88196871e344e589bd46cc4fa6db3c27801bbad5374c0d216381977627c1d76f2114667d5dd117e046f7493eb06e4f461f4f848aa08f6f40a3e934", // PassWord1
"6fefb0233bab6e6efb9c16f82cb0d8f569488905e2dae0e7c9dde700e7363da67213d37c44bc15f4a05854c9c21e5688389d416413c7309398aa96cb1f341d08", // &^%te$t?Pw@_ "6fefb0233bab6e6efb9c16f82cb0d8f569488905e2dae0e7c9dde700e7363da67213d37c44bc15f4a05854c9c21e5688389d416413c7309398aa96cb1f341d08", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link DOUBLEMD5}. * Test for {@link DoubleMd5}.
*/ */
public class DOUBLEMD5Test extends AbstractEncryptionMethodTest { public class DoubleMd5Test extends AbstractEncryptionMethodTest {
public DOUBLEMD5Test() { public DoubleMd5Test() {
super(new DOUBLEMD5(), super(new DoubleMd5(),
"696d29e0940a4957748fe3fc9efd22a3", // password "696d29e0940a4957748fe3fc9efd22a3", // password
"c77aa2024d9fb7233a2872452d601aba", // PassWord1 "c77aa2024d9fb7233a2872452d601aba", // PassWord1
"fbd5790af706ec19f8a7ef161878758b", // &^%te$t?Pw@_ "fbd5790af706ec19f8a7ef161878758b", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link IPB3}. * Test for {@link Ipb3}.
*/ */
public class IPB3Test extends AbstractEncryptionMethodTest { public class Ipb3Test extends AbstractEncryptionMethodTest {
public IPB3Test() { public Ipb3Test() {
super(new IPB3(), super(new Ipb3(),
new HashedPassword("f8ecea1ce42b5babef369ff7692dbe3f", "1715b"), //password new HashedPassword("f8ecea1ce42b5babef369ff7692dbe3f", "1715b"), //password
new HashedPassword("40a93731a931352e0619cdf09b975040", "ba91c"), //PassWord1 new HashedPassword("40a93731a931352e0619cdf09b975040", "ba91c"), //PassWord1
new HashedPassword("a77ca982373946d5800430bd2947ba11", "a7725"), //&^%te$t?Pw@_ new HashedPassword("a77ca982373946d5800430bd2947ba11", "a7725"), //&^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link IPB4}. * Test for {@link Ipb4}.
*/ */
public class IPB4Test extends AbstractEncryptionMethodTest { public class Ipb4Test extends AbstractEncryptionMethodTest {
public IPB4Test() { public Ipb4Test() {
super(new IPB4(), super(new Ipb4(),
new HashedPassword("$2a$13$leEvXu77OIwPwNvtZIJvaeAx8EItGHuR3nIlq8416g0gXeJaQdrr2", "leEvXu77OIwPwNvtZIJval"), //password new HashedPassword("$2a$13$leEvXu77OIwPwNvtZIJvaeAx8EItGHuR3nIlq8416g0gXeJaQdrr2", "leEvXu77OIwPwNvtZIJval"), //password
new HashedPassword("$2a$13$xyTTP9zhQQtRRKIJPv5AuuOGJ6Ni9FLbDhcuIAcPjt3XzCxIWe3Uu", "xyTTP9zhQQtRRKIJPv5Au3"), //PassWord1 new HashedPassword("$2a$13$xyTTP9zhQQtRRKIJPv5AuuOGJ6Ni9FLbDhcuIAcPjt3XzCxIWe3Uu", "xyTTP9zhQQtRRKIJPv5Au3"), //PassWord1
new HashedPassword("$2a$13$rGBrqErm9DZyzbxIGHlgf.xfA15/4d5Ay/TK.3y9lG3AljcoG9Lsi", "rGBrqErm9DZyzbxIGHlgfN"), //&^%te$t?Pw@_ new HashedPassword("$2a$13$rGBrqErm9DZyzbxIGHlgf.xfA15/4d5Ay/TK.3y9lG3AljcoG9Lsi", "rGBrqErm9DZyzbxIGHlgfN"), //&^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link JOOMLA}. * Test for {@link Joomla}.
*/ */
public class JoomlaTest extends AbstractEncryptionMethodTest { public class JoomlaTest extends AbstractEncryptionMethodTest {
public JoomlaTest() { public JoomlaTest() {
super(new JOOMLA(), super(new Joomla(),
"b18c99813cd96df3a706652f47177490:377c4aaf92c5ed57711306909e6065ca", // password "b18c99813cd96df3a706652f47177490:377c4aaf92c5ed57711306909e6065ca", // password
"c5af71da91a8841d95937ba24a5b7fdb:07068e5850930b794526a614438cafc7", // PassWord1 "c5af71da91a8841d95937ba24a5b7fdb:07068e5850930b794526a614438cafc7", // PassWord1
"f5fccd5166af7080833d7c7a6a531295:7cb6eeabcfac67ffe1341ec43375a9e6", // &^%te$t?Pw@_ "f5fccd5166af7080833d7c7a6a531295:7cb6eeabcfac67ffe1341ec43375a9e6", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link MD5VB}. * Test for {@link Md5vB}.
*/ */
public class MD5VBTest extends AbstractEncryptionMethodTest { public class Md5vBTest extends AbstractEncryptionMethodTest {
public MD5VBTest() { public Md5vBTest() {
super(new MD5VB(), super(new Md5vB(),
"$MD5vb$bd9832fffa287321$5006d371fcb813f2347987f902a024ad", // password "$MD5vb$bd9832fffa287321$5006d371fcb813f2347987f902a024ad", // password
"$MD5vb$5e492c1166b5a828$c954fa5ee561700a097826971653b57f", // PassWord1 "$MD5vb$5e492c1166b5a828$c954fa5ee561700a097826971653b57f", // PassWord1
"$MD5vb$3ec43cd46a61d70b$59687c0976f2e327b1245c8063f7008c", // &^%te$t?Pw@_ "$MD5vb$3ec43cd46a61d70b$59687c0976f2e327b1245c8063f7008c", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link MYBB}. * Test for {@link MyBB}.
*/ */
public class MYBBTest extends AbstractEncryptionMethodTest { public class MyBBTest extends AbstractEncryptionMethodTest {
public MYBBTest() { public MyBBTest() {
super(new MYBB(), super(new MyBB(),
new HashedPassword("57c7a16d860833db5030738f5a465d2b", "acdc14e6"), //password new HashedPassword("57c7a16d860833db5030738f5a465d2b", "acdc14e6"), //password
new HashedPassword("08fbdf721f2c42d9780b7d66df0ba830", "792fd7fb"), //PassWord1 new HashedPassword("08fbdf721f2c42d9780b7d66df0ba830", "792fd7fb"), //PassWord1
new HashedPassword("d602f38fb59ad9e185d5604f5d4ddb36", "4b5534a4"), //&^%te$t?Pw@_ new HashedPassword("d602f38fb59ad9e185d5604f5d4ddb36", "4b5534a4"), //&^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link MD5}. * Test for {@link Md5}.
*/ */
public class Md5Test extends AbstractEncryptionMethodTest { public class Md5Test extends AbstractEncryptionMethodTest {
public Md5Test() { public Md5Test() {
super(new MD5(), super(new Md5(),
"5f4dcc3b5aa765d61d8327deb882cf99", // password "5f4dcc3b5aa765d61d8327deb882cf99", // password
"f2126d405f46ed603ff5b2950f062c96", // PassWord1 "f2126d405f46ed603ff5b2950f062c96", // PassWord1
"0833dcd2bc741f90c46bbac5498fd08f", // &^%te$t?Pw@_ "0833dcd2bc741f90c46bbac5498fd08f", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link PHPBB}. * Test for {@link PhpBB}.
*/ */
public class PHPBBTest extends AbstractEncryptionMethodTest { public class PhpBBTest extends AbstractEncryptionMethodTest {
public PHPBBTest() { public PhpBBTest() {
super(new PHPBB(), super(new PhpBB(),
"$H$7MaSGQb0xe3Fp/a.Q.Ewpw.UKfCv.t0", // password "$H$7MaSGQb0xe3Fp/a.Q.Ewpw.UKfCv.t0", // password
"$H$7ESfAVjzqajC7fJFcZKZIhyds41MuW.", // PassWord1 "$H$7ESfAVjzqajC7fJFcZKZIhyds41MuW.", // PassWord1
"$H$7G65SXRPbR69jLg.qZTjtqsw36Ciw7.", // &^%te$t?Pw@_ "$H$7G65SXRPbR69jLg.qZTjtqsw36Ciw7.", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link PHPFUSION}. * Test for {@link PhpFusion}.
*/ */
public class PHPFUSIONTest extends AbstractEncryptionMethodTest { public class PhpFusionTest extends AbstractEncryptionMethodTest {
public PHPFUSIONTest() { public PhpFusionTest() {
super(new PHPFUSION(), super(new PhpFusion(),
new HashedPassword("f7a606c4eb3fcfbc382906476e05b06f21234a77d1a4eacc0f93f503deb69e70", "6cd1c97c55cb"), // password new HashedPassword("f7a606c4eb3fcfbc382906476e05b06f21234a77d1a4eacc0f93f503deb69e70", "6cd1c97c55cb"), // password
new HashedPassword("8a9b7bb706a3347e5f684a7cb905bfb26b9a0d099358064139ab3ed1a66aeb2b", "d6012370b73f"), // PassWord1 new HashedPassword("8a9b7bb706a3347e5f684a7cb905bfb26b9a0d099358064139ab3ed1a66aeb2b", "d6012370b73f"), // PassWord1
new HashedPassword("43f2f23f44c8f89e2dbf06050bc8c77dbcdf71a7b5d28c87ec657d474e63d62d", "f75400a209a4"), // &^%te$t?Pw@_ new HashedPassword("43f2f23f44c8f89e2dbf06050bc8c77dbcdf71a7b5d28c87ec657d474e63d62d", "f75400a209a4"), // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link ROYALAUTH}. * Test for {@link RoyalAuth}.
*/ */
public class ROYALAUTHTest extends AbstractEncryptionMethodTest { public class RoyalAuthTest extends AbstractEncryptionMethodTest {
public ROYALAUTHTest() { public RoyalAuthTest() {
super(new ROYALAUTH(), super(new RoyalAuth(),
"5d21ef9236896bc4ac508e524e2da8a0def555dac1cdfc7259d62900d1d3f553826210c369870673ae2cf1c41abcf4f92670d76af1db044d33559324f5c2a339", // password "5d21ef9236896bc4ac508e524e2da8a0def555dac1cdfc7259d62900d1d3f553826210c369870673ae2cf1c41abcf4f92670d76af1db044d33559324f5c2a339", // password
"ecc685f4328bc54093c086ced66c5c11855e117ea22940632d5c0f55fff84d94bfdcc74e05f5d95bbdd052823a7057910748bc1c7a07af96b3e86731a4f11794", // PassWord1 "ecc685f4328bc54093c086ced66c5c11855e117ea22940632d5c0f55fff84d94bfdcc74e05f5d95bbdd052823a7057910748bc1c7a07af96b3e86731a4f11794", // PassWord1
"2c0b4674f7c2c266db13ae4382cbeee3083167a774f6e73793a6268a0b8b2c3c6b324a99596f4a7958e58c5311c77e25975a3b517ce17adfc4eaece821e3dd19", // &^%te$t?Pw@_ "2c0b4674f7c2c266db13ae4382cbeee3083167a774f6e73793a6268a0b8b2c3c6b324a99596f4a7958e58c5311c77e25975a3b517ce17adfc4eaece821e3dd19", // &^%te$t?Pw@_

View File

@ -7,12 +7,12 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
/** /**
* Test for {@link SALTED2MD5}. * Test for {@link Salted2Md5}.
*/ */
public class SALTED2MD5Test extends AbstractEncryptionMethodTest { public class Salted2Md5Test extends AbstractEncryptionMethodTest {
public SALTED2MD5Test() { public Salted2Md5Test() {
super(new SALTED2MD5(mockSettings()), super(new Salted2Md5(mockSettings()),
new HashedPassword("9f3d13dc01a6fe61fd669954174399f3", "9b5f5749"), // password new HashedPassword("9f3d13dc01a6fe61fd669954174399f3", "9b5f5749"), // password
new HashedPassword("b28c32f624a4eb161d6adc9acb5bfc5b", "f750ba32"), // PassWord1 new HashedPassword("b28c32f624a4eb161d6adc9acb5bfc5b", "f750ba32"), // PassWord1
new HashedPassword("38dcb83cc68424afe3cda012700c2bb1", "eb2c3394"), // &^%te$t?Pw@_ new HashedPassword("38dcb83cc68424afe3cda012700c2bb1", "eb2c3394"), // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link SALTEDSHA512}. * Test for {@link SaltedSha512}.
*/ */
public class SALTEDSHA512Test extends AbstractEncryptionMethodTest { public class SaltedSha512Test extends AbstractEncryptionMethodTest {
public SALTEDSHA512Test() { public SaltedSha512Test() {
super(new SALTEDSHA512(), super(new SaltedSha512(),
new HashedPassword("dea7a37cecf5384ae8e347fd1411efb51364b6ba1b328695de3b354612c1d7010807e8b7051c40f740e498490e1f133e2c2408327d13fbdd68e1b1f6d548e624", "29f8a3c52147f987fee7ba3e0fb311bd"), // password new HashedPassword("dea7a37cecf5384ae8e347fd1411efb51364b6ba1b328695de3b354612c1d7010807e8b7051c40f740e498490e1f133e2c2408327d13fbdd68e1b1f6d548e624", "29f8a3c52147f987fee7ba3e0fb311bd"), // password
new HashedPassword("7c06225aac574d2dc7c81a2ed306637adf025715f52083e05bdab014faaa234e24a97d0e69ea0108dfa77cc9228e58be319ee677e679b5d1ad168d40e50a42f6", "8ea37b85d020b98f60c0fe9b8ec9296c"), // PassWord1 new HashedPassword("7c06225aac574d2dc7c81a2ed306637adf025715f52083e05bdab014faaa234e24a97d0e69ea0108dfa77cc9228e58be319ee677e679b5d1ad168d40e50a42f6", "8ea37b85d020b98f60c0fe9b8ec9296c"), // PassWord1
new HashedPassword("55711adbe03c9616f3505f0d57077fdd528c32243eb6f9840c1a6ff9e553940d6b89790750ebd52ebda63ca793fbe9980d54057af40836820c648750fe22d49c", "9f58079631ef21d32b4710694f1f461b"), // &^%te$t?Pw@_ new HashedPassword("55711adbe03c9616f3505f0d57077fdd528c32243eb6f9840c1a6ff9e553940d6b89790750ebd52ebda63ca793fbe9980d54057af40836820c648750fe22d49c", "9f58079631ef21d32b4710694f1f461b"), // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link SMF}. * Test for {@link Smf}.
*/ */
public class SMFTest extends AbstractEncryptionMethodTest { public class SmfTest extends AbstractEncryptionMethodTest {
public SMFTest() { public SmfTest() {
super(new SMF(), super(new Smf(),
"9b361c66977bb059d460a20d3c21fb3394772df5", // password "9b361c66977bb059d460a20d3c21fb3394772df5", // password
"31a560bdd095a837945d46add1605108ba87b268", // PassWord1 "31a560bdd095a837945d46add1605108ba87b268", // PassWord1
"8d4b84544e0891be8c183fe9b1003cfac18c51a1", // &^%te$t?Pw@_ "8d4b84544e0891be8c183fe9b1003cfac18c51a1", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link SHA1}. * Test for {@link Sha1}.
*/ */
public class Sha1Test extends AbstractEncryptionMethodTest { public class Sha1Test extends AbstractEncryptionMethodTest {
public Sha1Test() { public Sha1Test() {
super(new SHA1(), super(new Sha1(),
"5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8", // password "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8", // password
"285d0c707f9644b75e1a87a62f25d0efb56800f0", // PassWord1 "285d0c707f9644b75e1a87a62f25d0efb56800f0", // PassWord1
"a42ef8e61e890af80461ca5dcded25cbfcf407a4", // &^%te$t?Pw@_ "a42ef8e61e890af80461ca5dcded25cbfcf407a4", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link SHA256}. * Test for {@link Sha256}.
*/ */
public class Sha256Test extends AbstractEncryptionMethodTest { public class Sha256Test extends AbstractEncryptionMethodTest {
public Sha256Test() { public Sha256Test() {
super(new SHA256(), super(new Sha256(),
"$SHA$11aa0706173d7272$dbba96681c2ae4e0bfdf226d70fbbc5e4ee3d8071faa613bc533fe8a64817d10", // password "$SHA$11aa0706173d7272$dbba96681c2ae4e0bfdf226d70fbbc5e4ee3d8071faa613bc533fe8a64817d10", // password
"$SHA$3c72a18a29b08d40$8e50a7a4f69a80f4893dc921eac84bd74b3f9ebfa22908302c9965eac3aa45e5", // PassWord1 "$SHA$3c72a18a29b08d40$8e50a7a4f69a80f4893dc921eac84bd74b3f9ebfa22908302c9965eac3aa45e5", // PassWord1
"$SHA$584cea1cfab90030$adc006330e73d81e463fe02a4fe9b17bdbbcc05955bff72fb27cf2089f0b3859", // &^%te$t?Pw@_ "$SHA$584cea1cfab90030$adc006330e73d81e463fe02a4fe9b17bdbbcc05955bff72fb27cf2089f0b3859", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link SHA512}. * Test for {@link Sha512}.
*/ */
public class Sha512Test extends AbstractEncryptionMethodTest { public class Sha512Test extends AbstractEncryptionMethodTest {
public Sha512Test() { public Sha512Test() {
super(new SHA512(), super(new Sha512(),
"b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86", // password "b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86", // password
"ae9942149995a8171391625b36da134d5e288c721650d7c8d2d464fb49a49f3f551e4916ab1e097d9dd1201b01d69b1dccdefa3d2524a66092fb61b3df6e7e71", // PassWord1 "ae9942149995a8171391625b36da134d5e288c721650d7c8d2d464fb49a49f3f551e4916ab1e097d9dd1201b01d69b1dccdefa3d2524a66092fb61b3df6e7e71", // PassWord1
"8c4f3df78db191142d819a72c16058b9e1ea41ae9b1649e1184eb89e30344c51c9c71039c483cf2f1b76b51480d8459d7eb3cfbaa24b07f2041d1551af4ead75", // &^%te$t?Pw@_ "8c4f3df78db191142d819a72c16058b9e1ea41ae9b1649e1184eb89e30344c51c9c71039c483cf2f1b76b51480d8459d7eb3cfbaa24b07f2041d1551af4ead75", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link WBB3}. * Test for {@link Wbb3}.
*/ */
public class WBB3Test extends AbstractEncryptionMethodTest { public class Wbb3Test extends AbstractEncryptionMethodTest {
public WBB3Test() { public Wbb3Test() {
super(new WBB3(), super(new Wbb3(),
new HashedPassword("8df818ef7d56075ab2744f74b98ad68a375ccac4", "b7415b355492ea60314f259a35733a3092c03e3f"), // password new HashedPassword("8df818ef7d56075ab2744f74b98ad68a375ccac4", "b7415b355492ea60314f259a35733a3092c03e3f"), // password
new HashedPassword("106da5cf5df92cb845e12cf62cbdb5235b6dc693", "6110f19b2b52910dccf592a19c59126873f42e69"), // PassWord1 new HashedPassword("106da5cf5df92cb845e12cf62cbdb5235b6dc693", "6110f19b2b52910dccf592a19c59126873f42e69"), // PassWord1
new HashedPassword("940a9fb7acec0178c6691e8b3c14bd7d789078b1", "f9dd501ff3d1bf74904f9e89649e378429af56e7"), // &^%te$t?Pw@_ new HashedPassword("940a9fb7acec0178c6691e8b3c14bd7d789078b1", "f9dd501ff3d1bf74904f9e89649e378429af56e7"), // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link WBB4}. * Test for {@link Wbb4}.
*/ */
public class WBB4Test extends AbstractEncryptionMethodTest { public class Wbb4Test extends AbstractEncryptionMethodTest {
public WBB4Test() { public Wbb4Test() {
super(new WBB4(), super(new Wbb4(),
"$2a$08$7DGr.wROqEPe0Z3XJS7n5.k.QWehovLHbpI.UkdfRb4ns268WsR6C", // password "$2a$08$7DGr.wROqEPe0Z3XJS7n5.k.QWehovLHbpI.UkdfRb4ns268WsR6C", // password
"$2a$08$yWWVUA4PB4mqW.0wyIvV3OdoH492HuLk5L3iaqUrpRK2.2zn08d/K", // PassWord1 "$2a$08$yWWVUA4PB4mqW.0wyIvV3OdoH492HuLk5L3iaqUrpRK2.2zn08d/K", // PassWord1
"$2a$08$EHXUFt7bTT9Fnsu22KWvF.QDssiosV8YzH8CyWqulB/ckOA7qioJG", // &^%te$t?Pw@_ "$2a$08$EHXUFt7bTT9Fnsu22KWvF.QDssiosV8YzH8CyWqulB/ckOA7qioJG", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link WHIRLPOOL}. * Test for {@link Whirlpool}.
*/ */
public class WHIRLPOOLTest extends AbstractEncryptionMethodTest { public class WhirlpoolTest extends AbstractEncryptionMethodTest {
public WHIRLPOOLTest() { public WhirlpoolTest() {
super(new WHIRLPOOL(), super(new Whirlpool(),
"74DFC2B27ACFA364DA55F93A5CAEE29CCAD3557247EDA238831B3E9BD931B01D77FE994E4F12B9D4CFA92A124461D2065197D8CF7F33FC88566DA2DB2A4D6EAE", // password "74DFC2B27ACFA364DA55F93A5CAEE29CCAD3557247EDA238831B3E9BD931B01D77FE994E4F12B9D4CFA92A124461D2065197D8CF7F33FC88566DA2DB2A4D6EAE", // password
"819B4CBD26508E39EA76BFE102DCF2ACC87A446747CAB0BD88522B0822A724583E81B6A4BD2CE255DB694E530B659F47D434EEB50344A02F50B64414C9671583", // PassWord1 "819B4CBD26508E39EA76BFE102DCF2ACC87A446747CAB0BD88522B0822A724583E81B6A4BD2CE255DB694E530B659F47D434EEB50344A02F50B64414C9671583", // PassWord1
"71ECB0E5AEAB006F5336348076AA6A8E46075AEC9E010C7055BA1334B57746F2A9D8A8799BDD9B7EB4AB7544A59D25F469C8BCA2067508ACBA62A929260A1E17", // &^%te$t?Pw@_ "71ECB0E5AEAB006F5336348076AA6A8E46075AEC9E010C7055BA1334B57746F2A9D8A8799BDD9B7EB4AB7544A59D25F469C8BCA2067508ACBA62A929260A1E17", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link WORDPRESS}. * Test for {@link Wordpress}.
*/ */
public class WORDPRESSTest extends AbstractEncryptionMethodTest { public class WordpressTest extends AbstractEncryptionMethodTest {
public WORDPRESSTest() { public WordpressTest() {
super(new WORDPRESS(), super(new Wordpress(),
"$P$B9wyjxuU4yrfjnnHNGSzH9ti9CC0Os1", // password "$P$B9wyjxuU4yrfjnnHNGSzH9ti9CC0Os1", // password
"$P$BjzPjjzPjjkRzvGGRTyYu0sNqcz6Ci0", // PassWord1 "$P$BjzPjjzPjjkRzvGGRTyYu0sNqcz6Ci0", // PassWord1
"$P$BjzPjjzPjrAOyB1V0WFdpisgCTFx.N/", // &^%te$t?Pw@_ "$P$BjzPjjzPjrAOyB1V0WFdpisgCTFx.N/", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link XAUTH}. * Test for {@link XAuth}.
*/ */
public class XAUTHTest extends AbstractEncryptionMethodTest { public class XAuthTest extends AbstractEncryptionMethodTest {
public XAUTHTest() { public XAuthTest() {
super(new XAUTH(), super(new XAuth(),
"e54d4916577410d26d2f6e9362445463dab9ffdff9a67ed3b74d3f2312bc8fab84f653fcb88ad8338793ef8a6d0a1162105e46ec24f0dcb52355c634e3e6439f45444b09c715", // password "e54d4916577410d26d2f6e9362445463dab9ffdff9a67ed3b74d3f2312bc8fab84f653fcb88ad8338793ef8a6d0a1162105e46ec24f0dcb52355c634e3e6439f45444b09c715", // password
"d54489a4fd4732ee03d56810ab92944096e3d49335266adeecfbc12567abb3ff744761b33a1fcc4d04739e377775c788e4baace3caf35c7b9176b82b1fe3472e4cbdc5a43214", // PassWord1 "d54489a4fd4732ee03d56810ab92944096e3d49335266adeecfbc12567abb3ff744761b33a1fcc4d04739e377775c788e4baace3caf35c7b9176b82b1fe3472e4cbdc5a43214", // PassWord1
"ce6404c1092fb5abf0a72f9c4327bfe8f4cdc4b8dc90ee6ca35c42b8ae9481b89c2559bb60b99ff2b57a102cfced40b8e2f5ef481400c9e6f79445017fc763b1cc27f4c2df36", // &^%te$t?Pw@_ "ce6404c1092fb5abf0a72f9c4327bfe8f4cdc4b8dc90ee6ca35c42b8ae9481b89c2559bb60b99ff2b57a102cfced40b8e2f5ef481400c9e6f79445017fc763b1cc27f4c2df36", // &^%te$t?Pw@_

View File

@ -1,12 +1,12 @@
package fr.xephi.authme.security.crypts; package fr.xephi.authme.security.crypts;
/** /**
* Test for {@link XFBCRYPT}. * Test for {@link XfBCrypt}.
*/ */
public class XFBCRYPTTest extends AbstractEncryptionMethodTest { public class XfBCryptTest extends AbstractEncryptionMethodTest {
public XFBCRYPTTest() { public XfBCryptTest() {
super(new XFBCRYPT(), super(new XfBCrypt(),
"$2a$10$UtuON/ZG.x8EWG/zQbryB.BHfQVrfxk3H7qykzP.UJQ8YiLjZyfqq", // password "$2a$10$UtuON/ZG.x8EWG/zQbryB.BHfQVrfxk3H7qykzP.UJQ8YiLjZyfqq", // password
"$2a$10$Q.ocUo.YtHTdI4nu3pcpKun6BILcmWHm541ANULucmuU/ps1QKY4K", // PassWord1 "$2a$10$Q.ocUo.YtHTdI4nu3pcpKun6BILcmWHm541ANULucmuU/ps1QKY4K", // PassWord1
"$2a$10$yHjm02.K4HP5iFU1F..yLeTeo7PWZVbKAr/QGex5jU4.J3mdq/uuO", // &^%te$t?Pw@_ "$2a$10$yHjm02.K4HP5iFU1F..yLeTeo7PWZVbKAr/QGex5jU4.J3mdq/uuO", // &^%te$t?Pw@_

View File

@ -5,7 +5,7 @@ import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.security.crypts.HashedPassword; import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.security.crypts.SHA256; import fr.xephi.authme.security.crypts.Sha256;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.settings.properties.SecuritySettings;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -28,6 +28,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat; import static org.mockito.hamcrest.MockitoHamcrest.argThat;
import static fr.xephi.authme.AuthMeMatchers.equalToHash;
/** /**
* Test for {@link MigrationService}. * Test for {@link MigrationService}.
@ -42,7 +43,7 @@ public class MigrationServiceTest {
private DataSource dataSource; private DataSource dataSource;
@Mock @Mock
private SHA256 sha256; private Sha256 sha256;
@BeforeClass @BeforeClass
public static void setUpLogger() { public static void setUpLogger() {
@ -122,7 +123,7 @@ public class MigrationServiceTest {
.build(); .build();
} }
private static void setSha256MockToUppercase(SHA256 sha256) { private static void setSha256MockToUppercase(Sha256 sha256) {
given(sha256.computeHash(anyString(), anyString())).willAnswer(new Answer<HashedPassword>() { given(sha256.computeHash(anyString(), anyString())).willAnswer(new Answer<HashedPassword>() {
@Override @Override
public HashedPassword answer(InvocationOnMock invocation) { public HashedPassword answer(InvocationOnMock invocation) {