加密密码 php 的最佳方式(2017 年)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43864379/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Best way encrypt password php (in 2017)
提问by Rocstar
In my website I use md5
to crypt password user in my database (and store session user)
在我的网站中,我用来md5
在我的数据库中加密密码用户(并存储会话用户)
$pswUser = md5($_POST["password"]);
But I have just been told that this way of encrypting has become obsolete
但是我刚刚被告知这种加密方式已经过时了
I did some research to find out how to do it but most of the posts dates from two or three years ago So what is the best way to encrypt password in 2017 ?
我做了一些研究以找出如何做到这一点,但大多数帖子都是两三年前的 那么在 2017 年加密密码的最佳方法是什么?
Thank you
谢谢
Isn't duplicate discussion ... Secure hash and salt for PHP passwords=> 2009 ...
不是重复讨论...... PHP 密码的安全哈希和盐=> 2009 ...
回答by user7984880
The password hash function in combination with password verify
密码哈希函数结合密码验证
https://secure.php.net/manual/en/function.password-hash.phphttps://secure.php.net/manual/en/function.password-verify.php
https://secure.php.net/manual/en/function.password-hash.php https://secure.php.net/manual/en/function.password-verify.php