예제 #1
0
 public static boolean validatePwd(String OldPwd, User user) {
   String oldPwd1 =
       new SimpleHash(
               algorithmName,
               OldPwd,
               ByteSource.Util.bytes(user.getCredentialsSalt()),
               hashIterations)
           .toHex();
   return oldPwd1.equals(user.getPassword());
 }
예제 #2
0
 public static void encryptPassword(User user) {
   user.setSalt(generator.nextBytes().toHex());
   String newPassword =
       new SimpleHash(
               algorithmName,
               user.getPassword(),
               ByteSource.Util.bytes(user.getCredentialsSalt()),
               hashIterations)
           .toHex();
   user.setPassword(newPassword);
 }