Remove redundant JavaDoc in security package
- Remove all JavaDoc in security package that has no additional information than in the code - Reduce visibility of class members where appropriate
This commit is contained in:
@@ -359,14 +359,6 @@ public class BCRYPT implements EncryptionMethod {
|
||||
return matched;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getDoubleHash.
|
||||
*
|
||||
* @param text String
|
||||
* @param salt String
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public static String getDoubleHash(String text, String salt) {
|
||||
String hash = hashpw(text, salt);
|
||||
return hashpw(text, hash);
|
||||
@@ -514,30 +506,12 @@ public class BCRYPT implements EncryptionMethod {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return hashpw(password, salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -6,15 +6,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class BCRYPT2Y implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
@@ -23,15 +14,6 @@ public class BCRYPT2Y implements EncryptionMethod {
|
||||
return (BCRYPT.hashpw(password, salt));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -11,11 +11,6 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
|
||||
private static final char[] CRYPTCHARS = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
protected final Charset charset = Charset.forName("UTF-8");
|
||||
|
||||
/**
|
||||
* Method byteArrayToHexString.
|
||||
*
|
||||
* @param args byte[]String * @return String
|
||||
*/
|
||||
|
||||
public static String byteArrayToHexString(final byte... args) {
|
||||
final char[] chars = new char[args.length * 2];
|
||||
@@ -26,15 +21,6 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
|
||||
return new String(chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
@@ -48,14 +34,6 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName Stringooleaneptiontring) * @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -10,15 +10,6 @@ import java.util.Arrays;
|
||||
*/
|
||||
public class CryptPBKDF2 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
@@ -29,15 +20,6 @@ public class CryptPBKDF2 implements EncryptionMethod {
|
||||
return result + Arrays.toString(engine.deriveKey(password, 64));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -10,15 +10,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class CryptPBKDF2Django implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
@@ -29,15 +20,6 @@ public class CryptPBKDF2Django implements EncryptionMethod {
|
||||
return result + String.valueOf(DatatypeConverter.printBase64Binary(engine.deriveKey(password, 32)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -8,13 +8,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class DOUBLEMD5 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getMD5.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
@@ -24,30 +17,12 @@ public class DOUBLEMD5 implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getMD5(getMD5(password));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -13,9 +13,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
* <p>
|
||||
* The comparePassword is called when we need to match password (/login usually)
|
||||
* </p>
|
||||
*
|
||||
* @author Gabriele
|
||||
* @version $Revision: 1.0 $
|
||||
*/
|
||||
public interface EncryptionMethod {
|
||||
|
||||
@@ -25,7 +22,7 @@ public interface EncryptionMethod {
|
||||
* etc... for customs methods)
|
||||
* @param name String
|
||||
*
|
||||
* @return Hashing password * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
|
||||
* @return Hashing password
|
||||
*/
|
||||
String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException;
|
||||
@@ -35,7 +32,7 @@ public interface EncryptionMethod {
|
||||
* @param password
|
||||
* @param playerName
|
||||
*
|
||||
* @return true if password match, false else * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
|
||||
* @return true if password match, false else
|
||||
*/
|
||||
boolean comparePassword(String hash, String password, String playerName)
|
||||
throws NoSuchAlgorithmException;
|
||||
|
||||
@@ -10,13 +10,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class IPB3 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getMD5.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
@@ -26,30 +19,12 @@ public class IPB3 implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getMD5(getMD5(salt) + getMD5(password));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -8,13 +8,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class JOOMLA implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getMD5.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
@@ -24,30 +17,12 @@ public class JOOMLA implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getMD5(password + salt) + ":" + salt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -8,13 +8,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class MD5 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getMD5.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
@@ -24,30 +17,12 @@ public class MD5 implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getMD5(password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -8,13 +8,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class MD5VB implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getMD5.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
@@ -24,30 +17,12 @@ public class MD5VB implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return "$MD5vb$" + salt + "$" + getMD5(getMD5(password) + salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -10,13 +10,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class MYBB implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getMD5.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
@@ -26,30 +19,12 @@ public class MYBB implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getMD5(getMD5(salt) + getMD5(password));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -11,19 +11,11 @@ import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/**
|
||||
* @author stefano
|
||||
* @version $Revision: 1.0 $
|
||||
*/
|
||||
public class PHPBB implements EncryptionMethod {
|
||||
|
||||
private final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
/**
|
||||
* Method md5.
|
||||
*
|
||||
* @param data String
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public static String md5(String data) {
|
||||
try {
|
||||
byte[] bytes = data.getBytes("ISO-8859-1");
|
||||
@@ -35,14 +27,7 @@ public class PHPBB implements EncryptionMethod {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method hexToInt.
|
||||
*
|
||||
* @param ch char
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
static int hexToInt(char ch) {
|
||||
private static int hexToInt(char ch) {
|
||||
if (ch >= '0' && ch <= '9')
|
||||
return ch - '0';
|
||||
ch = Character.toUpperCase(ch);
|
||||
@@ -51,13 +36,6 @@ public class PHPBB implements EncryptionMethod {
|
||||
throw new IllegalArgumentException("Not a hex character: " + ch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method bytes2hex.
|
||||
*
|
||||
* @param bytes byte[]
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
private static String bytes2hex(byte[] bytes) {
|
||||
StringBuilder r = new StringBuilder(32);
|
||||
for (byte b : bytes) {
|
||||
@@ -69,14 +47,7 @@ public class PHPBB implements EncryptionMethod {
|
||||
return r.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method pack.
|
||||
*
|
||||
* @param hex String
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
static String pack(String hex) {
|
||||
private static String pack(String hex) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i = 0; i < hex.length(); i += 2) {
|
||||
char c1 = hex.charAt(i);
|
||||
@@ -87,14 +58,6 @@ public class PHPBB implements EncryptionMethod {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method phpbb_hash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String phpbb_hash(String password, String salt) {
|
||||
String random_state = salt;
|
||||
StringBuilder random = new StringBuilder();
|
||||
@@ -110,27 +73,10 @@ public class PHPBB implements EncryptionMethod {
|
||||
return md5(password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method _hash_gensalt_private.
|
||||
*
|
||||
* @param input String
|
||||
* @param itoa64 String
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
private String _hash_gensalt_private(String input, String itoa64) {
|
||||
return _hash_gensalt_private(input, itoa64, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method _hash_gensalt_private.
|
||||
*
|
||||
* @param input String
|
||||
* @param itoa64 String
|
||||
* @param iteration_count_log2 int
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
private String _hash_gensalt_private(String input, String itoa64,
|
||||
int iteration_count_log2) {
|
||||
if (iteration_count_log2 < 4 || iteration_count_log2 > 31) {
|
||||
@@ -142,14 +88,6 @@ public class PHPBB implements EncryptionMethod {
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode hash
|
||||
*
|
||||
* @param input String
|
||||
* @param count int
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
private String _hash_encode64(String input, int count) {
|
||||
StringBuilder output = new StringBuilder();
|
||||
int i = 0;
|
||||
@@ -171,14 +109,6 @@ public class PHPBB implements EncryptionMethod {
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method _hash_crypt_private.
|
||||
*
|
||||
* @param password String
|
||||
* @param setting String
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String _hash_crypt_private(String password, String setting) {
|
||||
String output = "*";
|
||||
if (!setting.substring(0, 3).equals("$H$"))
|
||||
@@ -200,44 +130,18 @@ public class PHPBB implements EncryptionMethod {
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method phpbb_check_hash.
|
||||
*
|
||||
* @param password String
|
||||
* @param hash String
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean phpbb_check_hash(String password, String hash) {
|
||||
if (hash.length() == 34)
|
||||
return _hash_crypt_private(password, hash).equals(hash);
|
||||
else return md5(password).equals(hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return phpbb_hash(password, salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -14,13 +14,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class PHPFUSION implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getSHA1.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getSHA1(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||
@@ -30,15 +23,6 @@ public class PHPFUSION implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
@@ -66,15 +50,6 @@ public class PHPFUSION implements EncryptionMethod {
|
||||
return digest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -6,30 +6,12 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class PLAINTEXT implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -7,15 +7,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class ROYALAUTH implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
@@ -24,14 +15,6 @@ public class ROYALAUTH implements EncryptionMethod {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method hash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public String hash(String password, String salt)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-512");
|
||||
@@ -43,15 +26,6 @@ public class ROYALAUTH implements EncryptionMethod {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -10,13 +10,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class SALTED2MD5 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getMD5.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
@@ -26,30 +19,12 @@ public class SALTED2MD5 implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getMD5(getMD5(password) + salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -10,13 +10,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class SALTEDSHA512 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getSHA512.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getSHA512(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha512 = MessageDigest.getInstance("SHA-512");
|
||||
@@ -26,30 +19,12 @@ public class SALTEDSHA512 implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getSHA512(password + salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -8,13 +8,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class SHA1 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getSHA1.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getSHA1(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||
@@ -24,30 +17,12 @@ public class SHA1 implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getSHA1(password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -8,13 +8,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class SHA256 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getSHA256.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getSHA256(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
|
||||
@@ -24,30 +17,12 @@ public class SHA256 implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return "$SHA$" + salt + "$" + getSHA256(getSHA256(password) + salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -8,13 +8,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class SHA512 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getSHA512.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getSHA512(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha512 = MessageDigest.getInstance("SHA-512");
|
||||
@@ -24,30 +17,12 @@ public class SHA512 implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getSHA512(password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -8,13 +8,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class SMF implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getSHA1.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getSHA1(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||
@@ -24,30 +17,12 @@ public class SMF implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getSHA1(name.toLowerCase() + password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -10,13 +10,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class WBB3 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getSHA1.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static String getSHA1(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||
@@ -26,30 +19,12 @@ public class WBB3 implements EncryptionMethod {
|
||||
return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getSHA1(salt.concat(getSHA1(salt.concat(getSHA1(password)))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -6,30 +6,12 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class WBB4 implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return BCRYPT.getDoubleHash(password, salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -164,13 +164,6 @@ public class WHIRLPOOL implements EncryptionMethod {
|
||||
public WHIRLPOOL() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Method display.
|
||||
*
|
||||
* @param array byte[]
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
protected static String display(byte[] array) {
|
||||
char[] val = new char[2 * array.length];
|
||||
String hex = "0123456789ABCDEF";
|
||||
@@ -377,7 +370,6 @@ public class WHIRLPOOL implements EncryptionMethod {
|
||||
* Delivers string input data to the hashing algorithm.
|
||||
*
|
||||
* @param source plaintext data to hash (ASCII text string).
|
||||
* <p/>
|
||||
* This method maintains the invariant: bufferBits < 512
|
||||
*/
|
||||
public void NESSIEadd(String source) {
|
||||
@@ -409,15 +401,6 @@ public class WHIRLPOOL implements EncryptionMethod {
|
||||
return display(digest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -13,14 +13,6 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
private final SecureRandom randomGen = new SecureRandom();
|
||||
|
||||
/**
|
||||
* Method encode64.
|
||||
*
|
||||
* @param src byte[]
|
||||
* @param count int
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
private String encode64(byte[] src, int count) {
|
||||
int i, value;
|
||||
StringBuilder output = new StringBuilder();
|
||||
@@ -55,14 +47,6 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method crypt.
|
||||
*
|
||||
* @param password String
|
||||
* @param setting String
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
private String crypt(String password, String setting) {
|
||||
String output = "*0";
|
||||
if (((setting.length() < 2) ? setting : setting.substring(0, 2)).equalsIgnoreCase(output)) {
|
||||
@@ -101,13 +85,6 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method gensaltPrivate.
|
||||
*
|
||||
* @param input byte[]
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
private String gensaltPrivate(byte[] input) {
|
||||
String output = "$P$";
|
||||
int iterationCountLog2 = 8;
|
||||
@@ -116,13 +93,6 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method stringToUtf8.
|
||||
*
|
||||
* @param string String
|
||||
*
|
||||
* @return byte[]
|
||||
*/
|
||||
private byte[] stringToUtf8(String string) {
|
||||
try {
|
||||
return string.getBytes("UTF-8");
|
||||
@@ -131,15 +101,6 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
@@ -148,15 +109,6 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
return crypt(password, gensaltPrivate(stringToUtf8(new String(random))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -6,13 +6,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class XAUTH implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getWhirlpool.
|
||||
*
|
||||
* @param message String
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public static String getWhirlpool(String message) {
|
||||
WHIRLPOOL w = new WHIRLPOOL();
|
||||
byte[] digest = new byte[WHIRLPOOL.DIGESTBYTES];
|
||||
@@ -22,15 +15,6 @@ public class XAUTH implements EncryptionMethod {
|
||||
return WHIRLPOOL.display(digest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
@@ -39,15 +23,6 @@ public class XAUTH implements EncryptionMethod {
|
||||
return hash.substring(0, saltPos) + salt + hash.substring(saltPos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
|
||||
@@ -13,30 +13,12 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public class XF implements EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Method getHash.
|
||||
*
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException {
|
||||
return getSHA256(getSHA256(password) + regmatch("\"salt\";.:..:\"(.*)\";.:.:\"hashFunc\"", salt));
|
||||
return getSha256(getSha256(password) + regmatch("\"salt\";.:..:\"(.*)\";.:.:\"hashFunc\"", salt));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method comparePassword.
|
||||
*
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
*
|
||||
* @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public boolean comparePassword(String hash, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
@@ -44,14 +26,7 @@ public class XF implements EncryptionMethod {
|
||||
return hash.equals(regmatch("\"hash\";.:..:\"(.*)\";.:.:\"salt\"", salt));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getSHA256.
|
||||
*
|
||||
* @param password String
|
||||
*
|
||||
* @return String * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public String getSHA256(String password) throws NoSuchAlgorithmException {
|
||||
private String getSha256(String password) throws NoSuchAlgorithmException {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
md.update(password.getBytes());
|
||||
byte byteData[] = md.digest();
|
||||
@@ -70,15 +45,7 @@ public class XF implements EncryptionMethod {
|
||||
return hexString.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method regmatch.
|
||||
*
|
||||
* @param pattern String
|
||||
* @param line String
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public String regmatch(String pattern, String line) {
|
||||
private String regmatch(String pattern, String line) {
|
||||
List<String> allMatches = new ArrayList<>();
|
||||
Matcher m = Pattern.compile(pattern).matcher(line);
|
||||
while (m.find()) {
|
||||
|
||||
Reference in New Issue
Block a user