Products
Services
Contact Us

Scripts: Asp :: Asp.net encryption :: Library Article #4

Developer's Section

Encrypt a String in ASP.NET
By: Erobo Team Member

Hire a Developer for Related Work / Installation | $55 hr
Rating:  | Rate It:   
Average Votes: (1899)
Favorites:

learn to encrypt a string in ASP.NET

Learn to encrypt a string in ASP.NET

Building the Encryptor

 Code Snippet 1
  
Private Function EncryptTripleDES(ByVal Plaintext As String,
                                                                          ByVal Key As String) As String
    'Create Cryptography Objects
    Dim DES As New System.Security.Cryptography.TripleDESCryptoServiceProvider
    'Create Hash type MD5
    Dim hashMD5 As New System.Security.Cryptography.MD5CryptoServiceProvider
    'Assign key
    DES.Key = hashMD5.ComputeHash 
                                        (System.Text.ASCIIEncoding.ASCII.GetBytes(Key))

    DES.Mode = System.Security.Cryptography.CipherMode.ECB

    Dim DESEncrypt As System.Security.Cryptography.ICryptoTransform

    DESEncrypt = DES.CreateEncryptor()

    Dim Buffer() As Byte 

    Buffer = System.Text.ASCIIEncoding.ASCII.GetBytes(Plaintext)

    EncryptTripleDES = Convert.ToBase64String(
                             DESEncrypt.TransformFinalBlock(Buffer, 0,Buffer.Length))

End Function




See other Scripts in Asp.net encryption

Submit Your Scripts:


System Message:
  • Your ASP & ASP.NET script has been sent. Please allow 48 hours for processing.


If you would like to have your ASP & ASP.NET scripts published in this section please fill out
the form below:
*Your Name or Username:
Home Town:
*Email:
*Description and Code:
*Enter Code shown
to the right:

[ Refresh Image ]