How can I hash a password in Java?

前端 未结 13 2003
暖寄归人
暖寄归人 2020-11-22 05:00

I need to hash passwords for storage in a database. How can I do this in Java?

I was hoping to take the plain text password, add a random salt, then store the salt a

13条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 05:45

    While the NIST recommendation PBKDF2 has already been mentioned, I'd like to point out that there was a public password hashing competition that ran from 2013 to 2015. In the end, Argon2 was chosen as the recommended password hashing function.

    There is a fairly well adopted Java binding for the original (native C) library that you can use.

    In the average use-case, I don't think it does matter from a security perspective if you choose PBKDF2 over Argon2 or vice-versa. If you have strong security requirements, I recommend considering Argon2 in your evaluation.

    For further information on the security of password hashing functions see security.se.

提交回复
热议问题