本文介绍了如何加密SQL Server数据库中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个具有表单emloyeDetails的winform,该表单将员工信息(例如姓名,用户名和密码)保存到数据库中.现在我想对密码列进行加密,以便对其进行保护.有人可以告诉我如何执行此操作.同样也需要加密用户名列.
感谢您的帮助.

Hi
i have a winform that has a form emloyeDetails, The form save the employee information say Name, username and password to the database. Now i want to encrypt the password column so it can be secured.can someone show me how to do this. And also is it necesary to encrypt the username column as well.
Thanks for help

推荐答案


HASHBYTES('SHA1', convert(varbinary(32), @password))


无论何时需要,都可以将其与哈希进行比较,然后可以验证密码是否匹配.这样,您自己也不知道密码.
使用此方法,即使黑客获得了对数据库的完全访问权限,他仍然不知道密码.


Whenever you need, compare with a hash and you can verify if the password matches. This way, you yourself also don''t know the password.
Using this, even if a hacker gains complete access to your database, he still does not know the passwords.


这篇关于如何加密SQL Server数据库中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 03:44