Add bcrypt_2y for new phpbb system

This commit is contained in:
Xephi59
2015-07-31 01:11:34 +02:00
parent 9c42be39d8
commit fa831700a2
3 changed files with 31 additions and 1 deletions
@@ -20,7 +20,8 @@ public class PasswordSecurity {
private static SecureRandom rnd = new SecureRandom();
public static HashMap<String, String> userSalt = new HashMap<String, String>();
public static String createSalt(int length) throws NoSuchAlgorithmException {
public static String createSalt(int length)
throws NoSuchAlgorithmException {
byte[] msg = new byte[40];
rnd.nextBytes(msg);
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
@@ -94,6 +95,10 @@ public class PasswordSecurity {
salt = createSalt(16);
userSalt.put(playerName, salt);
break;
case BCRYPT2Y:
salt = createSalt(22);
userSalt.put(playerName, salt);
break;
case MD5:
case SHA1:
case WHIRLPOOL: