trying to store the encrypted version of text box value
I have a text box when we enter the value in to text box and we click on save button the encrypted version of text box value will be stored in database and when we retrieving the value it must be decrypted.
I don't know how to do this - 开发者_如何学Gowould any one help on this topic.
See this SO discussion - it should answer your question of how to encrypt and decrypt a string using C#. See also, the .NET Cryptography namespace.
http://support.microsoft.com/kb/307020 explains one method of taking hashes of two strings and comparing them together.
When you say encrypt I assume you mean a hash? You really shouldn't be able to decrypt a users password. Usually what you do is take a hash store it in the DB, then whenever you need to validate the password you ask the user for it, hash that value and compare the user entered hash and the hash stored in the database.
There are a variety or hashing algorithms; .NET has several built in MD5 and several SHA algorithms.
MSDN has a lot of great links on taking a hash and using that.
精彩评论