* 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:
@@ -7,36 +7,36 @@ import fr.xephi.authme.security.crypts.EncryptionMethod;
|
||||
*/
|
||||
public enum HashAlgorithm {
|
||||
|
||||
BCRYPT(fr.xephi.authme.security.crypts.BCRYPT.class),
|
||||
BCRYPT2Y(fr.xephi.authme.security.crypts.BCRYPT2Y.class),
|
||||
CRAZYCRYPT1(fr.xephi.authme.security.crypts.CRAZYCRYPT1.class),
|
||||
DOUBLEMD5(fr.xephi.authme.security.crypts.DOUBLEMD5.class),
|
||||
IPB3(fr.xephi.authme.security.crypts.IPB3.class),
|
||||
IPB4(fr.xephi.authme.security.crypts.IPB4.class),
|
||||
JOOMLA(fr.xephi.authme.security.crypts.JOOMLA.class),
|
||||
MD5(fr.xephi.authme.security.crypts.MD5.class),
|
||||
MD5VB(fr.xephi.authme.security.crypts.MD5VB.class),
|
||||
MYBB(fr.xephi.authme.security.crypts.MYBB.class),
|
||||
BCRYPT(fr.xephi.authme.security.crypts.BCrypt.class),
|
||||
BCRYPT2Y(fr.xephi.authme.security.crypts.BCrypt2y.class),
|
||||
CRAZYCRYPT1(fr.xephi.authme.security.crypts.CrazyCrypt1.class),
|
||||
DOUBLEMD5(fr.xephi.authme.security.crypts.DoubleMd5.class),
|
||||
IPB3(fr.xephi.authme.security.crypts.Ipb3.class),
|
||||
IPB4(fr.xephi.authme.security.crypts.Ipb4.class),
|
||||
JOOMLA(fr.xephi.authme.security.crypts.Joomla.class),
|
||||
MD5(fr.xephi.authme.security.crypts.Md5.class),
|
||||
MD5VB(fr.xephi.authme.security.crypts.Md5vB.class),
|
||||
MYBB(fr.xephi.authme.security.crypts.MyBB.class),
|
||||
PBKDF2(fr.xephi.authme.security.crypts.Pbkdf2.class),
|
||||
PBKDF2DJANGO(fr.xephi.authme.security.crypts.Pbkdf2Django.class),
|
||||
PHPBB(fr.xephi.authme.security.crypts.PHPBB.class),
|
||||
PHPFUSION(fr.xephi.authme.security.crypts.PHPFUSION.class),
|
||||
PHPBB(fr.xephi.authme.security.crypts.PhpBB.class),
|
||||
PHPFUSION(fr.xephi.authme.security.crypts.PhpFusion.class),
|
||||
@Deprecated
|
||||
PLAINTEXT(fr.xephi.authme.security.crypts.PLAINTEXT.class),
|
||||
ROYALAUTH(fr.xephi.authme.security.crypts.ROYALAUTH.class),
|
||||
SALTED2MD5(fr.xephi.authme.security.crypts.SALTED2MD5.class),
|
||||
SALTEDSHA512(fr.xephi.authme.security.crypts.SALTEDSHA512.class),
|
||||
SHA1(fr.xephi.authme.security.crypts.SHA1.class),
|
||||
SHA256(fr.xephi.authme.security.crypts.SHA256.class),
|
||||
SHA512(fr.xephi.authme.security.crypts.SHA512.class),
|
||||
SMF(fr.xephi.authme.security.crypts.SMF.class),
|
||||
PLAINTEXT(fr.xephi.authme.security.crypts.PlainText.class),
|
||||
ROYALAUTH(fr.xephi.authme.security.crypts.RoyalAuth.class),
|
||||
SALTED2MD5(fr.xephi.authme.security.crypts.Salted2Md5.class),
|
||||
SALTEDSHA512(fr.xephi.authme.security.crypts.SaltedSha512.class),
|
||||
SHA1(fr.xephi.authme.security.crypts.Sha1.class),
|
||||
SHA256(fr.xephi.authme.security.crypts.Sha256.class),
|
||||
SHA512(fr.xephi.authme.security.crypts.Sha512.class),
|
||||
SMF(fr.xephi.authme.security.crypts.Smf.class),
|
||||
TWO_FACTOR(fr.xephi.authme.security.crypts.TwoFactor.class),
|
||||
WBB3(fr.xephi.authme.security.crypts.WBB3.class),
|
||||
WBB4(fr.xephi.authme.security.crypts.WBB4.class),
|
||||
WHIRLPOOL(fr.xephi.authme.security.crypts.WHIRLPOOL.class),
|
||||
WORDPRESS(fr.xephi.authme.security.crypts.WORDPRESS.class),
|
||||
XAUTH(fr.xephi.authme.security.crypts.XAUTH.class),
|
||||
XFBCRYPT(fr.xephi.authme.security.crypts.XFBCRYPT.class),
|
||||
WBB3(fr.xephi.authme.security.crypts.Wbb3.class),
|
||||
WBB4(fr.xephi.authme.security.crypts.Wbb4.class),
|
||||
WHIRLPOOL(fr.xephi.authme.security.crypts.Whirlpool.class),
|
||||
WORDPRESS(fr.xephi.authme.security.crypts.Wordpress.class),
|
||||
XAUTH(fr.xephi.authme.security.crypts.XAuth.class),
|
||||
XFBCRYPT(fr.xephi.authme.security.crypts.XfBCrypt.class),
|
||||
CUSTOM(null);
|
||||
|
||||
private final Class<? extends EncryptionMethod> clazz;
|
||||
|
||||
@@ -14,12 +14,12 @@ 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 {
|
||||
public class BCrypt implements EncryptionMethod {
|
||||
|
||||
private final int bCryptLog2Rounds;
|
||||
|
||||
@Inject
|
||||
public BCRYPT(Settings settings) {
|
||||
public BCrypt(Settings settings) {
|
||||
bCryptLog2Rounds = settings.getProperty(HooksSettings.BCRYPT_LOG2_ROUND);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import fr.xephi.authme.security.crypts.description.Recommendation;
|
||||
import fr.xephi.authme.security.crypts.description.Usage;
|
||||
|
||||
@Recommendation(Usage.RECOMMENDED)
|
||||
public class BCRYPT2Y extends HexSaltedMethod {
|
||||
public class BCrypt2y extends HexSaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import fr.xephi.authme.security.MessageDigestAlgorithm;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
public class CRAZYCRYPT1 extends UsernameSaltMethod {
|
||||
public class CrazyCrypt1 extends UsernameSaltMethod {
|
||||
|
||||
private static final char[] CRYPTCHARS =
|
||||
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
|
||||
@@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
|
||||
|
||||
import static fr.xephi.authme.security.HashUtils.md5;
|
||||
|
||||
public class DOUBLEMD5 extends UnsaltedMethod {
|
||||
public class DoubleMd5 extends UnsaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import static fr.xephi.authme.security.HashUtils.md5;
|
||||
|
||||
@Recommendation(Usage.ACCEPTABLE)
|
||||
@HasSalt(value = SaltType.TEXT, length = 5)
|
||||
public class IPB3 extends SeparateSaltMethod {
|
||||
public class Ipb3 extends SeparateSaltMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -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>
|
||||
* 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).
|
||||
*/
|
||||
@Recommendation(Usage.DOES_NOT_WORK)
|
||||
@HasSalt(value = SaltType.TEXT, length = 22)
|
||||
public class IPB4 implements EncryptionMethod {
|
||||
public class Ipb4 implements EncryptionMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import fr.xephi.authme.security.crypts.description.Recommendation;
|
||||
import fr.xephi.authme.security.crypts.description.Usage;
|
||||
|
||||
@Recommendation(Usage.ACCEPTABLE)
|
||||
public class JOOMLA extends HexSaltedMethod {
|
||||
public class Joomla extends HexSaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
|
||||
|
||||
import fr.xephi.authme.security.HashUtils;
|
||||
|
||||
public class MD5 extends UnsaltedMethod {
|
||||
public class Md5 extends UnsaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
|
||||
|
||||
import static fr.xephi.authme.security.HashUtils.md5;
|
||||
|
||||
public class MD5VB extends HexSaltedMethod {
|
||||
public class Md5vB extends HexSaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import static fr.xephi.authme.security.HashUtils.md5;
|
||||
|
||||
@Recommendation(Usage.ACCEPTABLE)
|
||||
@HasSalt(value = SaltType.TEXT, length = 8)
|
||||
public class MYBB extends SeparateSaltMethod {
|
||||
public class MyBB extends SeparateSaltMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.security.MessageDigest;
|
||||
/**
|
||||
* @author stefano
|
||||
*/
|
||||
public class PHPBB extends HexSaltedMethod {
|
||||
public class PhpBB extends HexSaltedMethod {
|
||||
|
||||
private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
|
||||
@Recommendation(Usage.DO_NOT_USE)
|
||||
@AsciiRestricted
|
||||
public class PHPFUSION extends SeparateSaltMethod {
|
||||
public class PhpFusion extends SeparateSaltMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -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
|
||||
public class PLAINTEXT extends UnsaltedMethod {
|
||||
public class PlainText extends UnsaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
|
||||
|
||||
import fr.xephi.authme.security.HashUtils;
|
||||
|
||||
public class ROYALAUTH extends UnsaltedMethod {
|
||||
public class RoyalAuth extends UnsaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password) {
|
||||
|
||||
@@ -14,12 +14,12 @@ 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 {
|
||||
public class Salted2Md5 extends SeparateSaltMethod {
|
||||
|
||||
private final int saltLength;
|
||||
|
||||
@Inject
|
||||
public SALTED2MD5(Settings settings) {
|
||||
public Salted2Md5(Settings settings) {
|
||||
saltLength = settings.getProperty(SecuritySettings.DOUBLE_MD5_SALT_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import fr.xephi.authme.security.crypts.description.Recommendation;
|
||||
import fr.xephi.authme.security.crypts.description.Usage;
|
||||
|
||||
@Recommendation(Usage.RECOMMENDED)
|
||||
public class SALTEDSHA512 extends SeparateSaltMethod {
|
||||
public class SaltedSha512 extends SeparateSaltMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
|
||||
|
||||
import fr.xephi.authme.security.HashUtils;
|
||||
|
||||
public class SHA1 extends UnsaltedMethod {
|
||||
public class Sha1 extends UnsaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import fr.xephi.authme.security.crypts.description.Usage;
|
||||
import static fr.xephi.authme.security.HashUtils.sha256;
|
||||
|
||||
@Recommendation(Usage.RECOMMENDED)
|
||||
public class SHA256 extends HexSaltedMethod {
|
||||
public class Sha256 extends HexSaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
|
||||
|
||||
import fr.xephi.authme.security.HashUtils;
|
||||
|
||||
public class SHA512 extends UnsaltedMethod {
|
||||
public class Sha512 extends UnsaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
|
||||
|
||||
import fr.xephi.authme.security.HashUtils;
|
||||
|
||||
public class SMF extends UsernameSaltMethod {
|
||||
public class Smf extends UsernameSaltMethod {
|
||||
|
||||
@Override
|
||||
public HashedPassword computeHash(String password, String name) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import static fr.xephi.authme.security.HashUtils.sha1;
|
||||
|
||||
@Recommendation(Usage.ACCEPTABLE)
|
||||
@HasSalt(value = SaltType.TEXT, length = 40)
|
||||
public class WBB3 extends SeparateSaltMethod {
|
||||
public class Wbb3 extends SeparateSaltMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import fr.xephi.authme.security.crypts.description.Usage;
|
||||
import static fr.xephi.authme.security.crypts.BCryptService.hashpw;
|
||||
|
||||
@Recommendation(Usage.RECOMMENDED)
|
||||
public class WBB4 extends HexSaltedMethod {
|
||||
public class Wbb4 extends HexSaltedMethod {
|
||||
|
||||
@Override
|
||||
public String computeHash(String password, String salt, String name) {
|
||||
|
||||
@@ -61,7 +61,7 @@ package fr.xephi.authme.security.crypts;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class WHIRLPOOL extends UnsaltedMethod {
|
||||
public class Whirlpool extends UnsaltedMethod {
|
||||
|
||||
/**
|
||||
* 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[] state = new long[8];
|
||||
|
||||
public WHIRLPOOL() {
|
||||
public Whirlpool() {
|
||||
}
|
||||
|
||||
protected static String display(byte[] array) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Arrays;
|
||||
@HasSalt(value = SaltType.TEXT, length = 9)
|
||||
// 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
|
||||
public class WORDPRESS extends UnsaltedMethod {
|
||||
public class Wordpress extends UnsaltedMethod {
|
||||
|
||||
private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
private final SecureRandom randomGen = new SecureRandom();
|
||||
|
||||
@@ -4,15 +4,15 @@ import fr.xephi.authme.security.crypts.description.Recommendation;
|
||||
import fr.xephi.authme.security.crypts.description.Usage;
|
||||
|
||||
@Recommendation(Usage.RECOMMENDED)
|
||||
public class XAUTH extends HexSaltedMethod {
|
||||
public class XAuth extends HexSaltedMethod {
|
||||
|
||||
private static String getWhirlpool(String message) {
|
||||
WHIRLPOOL w = new WHIRLPOOL();
|
||||
byte[] digest = new byte[WHIRLPOOL.DIGESTBYTES];
|
||||
Whirlpool w = new Whirlpool();
|
||||
byte[] digest = new byte[Whirlpool.DIGESTBYTES];
|
||||
w.NESSIEinit();
|
||||
w.NESSIEadd(message);
|
||||
w.NESSIEfinalize(digest);
|
||||
return WHIRLPOOL.display(digest);
|
||||
return Whirlpool.display(digest);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import fr.xephi.authme.util.StringUtils;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class XFBCRYPT implements EncryptionMethod {
|
||||
public class XfBCrypt implements EncryptionMethod {
|
||||
public static final String SCHEME_CLASS = "XenForo_Authentication_Core12";
|
||||
private static final Pattern HASH_PATTERN = Pattern.compile("\"hash\";s.*\"(.*)?\"");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user