Windows Develop Bookmark and Share   
 index > Windows Forms General > Encrypting password field in SQL table.
 

Encrypting password field in SQL table.

Hi all!!! :)


I'm using VC++ 2005, created a CLR Windows Forms project. Connecting to a sql express database using SqlClient namespace. SqlConnection, SqlCommand etc.

How can I encrypt a field of text, which contains a user password?

Thanks!
Josamoto80  Sunday, April 30, 2006 8:48 PM

Ah, you should not come up with your own encryption algorithm. There are a whole new set of encryption functions built into SQL Server 2005--including SQL Server Express. See http://www.databasejournal.com/features/mssql/article.php/3483931.

William Vaughn  Monday, May 01, 2006 1:57 AM

You should use one of the HashAlgorithm (SHA1 is most common) derived class to store password's hash value so there is no way for anybody to gain access to the original password. And then in application just compare hash values of entered password against one in the database.

Miha Markic  Sunday, April 30, 2006 10:18 PM

Ah, you should not come up with your own encryption algorithm. There are a whole new set of encryption functions built into SQL Server 2005--including SQL Server Express. See http://www.databasejournal.com/features/mssql/article.php/3483931.

William Vaughn  Monday, May 01, 2006 1:57 AM

Hi,

You can simply store the hash code of thepassword rather than needing to encrypt it.

GetHashCode() of the string object returns the hash value. Store that value in the database and whenyour user types in their password compare the inputs hash code against the one stored in the database.

Derek Smyth  Monday, May 01, 2006 9:41 AM
I'll look into storing the has code in the field. That's a darn good idea! Thanks for the advice guys!
Josamoto80  Monday, May 01, 2006 7:50 PM

You can use google to search for other answers

Custom Search

More Threads

• Windows Forms/General Button_Click method/Calculator/operators/operands
• License for using MS Office Products in other MS development platforms
• Problem with ListBox size
• Changing the background color of a disabled control
• Load an image using windows form
• Catastrophic failure while using ImagetoIPicture
• Has somebody made a surveillance thread which doesn't die?
• DataGrid double scrollbar problem
• RichText Problem...
• Ignoring Mouse_Down events in C#