如何在sql server2005中加密密码字段 [英] how to encrypt a password field in sql server2005

查看:314
本文介绍了如何在sql server2005中加密密码字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在sql server2005中加密密码字段?

how to encrypt a password field in sql server2005?

推荐答案

请参考此内容.
解释得很好,并且还提供了示例代码.

SQL中的加密级别不同 [
Kindly refer this.
It is well explained and sample code also available.

Different Level of Encryption in SQL[^]


通常,单向加密"就足够了:在明文密码中添加一些盐",然后使用MD5,SHA1或其他哈希函数对其进行哈希处理.当用户尝试登录时,只需遵循相同的步骤并比较加密"值即可.
如果需要从数据库中存储的值中检索原始的明文密码,则需要一种真实的加密方法. System.Security.Cryptography命名空间提供了一些方法.
Often a oneway "encryption" is sufficient: add some "salt" to the clear text password, then hash it with MD5, SHA1 or other hash functions. When the user tries to log in, just follow the same procedure and compare the "encrypted" values.
If you need to retrieve the original clear text password from the value stored in the database, you need a real encryption method. The System.Security.Cryptography namespace offers some methods.


您可以使用此编码来创建安全密码

you Can use this coding for making secure password

string s = "Foo bar";
string s1 = Convert.ToBase64String(Encoding.Unicode.GetBytes(s));

' And back...
string s2 = Encoding.Unicode.GetString(Convert.FromBase64String(s1));



谢谢



thanks


这篇关于如何在sql server2005中加密密码字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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