加密密码的安全方式[重复](Secure way to encrypt password [duplicate])

编程入门 行业动态 更新时间:2024-10-21 23:07:35
加密密码的安全方式[重复](Secure way to encrypt password [duplicate])

可能重复: 为PHP密码保护哈希和盐

这是加密密码以存储在mysql数据库中的安全方法:

md5(sha1($password))

谢谢。

Possible Duplicate: Secure hash and salt for PHP passwords

Is this a secure way to encrypt the passwords to store in a mysql database:

md5(sha1($password))

Thanks.

最满意答案

你在这里做的是散列 ,而不是加密 。

散列的目的是不将密码本身存储在数据库中,这样如果数据库被盗,攻击者将无法获得所有用户密码的知识。

散列应该与散列哈希一起使用,否则对于已经获得数据库访问权限的攻击者来说,破解存储在那里的密码将相对容易。

此外,对相同的输入进行两次哈希处理(例如md5和sha1示例)并没有提供任何显着的好处。

What you are doing here is hashing, not encrypting.

Hashing has the purpose of not storing the password itself in the database, so that if the database is stolen the attacker will not gain knowledge of all user passwords.

Hashing should be used in conjunction with salting the hashes, because otherwise it will be relatively easy for an attacker who has gained access to the database to crack the weak passwords stored there.

Also, hashing the same input twice (as your example does with md5 and sha1) does not offer any significant benefit.

更多推荐

本文发布于:2023-08-05 10:53:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1431194.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:密码   方式   Secure   duplicate   password

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!