I have a table in which the userpassword field has varbinary datatype, so I am confused about which form I should save in user Data in the password word because when I save varchar data, I get an error.
A varbinary column can store anything in it to store a string , You must enter it in varbinary :
Enter declar @t table (id int identity, pwd varbinary (50)) But for a password, a varbinary column usually stores a hash of some kind. For example, using SHA1 hash:
enter @t (pwd) values (hashbets ('sh1', 'secret')); Storing a one-way hash rather than the actual password is more secure. You can check that the password matches:
Select from where pwd = hashbete ('sha 1', 'secret') But there you can not retrieve the password by looking at the table. That's why only the end user knows his password, and even DBA can not retrieve it.
Comments
Post a Comment