小编Fah*_*i95的帖子

SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512") 抛出 NoSuchAlgorithmException

经过一点研究和一些工作后,我终于能够对密码进行哈希盐处理了,现在我脑子里有一个问题,我已经使用了 SHA1 方法,我想尝试使用 SHA512,因为有人告诉我它更好(更安全)所以以下是我的代码,它有点乱,但我认为它是可以理解的:

public class Safety
{
   //calling some parameters for possible later changes
   public static final String algorithm = "PBKDF2WithHmacSHA1";
   public static final int saltbytesize = 24;
   public static final int hashbytesize = 24;
   public static final int iterations = 1000;
   public static final int iIndex = 0;
   public static final int sIndex = 1;
   public static final int pbkIndex = 2;

   public static Users passwordHash(Users user) throws NoSuchAlgorithmException,
                                                       InvalidKeySpecException
   {
      SecureRandom sR = new SecureRandom();

      byte[] pws …
Run Code Online (Sandbox Code Playgroud)

java security algorithm sha

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

algorithm ×1

java ×1

security ×1

sha ×1