• 0

[VB.Net] Encryption help required !


Question

Hi Guys,

Could someone please give me an example of how use encryption in VB.Net, ie: Encrypted a string so that I can write a password to a dataset and then read it back out of the dataset ?

Any help much appreciated.

Kind Regards

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

here's a sample of encrypting:

dim ftppassword as string = "testing"

Dim des As New TripleDESCryptoServiceProvider
            Dim hashmd5 As New MD5CryptoServiceProvider
            Dim pwdhash As Byte()
            Dim buff As Byte()
            Dim password As String

            password = "randomisbetter"

            pwdhash = hashmd5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(password))
            hashmd5 = Nothing
            des.Key = pwdhash
            des.Mode = CipherMode.ECB
            buff = ASCIIEncoding.ASCII.GetBytes(ftpPassword)
            Dim temp As String = Convert.ToBase64String(des.CreateEncryptor().TransformFinalBlock(buff, 0, buff.Length))
            des = Nothing

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.