How to Encrypt Password and compare?
MS SQL has its own built in function to Encrypt password or secure text and compare it. This is very simple see the Example:
—1 , Create a Table to insert.
Create table tempPassTable ( id int, pwd varbinary(200) )
—2, Insert encrypted value to a table.
insert into tempPassTable(id,pwd) select 1, pwdencrypt('abcd')
—3, Compare encrypted value and user input value.
if (select pwdcompare('abcd',pwd,0) from tempPassTable)=0 select 'Invalid Password' else select 'Valid Password'
Filed under: Encrypt Password and Compare | Tagged: Easy way to check Password, Insert encrypted value to a table, MS SQL Password compare, MSSQL builtin encrypt function, MSSQL Encryption, One way encryption, Password encrypt function, pwdcompare, pwdencrypt | 3 Comments »