X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Fclub%2Fwpia%2Fgigi%2Futil%2FPasswordHash.java;h=7d2cb3342e92b0d4f6921c54b2191ce783c6083e;hp=51dffb70d8ed0763548ce7be6fed104364682c30;hb=41402fc03374ab7a63daa2472b2affb38fc163f0;hpb=eef9ff31b842e2f08975d1826491a16edda5972f diff --git a/src/club/wpia/gigi/util/PasswordHash.java b/src/club/wpia/gigi/util/PasswordHash.java index 51dffb70..7d2cb334 100644 --- a/src/club/wpia/gigi/util/PasswordHash.java +++ b/src/club/wpia/gigi/util/PasswordHash.java @@ -1,8 +1,5 @@ package club.wpia.gigi.util; -import java.io.UnsupportedEncodingException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; import java.util.Properties; import com.lambdaworks.crypto.SCryptUtil; @@ -29,6 +26,7 @@ public class PasswordHash { if (password == null || password.isEmpty()) { return null; } + if (hash.contains("$")) { if (SCryptUtil.check(password, hash)) { return hash; @@ -36,36 +34,8 @@ public class PasswordHash { return null; } } - String newhash = sha1(password); - boolean match = true; - if (newhash.length() != hash.length()) { - match = false; - } - for (int i = 0; i < newhash.length(); i++) { - match &= newhash.charAt(i) == hash.charAt(i); - } - if (match) { - return hash(password); - } else { - return null; - } - } - public static String sha1(String password) { - try { - MessageDigest md = MessageDigest.getInstance("SHA1"); - byte[] digest = md.digest(password.getBytes("UTF-8")); - StringBuffer res = new StringBuffer(digest.length * 2); - for (int i = 0; i < digest.length; i++) { - res.append(Integer.toHexString((digest[i] & 0xF0) >> 4)); - res.append(Integer.toHexString(digest[i] & 0xF)); - } - return res.toString(); - } catch (NoSuchAlgorithmException e) { - throw new Error(e); - } catch (UnsupportedEncodingException e) { - throw new Error(e); - } + return null; } public static String hash(String password) {