|
|
@@ -10,6 +10,7 @@ public class PasswordHelper { |
|
|
|
//private RandomNumberGenerator randomNumberGenerator = new SecureRandomNumberGenerator(); |
|
|
|
private String algorithmName = "md5"; |
|
|
|
private int hashIterations = 2; |
|
|
|
private String salt = "salt and pepper"; |
|
|
|
|
|
|
|
public void encryptPassword(MallUserInfo user) { |
|
|
|
//String salt=randomNumberGenerator.nextBytes().toHex(); |
|
|
@@ -24,11 +25,10 @@ public class PasswordHelper { |
|
|
|
} |
|
|
|
|
|
|
|
public String encryptPassword(String password) { |
|
|
|
return new SimpleHash(algorithmName, password, hashIterations).toHex(); |
|
|
|
return new SimpleHash(algorithmName, password, ByteSource.Util.bytes(salt), hashIterations).toHex(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
MallUserInfo user = new MallUserInfo(); |
|
|
|
user.setUsername("mfadmin"); |
|
|
|