' The function used to encrypt the text Public Shared Function Encrypt(ByVal tcString As String, ByVal tcKey As String) As String Dim byKey() As Byte = {} Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF} Try byKey = System.Text.Encoding.UTF8.GetBytes(Mid(tcKey, 1, 8)) Dim des As New DESCryptoServiceProvider Dim inputByteArray() As Byte = Encoding.UTF8.GetBytes(tcString) Dim ms As New MemoryStream Dim cs As New CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write) cs.Write(inputByteArray, 0, inputByteArray.Length) cs.FlushFinalBlock() Return Convert.ToBase64String(ms.ToArray()) Catch ex As Exception Return ex.Message End Try End Function