standard javadoc
This commit is contained in:
@@ -47,8 +47,8 @@ public enum HashAlgorithm {
|
||||
|
||||
/**
|
||||
* Method getclasse.
|
||||
* @return Class<?>
|
||||
*/
|
||||
|
||||
* @return Class<?> */
|
||||
public Class<?> getclasse() {
|
||||
return classe;
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ public class PasswordSecurity {
|
||||
/**
|
||||
* Method createSalt.
|
||||
* @param length int
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
public static String createSalt(int length)
|
||||
throws NoSuchAlgorithmException {
|
||||
byte[] msg = new byte[40];
|
||||
@@ -43,9 +43,9 @@ public class PasswordSecurity {
|
||||
* @param alg HashAlgorithm
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
public static String getHash(HashAlgorithm alg, String password,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
EncryptionMethod method;
|
||||
@@ -146,9 +146,9 @@ public class PasswordSecurity {
|
||||
* @param password String
|
||||
* @param hash String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return boolean * @throws NoSuchAlgorithmException */
|
||||
public static boolean comparePasswordWithHash(String password, String hash,
|
||||
String playerName) throws NoSuchAlgorithmException {
|
||||
HashAlgorithm algo = Settings.getPasswordHash;
|
||||
@@ -184,9 +184,9 @@ public class PasswordSecurity {
|
||||
* @param password String
|
||||
* @param hash String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return boolean * @throws NoSuchAlgorithmException */
|
||||
private static boolean compareWithAllEncryptionMethod(String password,
|
||||
String hash, String playerName) throws NoSuchAlgorithmException {
|
||||
for (HashAlgorithm algo : HashAlgorithm.values()) {
|
||||
|
||||
@@ -36,8 +36,8 @@ public class RandomString {
|
||||
|
||||
/**
|
||||
* Method nextString.
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
public String nextString() {
|
||||
for (int idx = 0; idx < buf.length; ++idx)
|
||||
buf[idx] = chars[random.nextInt(chars.length)];
|
||||
|
||||
@@ -94,7 +94,8 @@ public class BCRYPT implements EncryptionMethod {
|
||||
* @param len the number of bytes to encode
|
||||
|
||||
|
||||
* @return base64-encoded string * @throws IllegalArgumentException if the length is invalid */
|
||||
* @return base64-encoded string * @throws IllegalArgumentException if the length is invalid * @throws IllegalArgumentException
|
||||
*/
|
||||
private static String encode_base64(byte d[], int len)
|
||||
throws IllegalArgumentException {
|
||||
int off = 0;
|
||||
@@ -150,7 +151,8 @@ public class BCRYPT implements EncryptionMethod {
|
||||
* @param maxolen the maximum number of bytes to decode
|
||||
|
||||
|
||||
* @return an array containing the decoded bytes * @throws IllegalArgumentException if maxolen is invalid */
|
||||
* @return an array containing the decoded bytes * @throws IllegalArgumentException if maxolen is invalid * @throws IllegalArgumentException
|
||||
*/
|
||||
private static byte[] decode_base64(String s, int maxolen)
|
||||
throws IllegalArgumentException {
|
||||
StringBuffer rs = new StringBuffer();
|
||||
@@ -474,8 +476,8 @@ public class BCRYPT implements EncryptionMethod {
|
||||
* @param hashed the previously-hashed password
|
||||
* @param rounds number of rounds to hash the password
|
||||
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
* @return boolean */
|
||||
public static boolean checkpw(String text, String hashed, int rounds) {
|
||||
boolean matched = false;
|
||||
|
||||
@@ -499,10 +501,10 @@ public class BCRYPT implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -514,10 +516,10 @@ public class BCRYPT implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -528,8 +530,8 @@ public class BCRYPT implements EncryptionMethod {
|
||||
* Method getDoubleHash.
|
||||
* @param text String
|
||||
* @param salt String
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
public static String getDoubleHash(String text, String salt) {
|
||||
String hash = hashpw(text, salt);
|
||||
return hashpw(text, hash);
|
||||
|
||||
@@ -11,10 +11,10 @@ public class BCRYPT2Y implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,10 +28,10 @@ public class BCRYPT2Y implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
|
||||
@@ -16,10 +16,10 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -36,10 +36,7 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
|
||||
* 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)
|
||||
* @param playerName Stringooleaneptiontring) * @return boolean * @throws NoSuchAlgorithmException * @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, String)
|
||||
*/
|
||||
|
||||
@Override
|
||||
@@ -49,8 +46,7 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
|
||||
}
|
||||
/**
|
||||
* Method byteArrayToHexString.
|
||||
* @param args byte[]
|
||||
* @return String
|
||||
* @param args byte[]String * @return String
|
||||
*/
|
||||
|
||||
public static String byteArrayToHexString(final byte... args) {
|
||||
|
||||
@@ -14,10 +14,10 @@ public class CryptPBKDF2 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -33,10 +33,10 @@ public class CryptPBKDF2 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
|
||||
@@ -16,10 +16,10 @@ public class CryptPBKDF2Django implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -35,10 +35,10 @@ public class CryptPBKDF2Django implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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,10 +13,10 @@ public class DOUBLEMD5 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,10 +28,10 @@ public class DOUBLEMD5 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -41,9 +41,9 @@ public class DOUBLEMD5 implements EncryptionMethod {
|
||||
/**
|
||||
* Method getMD5.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
|
||||
@@ -26,7 +26,8 @@ public interface EncryptionMethod {
|
||||
|
||||
|
||||
* @param name String
|
||||
* @return Hashing password * @throws NoSuchAlgorithmException */
|
||||
* @return Hashing password * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
String getHash(String password, String salt, String name)
|
||||
throws NoSuchAlgorithmException;
|
||||
|
||||
@@ -36,7 +37,8 @@ public interface EncryptionMethod {
|
||||
* @param playerName
|
||||
|
||||
|
||||
* @return true if password match, false else * @throws NoSuchAlgorithmException */
|
||||
* @return true if password match, false else * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
boolean comparePassword(String hash, String password, String playerName)
|
||||
throws NoSuchAlgorithmException;
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ public class IPB3 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -30,10 +30,10 @@ public class IPB3 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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,9 +44,9 @@ public class IPB3 implements EncryptionMethod {
|
||||
/**
|
||||
* Method getMD5.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
|
||||
@@ -13,10 +13,10 @@ public class JOOMLA implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,10 +28,10 @@ public class JOOMLA implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -42,9 +42,9 @@ public class JOOMLA implements EncryptionMethod {
|
||||
/**
|
||||
* Method getMD5.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
|
||||
@@ -13,10 +13,10 @@ public class MD5 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,10 +28,10 @@ public class MD5 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -41,9 +41,9 @@ public class MD5 implements EncryptionMethod {
|
||||
/**
|
||||
* Method getMD5.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
|
||||
@@ -13,10 +13,10 @@ public class MD5VB implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,10 +28,10 @@ public class MD5VB implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -42,9 +42,9 @@ public class MD5VB implements EncryptionMethod {
|
||||
/**
|
||||
* Method getMD5.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
|
||||
@@ -15,10 +15,10 @@ public class MYBB implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -30,10 +30,10 @@ public class MYBB implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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,9 +44,9 @@ public class MYBB implements EncryptionMethod {
|
||||
/**
|
||||
* Method getMD5.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
|
||||
@@ -21,8 +21,8 @@ public class PHPBB implements EncryptionMethod {
|
||||
* Method phpbb_hash.
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
public String phpbb_hash(String password, String salt) {
|
||||
String random_state = salt;
|
||||
StringBuilder random = new StringBuilder();
|
||||
@@ -42,8 +42,8 @@ public class PHPBB implements EncryptionMethod {
|
||||
* Method _hash_gensalt_private.
|
||||
* @param input String
|
||||
* @param itoa64 String
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
private String _hash_gensalt_private(String input, String itoa64) {
|
||||
return _hash_gensalt_private(input, itoa64, 6);
|
||||
}
|
||||
@@ -53,8 +53,8 @@ public class PHPBB implements EncryptionMethod {
|
||||
* @param input String
|
||||
* @param itoa64 String
|
||||
* @param iteration_count_log2 int
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
private String _hash_gensalt_private(String input, String itoa64,
|
||||
int iteration_count_log2) {
|
||||
if (iteration_count_log2 < 4 || iteration_count_log2 > 31) {
|
||||
@@ -70,8 +70,8 @@ public class PHPBB implements EncryptionMethod {
|
||||
* Encode hash
|
||||
* @param input String
|
||||
* @param count int
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
private String _hash_encode64(String input, int count) {
|
||||
StringBuilder output = new StringBuilder();
|
||||
int i = 0;
|
||||
@@ -97,8 +97,8 @@ public class PHPBB implements EncryptionMethod {
|
||||
* Method _hash_crypt_private.
|
||||
* @param password String
|
||||
* @param setting String
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
String _hash_crypt_private(String password, String setting) {
|
||||
String output = "*";
|
||||
if (!setting.substring(0, 3).equals("$H$"))
|
||||
@@ -124,8 +124,8 @@ public class PHPBB implements EncryptionMethod {
|
||||
* Method phpbb_check_hash.
|
||||
* @param password String
|
||||
* @param hash String
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
* @return boolean */
|
||||
public boolean phpbb_check_hash(String password, String hash) {
|
||||
if (hash.length() == 34)
|
||||
return _hash_crypt_private(password, hash).equals(hash);
|
||||
@@ -135,8 +135,8 @@ public class PHPBB implements EncryptionMethod {
|
||||
/**
|
||||
* Method md5.
|
||||
* @param data String
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
public static String md5(String data) {
|
||||
try {
|
||||
byte[] bytes = data.getBytes("ISO-8859-1");
|
||||
@@ -151,8 +151,8 @@ public class PHPBB implements EncryptionMethod {
|
||||
/**
|
||||
* Method hexToInt.
|
||||
* @param ch char
|
||||
* @return int
|
||||
*/
|
||||
|
||||
* @return int */
|
||||
static int hexToInt(char ch) {
|
||||
if (ch >= '0' && ch <= '9')
|
||||
return ch - '0';
|
||||
@@ -165,8 +165,8 @@ public class PHPBB implements EncryptionMethod {
|
||||
/**
|
||||
* Method bytes2hex.
|
||||
* @param bytes byte[]
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
private static String bytes2hex(byte[] bytes) {
|
||||
StringBuilder r = new StringBuilder(32);
|
||||
for (byte b : bytes) {
|
||||
@@ -181,8 +181,8 @@ public class PHPBB implements EncryptionMethod {
|
||||
/**
|
||||
* Method pack.
|
||||
* @param hex String
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
static String pack(String hex) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i = 0; i < hex.length(); i += 2) {
|
||||
@@ -199,10 +199,10 @@ public class PHPBB implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -214,10 +214,10 @@ public class PHPBB implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
|
||||
@@ -20,10 +20,10 @@ public class PHPFUSION implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -56,10 +56,10 @@ public class PHPFUSION implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -70,9 +70,9 @@ public class PHPFUSION implements EncryptionMethod {
|
||||
/**
|
||||
* Method getSHA1.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getSHA1(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||
|
||||
@@ -11,10 +11,10 @@ public class PLAINTEXT implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -26,10 +26,10 @@ public class PLAINTEXT implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
|
||||
@@ -12,10 +12,10 @@ public class ROYALAUTH implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,9 +28,9 @@ public class ROYALAUTH implements EncryptionMethod {
|
||||
* Method hash.
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
public String hash(String password, String salt)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-512");
|
||||
@@ -47,10 +47,10 @@ public class ROYALAUTH implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
|
||||
@@ -15,10 +15,10 @@ public class SALTED2MD5 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -30,10 +30,10 @@ public class SALTED2MD5 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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,9 +44,9 @@ public class SALTED2MD5 implements EncryptionMethod {
|
||||
/**
|
||||
* Method getMD5.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getMD5(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
|
||||
@@ -15,10 +15,10 @@ public class SALTEDSHA512 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -30,10 +30,10 @@ public class SALTEDSHA512 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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,9 +44,9 @@ public class SALTEDSHA512 implements EncryptionMethod {
|
||||
/**
|
||||
* Method getSHA512.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getSHA512(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha512 = MessageDigest.getInstance("SHA-512");
|
||||
|
||||
@@ -13,10 +13,10 @@ public class SHA1 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,10 +28,10 @@ public class SHA1 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -41,9 +41,9 @@ public class SHA1 implements EncryptionMethod {
|
||||
/**
|
||||
* Method getSHA1.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getSHA1(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||
|
||||
@@ -13,10 +13,10 @@ public class SHA256 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,10 +28,10 @@ public class SHA256 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -42,9 +42,9 @@ public class SHA256 implements EncryptionMethod {
|
||||
/**
|
||||
* Method getSHA256.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getSHA256(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
|
||||
|
||||
@@ -13,10 +13,10 @@ public class SHA512 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,10 +28,10 @@ public class SHA512 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -41,9 +41,9 @@ public class SHA512 implements EncryptionMethod {
|
||||
/**
|
||||
* Method getSHA512.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getSHA512(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha512 = MessageDigest.getInstance("SHA-512");
|
||||
|
||||
@@ -13,10 +13,10 @@ public class SMF implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,10 +28,10 @@ public class SMF implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -41,9 +41,9 @@ public class SMF implements EncryptionMethod {
|
||||
/**
|
||||
* Method getSHA1.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getSHA1(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||
|
||||
@@ -15,10 +15,10 @@ public class WBB3 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -30,10 +30,10 @@ public class WBB3 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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,9 +44,9 @@ public class WBB3 implements EncryptionMethod {
|
||||
/**
|
||||
* Method getSHA1.
|
||||
* @param message String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
private static String getSHA1(String message)
|
||||
throws NoSuchAlgorithmException {
|
||||
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
|
||||
|
||||
@@ -11,10 +11,10 @@ public class WBB4 implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -26,10 +26,10 @@ public class WBB4 implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
|
||||
@@ -379,8 +379,8 @@ public class WHIRLPOOL implements EncryptionMethod {
|
||||
/**
|
||||
* Method display.
|
||||
* @param array byte[]
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
protected static String display(byte[] array) {
|
||||
char[] val = new char[2 * array.length];
|
||||
String hex = "0123456789ABCDEF";
|
||||
@@ -397,10 +397,10 @@ public class WHIRLPOOL implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -416,10 +416,10 @@ public class WHIRLPOOL implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
|
||||
@@ -17,8 +17,8 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
* Method encode64.
|
||||
* @param src byte[]
|
||||
* @param count int
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
private String encode64(byte[] src, int count) {
|
||||
int i, value;
|
||||
StringBuilder output = new StringBuilder();
|
||||
@@ -57,8 +57,8 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
* Method crypt.
|
||||
* @param password String
|
||||
* @param setting String
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
private String crypt(String password, String setting) {
|
||||
String output = "*0";
|
||||
if (((setting.length() < 2) ? setting : setting.substring(0, 2)).equalsIgnoreCase(output)) {
|
||||
@@ -100,8 +100,8 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
/**
|
||||
* Method gensaltPrivate.
|
||||
* @param input byte[]
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
private String gensaltPrivate(byte[] input) {
|
||||
String output = "$P$";
|
||||
int iterationCountLog2 = 8;
|
||||
@@ -113,8 +113,8 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
/**
|
||||
* Method stringToUtf8.
|
||||
* @param string String
|
||||
* @return byte[]
|
||||
*/
|
||||
|
||||
* @return byte[] */
|
||||
private byte[] stringToUtf8(String string) {
|
||||
try {
|
||||
return string.getBytes("UTF-8");
|
||||
@@ -128,10 +128,10 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -145,10 +145,10 @@ public class WORDPRESS implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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,10 +11,10 @@ public class XAUTH implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -28,10 +28,10 @@ public class XAUTH implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -43,8 +43,8 @@ public class XAUTH implements EncryptionMethod {
|
||||
/**
|
||||
* Method getWhirlpool.
|
||||
* @param message String
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
public static String getWhirlpool(String message) {
|
||||
WHIRLPOOL w = new WHIRLPOOL();
|
||||
byte[] digest = new byte[WHIRLPOOL.DIGESTBYTES];
|
||||
|
||||
@@ -18,10 +18,10 @@ public class XF implements EncryptionMethod {
|
||||
* @param password String
|
||||
* @param salt String
|
||||
* @param name String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#getHash(String, String, 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 {
|
||||
@@ -33,10 +33,10 @@ public class XF implements EncryptionMethod {
|
||||
* @param hash String
|
||||
* @param password String
|
||||
* @param playerName String
|
||||
* @return boolean
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @see fr.xephi.authme.security.crypts.EncryptionMethod#comparePassword(String, String, 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 {
|
||||
@@ -47,9 +47,9 @@ public class XF implements EncryptionMethod {
|
||||
/**
|
||||
* Method getSHA256.
|
||||
* @param password String
|
||||
* @return String
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @throws NoSuchAlgorithmException */
|
||||
public String getSHA256(String password) throws NoSuchAlgorithmException {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
md.update(password.getBytes());
|
||||
@@ -73,8 +73,8 @@ public class XF implements EncryptionMethod {
|
||||
* Method regmatch.
|
||||
* @param pattern String
|
||||
* @param line String
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
public String regmatch(String pattern, String line) {
|
||||
List<String> allMatches = new ArrayList<>();
|
||||
Matcher m = Pattern.compile(pattern).matcher(line);
|
||||
|
||||
@@ -83,9 +83,9 @@ public class MacBasedPRF implements PRF {
|
||||
/**
|
||||
* Method doFinal.
|
||||
* @param M byte[]
|
||||
* @return byte[]
|
||||
* @see fr.xephi.authme.security.pbkdf2.PRF#doFinal(byte[])
|
||||
*/
|
||||
|
||||
|
||||
* @return byte[] * @see fr.xephi.authme.security.pbkdf2.PRF#doFinal(byte[]) */
|
||||
public byte[] doFinal(byte[] M) {
|
||||
byte[] r = mac.doFinal(M);
|
||||
return r;
|
||||
@@ -93,9 +93,9 @@ public class MacBasedPRF implements PRF {
|
||||
|
||||
/**
|
||||
* Method getHLen.
|
||||
* @return int
|
||||
* @see fr.xephi.authme.security.pbkdf2.PRF#getHLen()
|
||||
*/
|
||||
|
||||
|
||||
* @return int * @see fr.xephi.authme.security.pbkdf2.PRF#getHLen() */
|
||||
public int getHLen() {
|
||||
return hLen;
|
||||
}
|
||||
@@ -103,8 +103,8 @@ public class MacBasedPRF implements PRF {
|
||||
/**
|
||||
* Method init.
|
||||
* @param P byte[]
|
||||
* @see fr.xephi.authme.security.pbkdf2.PRF#init(byte[])
|
||||
*/
|
||||
|
||||
* @see fr.xephi.authme.security.pbkdf2.PRF#init(byte[]) */
|
||||
public void init(byte[] P) {
|
||||
try {
|
||||
mac.init(new SecretKeySpec(P, macAlgorithm));
|
||||
|
||||
@@ -115,9 +115,9 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
/**
|
||||
* Method deriveKey.
|
||||
* @param inputPassword String
|
||||
* @return byte[]
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#deriveKey(String)
|
||||
*/
|
||||
|
||||
|
||||
* @return byte[] * @see fr.xephi.authme.security.pbkdf2.PBKDF2#deriveKey(String) */
|
||||
public byte[] deriveKey(String inputPassword) {
|
||||
return deriveKey(inputPassword, 0);
|
||||
}
|
||||
@@ -126,9 +126,9 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* Method deriveKey.
|
||||
* @param inputPassword String
|
||||
* @param dkLen int
|
||||
* @return byte[]
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#deriveKey(String, int)
|
||||
*/
|
||||
|
||||
|
||||
* @return byte[] * @see fr.xephi.authme.security.pbkdf2.PBKDF2#deriveKey(String, int) */
|
||||
public byte[] deriveKey(String inputPassword, int dkLen) {
|
||||
byte[] r = null;
|
||||
byte P[] = null;
|
||||
@@ -156,9 +156,9 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
/**
|
||||
* Method verifyKey.
|
||||
* @param inputPassword String
|
||||
* @return boolean
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#verifyKey(String)
|
||||
*/
|
||||
|
||||
|
||||
* @return boolean * @see fr.xephi.authme.security.pbkdf2.PBKDF2#verifyKey(String) */
|
||||
public boolean verifyKey(String inputPassword) {
|
||||
byte[] referenceKey = getParameters().getDerivedKey();
|
||||
if (referenceKey == null || referenceKey.length == 0) {
|
||||
@@ -193,9 +193,9 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
|
||||
/**
|
||||
* Method getPseudoRandomFunction.
|
||||
* @return PRF
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#getPseudoRandomFunction()
|
||||
*/
|
||||
|
||||
|
||||
* @return PRF * @see fr.xephi.authme.security.pbkdf2.PBKDF2#getPseudoRandomFunction() */
|
||||
public PRF getPseudoRandomFunction() {
|
||||
return prf;
|
||||
}
|
||||
@@ -318,9 +318,9 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
|
||||
/**
|
||||
* Method getParameters.
|
||||
* @return PBKDF2Parameters
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#getParameters()
|
||||
*/
|
||||
|
||||
|
||||
* @return PBKDF2Parameters * @see fr.xephi.authme.security.pbkdf2.PBKDF2#getParameters() */
|
||||
public PBKDF2Parameters getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
@@ -328,8 +328,8 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
/**
|
||||
* Method setParameters.
|
||||
* @param parameters PBKDF2Parameters
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#setParameters(PBKDF2Parameters)
|
||||
*/
|
||||
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#setParameters(PBKDF2Parameters) */
|
||||
public void setParameters(PBKDF2Parameters parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
@@ -337,8 +337,8 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
/**
|
||||
* Method setPseudoRandomFunction.
|
||||
* @param prf PRF
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#setPseudoRandomFunction(PRF)
|
||||
*/
|
||||
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2#setPseudoRandomFunction(PRF) */
|
||||
public void setPseudoRandomFunction(PRF prf) {
|
||||
this.prf = prf;
|
||||
}
|
||||
@@ -357,7 +357,8 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* Supply the password as argument.
|
||||
|
||||
|
||||
* @throws IOException * @throws NoSuchAlgorithmException */
|
||||
* @throws IOException * @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
throws IOException, NoSuchAlgorithmException {
|
||||
String password = "password";
|
||||
|
||||
@@ -37,9 +37,9 @@ public class PBKDF2HexFormatter implements PBKDF2Formatter {
|
||||
* Method fromString.
|
||||
* @param p PBKDF2Parameters
|
||||
* @param s String
|
||||
* @return boolean
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2Formatter#fromString(PBKDF2Parameters, String)
|
||||
*/
|
||||
|
||||
|
||||
* @return boolean * @see fr.xephi.authme.security.pbkdf2.PBKDF2Formatter#fromString(PBKDF2Parameters, String) */
|
||||
public boolean fromString(PBKDF2Parameters p, String s) {
|
||||
if (p == null || s == null) {
|
||||
return true;
|
||||
@@ -63,9 +63,9 @@ public class PBKDF2HexFormatter implements PBKDF2Formatter {
|
||||
/**
|
||||
* Method toString.
|
||||
* @param p PBKDF2Parameters
|
||||
* @return String
|
||||
* @see fr.xephi.authme.security.pbkdf2.PBKDF2Formatter#toString(PBKDF2Parameters)
|
||||
*/
|
||||
|
||||
|
||||
* @return String * @see fr.xephi.authme.security.pbkdf2.PBKDF2Formatter#toString(PBKDF2Parameters) */
|
||||
public String toString(PBKDF2Parameters p) {
|
||||
String s = BinTools.bin2hex(p.getSalt()) + ":" + String.valueOf(p.getIterationCount()) + ":" + BinTools.bin2hex(p.getDerivedKey());
|
||||
return s;
|
||||
|
||||
@@ -111,8 +111,8 @@ public class PBKDF2Parameters {
|
||||
|
||||
/**
|
||||
* Method getIterationCount.
|
||||
* @return int
|
||||
*/
|
||||
|
||||
* @return int */
|
||||
public int getIterationCount() {
|
||||
return iterationCount;
|
||||
}
|
||||
@@ -127,8 +127,8 @@ public class PBKDF2Parameters {
|
||||
|
||||
/**
|
||||
* Method getSalt.
|
||||
* @return byte[]
|
||||
*/
|
||||
|
||||
* @return byte[] */
|
||||
public byte[] getSalt() {
|
||||
return salt;
|
||||
}
|
||||
@@ -143,8 +143,8 @@ public class PBKDF2Parameters {
|
||||
|
||||
/**
|
||||
* Method getDerivedKey.
|
||||
* @return byte[]
|
||||
*/
|
||||
|
||||
* @return byte[] */
|
||||
public byte[] getDerivedKey() {
|
||||
return derivedKey;
|
||||
}
|
||||
@@ -159,8 +159,8 @@ public class PBKDF2Parameters {
|
||||
|
||||
/**
|
||||
* Method getHashAlgorithm.
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
public String getHashAlgorithm() {
|
||||
return hashAlgorithm;
|
||||
}
|
||||
@@ -175,8 +175,8 @@ public class PBKDF2Parameters {
|
||||
|
||||
/**
|
||||
* Method getHashCharset.
|
||||
* @return String
|
||||
*/
|
||||
|
||||
* @return String */
|
||||
public String getHashCharset() {
|
||||
return hashCharset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user