SQL-Server Password Encryption

隐身守侯 提交于 2019-12-30 07:44:17

问题


I am creating a database for a website I've just developed but I need to encrypt my passwords.

I've never encrypted passwords before and I don't know how to do it, I've searched google and a lot of websites but all they do is confuse me.

Here is my Sproc:

CREATE TABLE USERS(
Username Nvarchar(200) PRIMARY KEY NOT NULL,
Password Nvarchar(200) NOT NULL,
EmailPassword Nvarchar(200) NOT NULL,
UsernamePassword Nvarchar(200) NOT NULL
)
CREATE TABLE Usernames(
Username Nvarchar(200) FOREIGN KEY(Username) REFERENCES USERS(Username),
Usernames Nvarchar(300) NOT NULL,
Description nvarchar(500)
)
CREATE TABLE Emails(
Username Nvarchar(200) FOREIGN KEY(Username) REFERENCES USERS(Username),
Passwords Nvarchar(300) NOT NULL,
Description nvarchar(500)
)
CREATE TABLE Passwords(
Username Nvarchar(200) FOREIGN KEY(Username) REFERENCES USERS(Username),
Usernames Nvarchar(300) NOT NULL,
Description nvarchar(500)
)

I would like to encrypt the columns that contain NOT NULL accept the username column


回答1:


Dont store the password directly, not even encrypted. Use a salted hash.

Check out

  • Secure Salted Password Hashing - How to do it Properly
  • Strong Password Hashing with SQL Server


来源:https://stackoverflow.com/questions/25136102/sql-server-password-encryption

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!