加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP Securitywise为什么md5不再被认为是安全的?

发布时间:2020-12-13 16:52:47 所属栏目:PHP教程 来源:网络整理
导读:参见英文答案 How do you use bcrypt for hashing passwords in PHP?????????????????????????????????????9个 ???????????? I’m using MD5 to hash passwords. When should I jump to the next thing? SHA-3? [closed]???????????????????????????????????
参见英文答案 > How do you use bcrypt for hashing passwords in PHP?????????????????????????????????????9个
>???????????? I’m using MD5 to hash passwords. When should I jump to the next thing? SHA-3? [closed]????????????????????????????????????1个
作为一名php开发人员,我一直在使用md5散列算法来保护密码数据并生成独特的散列算法.

然而,从最近几个月我听到传言md5不再被认为是安全的,我想知道为什么?

什么是密码验证备选方案,即PHP 5.5中的SHA1,password_hash()?而且我想知道为什么这些替代品现在被认为是更好的选择,因为对我来说,大多数这些只是另一种哈希算法……

解决方法

因为许多网站和 research studies已经证明md5()可以被颠倒,你应该停止使用它!

简单来说……

您可以很好地利用PHP 5.5中的password_hash()以及crypt()那些是目前为止考虑的更好的.

从PHP手册中获取的password_hash()的简单说明

<?php
$options = [
    'cost' => 12,];
echo password_hash("rasmuslerdorf",PASSWORD_BCRYPT,$options)."n";
?>

使用BLOWFISH算法的地穴的简单说明

if (CRYPT_BLOWFISH == 1) {
    echo 'Blowfish:     ' . crypt('rasmuslerdorf','$2a$07$usesomesillystringforsalt$') . "n";
}

编辑:

为什么你不应该使用md5()?

Hashing algorithms such as MD5,SHA1 and SHA256 are designed to be
very fast and efficient. With modern techniques and computer
equipment,it has become trivial to “brute force” the output of these
algorithms,in order to determine the original input. Because of how
quickly a modern computer can “reverse” these hashing algorithms,many
security professionals strongly suggest against their use for password
hashing.

为什么在PHP 5.5上使用password_hash()?

When hashing passwords,the two most important considerations are the
computational expense,and the salt. The more computationally
expensive the hashing algorithm,the longer it will take to brute
force its output. PHP 5.5 provides a native password hashing API which is the password_hash() that
safely handles both hashing and verifying passwords in a secure
manner.

Source

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读