如何将密码以加密形式存储在数据库中? [英] How to store password in encrypted form in database?
本文介绍了如何将密码以加密形式存储在数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我们将密码存储在数据库的admin部分时,它不会以加密格式存储.因此,如何使用密码文本进行加密?
when we store password in admin section of database, it is not stored in encrypted format. So ho to do encryption with the password text?
推荐答案
那里有一个System.Cryptography命名空间,只是加密方法的全部.
There''s a System.Cryptography namespace just FULL of encryption methods.
不要存储实际密码.存储密码的哈希值.
用户登录时,对纯文本进行哈希处理并与存储的哈希进行比较.
在文档中签出RSA256或其他哈希函数.
注意:这是一种方法,如果忘记了密码,将无法恢复密码,您必须设置一个新密码.
Don''t store the actual password. Store a hash of the password.
When the user logins in, hash the plaintext and compare with the stored hash.
checkout RSA256 or other hash functions in the docs.
Note: this is one way, the password cannot be recovered if it is forgotten, you would have to set a new password.
请尝试以下操作: ^ ]
Try this: C# encrypt password database[^]
这篇关于如何将密码以加密形式存储在数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文