Click here to Skip to main content
16,006,475 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to save my password in Encrypted format in sql database.
pls help.....
Posted

 
Share this answer
 
Hi,

Here is the solution

You can encrypt a password and can store a password as VarBinary in a column by using EncryptByPassPhrase function. Encrypted column can be decrypted using the DECRYPTBYPASSPHRASE function.

Now while inserting the password filed into the table

INSERT INTO login_details(uid,username,password) VALUES(1,'smith',EncryptByPassPhrase('12','XXX'))

It will insert the value into the DB in encrypted format,while decription pass the same encripted value into the DECRYPTBYPASSPHRASE function

Thanks,
Prasant
 
Share this answer
 
Comments
Member 9388221 20-Nov-12 23:02pm    
Thanx Prashant Sir for your Reply...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900