DEV Community

Discussion on: How to Securely Store a Password in Java

Collapse
 
awwsmm profile image
Andrew (he/him)

If anyone's interested, here are different implementations of this general procedure in languages like PHP, Ruby, JavaScript, and so on. The PHP implementation is indeed just 3 lines:

password_hash($password, PASSWORD_BCRYPT);
$salt = '$2y$10$' . mcrypt_create_iv(22);
$salted_password = crypt($password, $salt);
Enter fullscreen mode Exit fullscreen mode
Collapse
 
theodesp profile image
Theofanis Despoudis • Edited

Yes, I remember because I had to port a similar algorithm in Java and it was like 200 lines of code vs this one!