C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Encryption »

C# and VB.Net Encryption


Posted Date: 09 Jun 2009    Resource Type: Code Snippets    Category: Encryption
Author: SayreMember Level: Gold    
Rating: 1 out of 5Points: 10



Hi. These following code will show you the encryption and decryption of your data.

C#

public static string EncryptString(string strString)
{
Byte[] _bitEncrypt;
string EnCrypted;

_bitEncrypt = ASCIIEncoding.ASCII.GetBytes(strString);
EnCrypted = Convert.ToBase64String(_bitEncrypt);
return EnCrypted;
}
public static string DecryptString(string strString)
{
Byte[] _bitDecrypt;
string Decrypted;

_bitDecrypt = Convert.FromBase64String(strString);
Decrypted = ASCIIEncoding.ASCII.GetString(_bitDecrypt);
return Decrypted;
}


VB

Public Function EncryptQueryString(ByVal queryString As String) As String
Dim _bitEncrypt As Byte()
_bitEncrypt = ASCIIEncoding.ASCII.GetBytes(queryString)
Dim encryptedQueryString As String = Convert.ToBase64String(_bitEncrypt)
Return encryptedQueryString
End Function

Public Function DecryptQueryString(ByVal queryString As String) As String
Dim _bitDecrypt As Byte()
_bitDecrypt = Convert.FromBase64String(queryString)
Dim decryptedQueryString = ASCIIEncoding.ASCII.GetString(_bitDecrypt)
Return decryptedQueryString
End Function


I hope this one will help many.

For more details, visit http://codeincsharp.blogspot.com/2008/08/encrypt-and-decrypt-in-c.html



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Encryption  .  Decryption  .  Data  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Create Salt/IV file for password
Previous Resource: Encrypt/Decrypt text files using Rijndael or TripleDES
Return to Discussion Resource Index
Post New Resource
Category: Encryption


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use