Finalized some fields, removed redundant code, various other fixes
This commit is contained in:
@@ -35,7 +35,7 @@ public enum HashAlgorithm {
|
||||
SALTEDSHA512(fr.xephi.authme.security.crypts.SALTEDSHA512.class),
|
||||
CUSTOM(Null.class);
|
||||
|
||||
Class<?> classe;
|
||||
final Class<?> classe;
|
||||
|
||||
/**
|
||||
* Constructor for HashAlgorithm.
|
||||
|
||||
@@ -18,8 +18,8 @@ import java.util.HashMap;
|
||||
*/
|
||||
public class PasswordSecurity {
|
||||
|
||||
public static HashMap<String, String> userSalt = new HashMap<>();
|
||||
private static SecureRandom rnd = new SecureRandom();
|
||||
public static final HashMap<String, String> userSalt = new HashMap<>();
|
||||
private static final SecureRandom rnd = new SecureRandom();
|
||||
|
||||
/**
|
||||
* Method createSalt.
|
||||
@@ -191,7 +191,7 @@ public class PasswordSecurity {
|
||||
* @return boolean * @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private static boolean compareWithAllEncryptionMethod(String password,
|
||||
String hash, String playerName) throws NoSuchAlgorithmException {
|
||||
String hash, String playerName) {
|
||||
for (HashAlgorithm algo : HashAlgorithm.values()) {
|
||||
if (algo != HashAlgorithm.CUSTOM) {
|
||||
try {
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class PHPBB implements EncryptionMethod {
|
||||
|
||||
private String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
private final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
/**
|
||||
* Method md5.
|
||||
|
||||
@@ -86,8 +86,8 @@ public class WHIRLPOOL implements EncryptionMethod {
|
||||
*/
|
||||
private static final String sbox = "\u1823\uc6E8\u87B8\u014F\u36A6\ud2F5\u796F\u9152" + "\u60Bc\u9B8E\uA30c\u7B35\u1dE0\ud7c2\u2E4B\uFE57" + "\u1577\u37E5\u9FF0\u4AdA\u58c9\u290A\uB1A0\u6B85" + "\uBd5d\u10F4\ucB3E\u0567\uE427\u418B\uA77d\u95d8" + "\uFBEE\u7c66\udd17\u479E\ucA2d\uBF07\uAd5A\u8333" + "\u6302\uAA71\uc819\u49d9\uF2E3\u5B88\u9A26\u32B0" + "\uE90F\ud580\uBEcd\u3448\uFF7A\u905F\u2068\u1AAE" + "\uB454\u9322\u64F1\u7312\u4008\uc3Ec\udBA1\u8d3d" + "\u9700\ucF2B\u7682\ud61B\uB5AF\u6A50\u45F3\u30EF" + "\u3F55\uA2EA\u65BA\u2Fc0\udE1c\uFd4d\u9275\u068A" + "\uB2E6\u0E1F\u62d4\uA896\uF9c5\u2559\u8472\u394c" + "\u5E78\u388c\ud1A5\uE261\uB321\u9c1E\u43c7\uFc04" + "\u5199\u6d0d\uFAdF\u7E24\u3BAB\ucE11\u8F4E\uB7EB" + "\u3c81\u94F7\uB913\u2cd3\uE76E\uc403\u5644\u7FA9" + "\u2ABB\uc153\udc0B\u9d6c\u3174\uF646\uAc89\u14E1" + "\u163A\u6909\u70B6\ud0Ed\ucc42\u98A4\u285c\uF886";
|
||||
|
||||
private static long[][] C = new long[8][256];
|
||||
private static long[] rc = new long[R + 1];
|
||||
private static final long[][] C = new long[8][256];
|
||||
private static final long[] rc = new long[R + 1];
|
||||
|
||||
static {
|
||||
for (int x = 0; x < 256; x++) {
|
||||
@@ -135,12 +135,12 @@ public class WHIRLPOOL implements EncryptionMethod {
|
||||
/**
|
||||
* Global number of hashed bits (256-bit counter).
|
||||
*/
|
||||
protected byte[] bitLength = new byte[32];
|
||||
protected final byte[] bitLength = new byte[32];
|
||||
|
||||
/**
|
||||
* Buffer of data to hash.
|
||||
*/
|
||||
protected byte[] buffer = new byte[64];
|
||||
protected final byte[] buffer = new byte[64];
|
||||
|
||||
/**
|
||||
* Current number of bits on the buffer.
|
||||
@@ -155,11 +155,11 @@ public class WHIRLPOOL implements EncryptionMethod {
|
||||
/**
|
||||
* The hashing state.
|
||||
*/
|
||||
protected long[] hash = new long[8];
|
||||
protected long[] K = new long[8];
|
||||
protected long[] L = new long[8];
|
||||
protected long[] block = new long[8];
|
||||
protected long[] state = new long[8];
|
||||
protected final long[] hash = new long[8];
|
||||
protected final long[] K = new long[8];
|
||||
protected final long[] L = new long[8];
|
||||
protected final long[] block = new long[8];
|
||||
protected final long[] state = new long[8];
|
||||
|
||||
public WHIRLPOOL() {
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.Arrays;
|
||||
public class WORDPRESS implements EncryptionMethod {
|
||||
|
||||
private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
private SecureRandom randomGen = new SecureRandom();
|
||||
private final SecureRandom randomGen = new SecureRandom();
|
||||
|
||||
/**
|
||||
* Method encode64.
|
||||
|
||||
@@ -46,7 +46,7 @@ public class MacBasedPRF implements PRF {
|
||||
|
||||
protected int hLen;
|
||||
|
||||
protected String macAlgorithm;
|
||||
protected final String macAlgorithm;
|
||||
|
||||
/**
|
||||
* Create Mac-based Pseudo Random Function.
|
||||
|
||||
Reference in New Issue
Block a user