存储用户名& MySQL数据库中的密码 [英] Best practice for storing usernames & password in MySQL Databases

查看:261
本文介绍了存储用户名& MySQL数据库中的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

安全的哈希和盐为PHP密码


我正在制作一个将用户凭据(电子邮件,用户名和密码)存储在MySQL数据库中的系统,并看到使用加密,盐化和加密类型的冲突观点。



你会推荐什么最好的方法?在MD5或SHA1编码?盐渍还是不盐渍?加密密码或所有3个元素?

解决方案

对于密码哈希使用 PBKDF2 它是 NIST批准。您应该为每个密码使用一个随机的非秘密盐,并且不重要(超过1000次)迭代计数。



对于用户名和电子邮件,可能不值得加密。 >

Possible Duplicate:
Secure hash and salt for PHP passwords

I am making a system that has stores user credentials (email, username and password) in a MySQL database and have seen conflicting views on using encryption, salting and encryption types.

What are the best methods you would recommend? Encoding in MD5 or SHA1? Salting or not salting? Encrypting just the password or all 3 elements?

解决方案

For the password hash use PBKDF2 it's NIST approved. You should use a random non-secret salt for each password and nontrivial (over 1000) iteration count.

For the username and email, probably not worth encrypting.

这篇关于存储用户名& MySQL数据库中的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆