I have a Members
table with a plain text password column (varchar20). I want to convert every existing password to SHA1 encryption, but I need to keep the password field a varchar field. My understanding of the HashBytes function is that should be used with a binary field.
Can I get some help to how to convert this column to a string that is appropriate for a varchar column? This is only a 1 time event... future passwords will be created by a system that already applies the hash as described.
My table is "Members"... the column is "WebPassword"... I have created a new varchar(40) column called "WebPassword1" to update the encrypted passwords to.
This is what I have so far:
SET WebPassword2= HashBytes('SHA1', WebPassword)
Unfortuantely, this just creates a bunch of odd looking characters...I am assuming because it expects the field to be binary.
I would appreciate any help.
SQL Server 2005 Standard