Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7641725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:59:49+00:00 2026-05-31T08:59:49+00:00

Public Shared Function DESEncrypt(ByVal Data As String, ByVal Key As String) As Byte() Dim

  • 0
Public Shared Function DESEncrypt(ByVal Data As String, ByVal Key As String) As Byte()
    Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF}
    Try
        Dim bykey() As Byte = System.Text.Encoding.UTF8.GetBytes(Left(Key, 8))
        Dim InputByteArray() As Byte = System.Text.Encoding.UTF8.GetBytes(Data)
        Dim des As New DESCryptoServiceProvider
        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 ms.ToArray()
    Catch ex As Exception
    End Try
End Function

this is what I currently have for my DES encryption, but as I am fairly new to VB.Net I can figure out how to make it use Triple DES rather than DES

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:59:50+00:00Added an answer on May 31, 2026 at 8:59 am

    Try this

           Public Shared Function DESEncrypt(ByVal Data As String, ByVal Key As String) As Byte()
        Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF}
        Try
            Dim bykey() As Byte = System.Text.Encoding.UTF8.GetBytes(Left(Key, 24))
    
    
            If String.IsNullOrEmpty(Data) Then
    
                Throw New ArgumentException("No data passed", "input")
    
            ElseIf bykey Is Nothing OrElse bykey.Length <> 24 Then
    
                Throw New ArgumentException("Invalid Key. Key must be 24 bytes length", "key")
    
            End If
    
            Dim InputByteArray() As Byte = System.Text.Encoding.UTF8.GetBytes(Data)
    
            Using ms As New IO.MemoryStream
    
                Using des As New Security.Cryptography.TripleDESCryptoServiceProvider
    
    
                    Using cs As New Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(bykey, IV), Security.Cryptography.CryptoStreamMode.Write)
    
                        cs.Write(InputByteArray, 0, InputByteArray.Length)
                        cs.FlushFinalBlock()
                        Return ms.ToArray()
    
                    End Using
    
                End Using
    
            End Using
    
        Catch ex As Exception
        End Try
    
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: Public Shared Function GetListAsString(ByVal data As List(Of String)) As
Here is my function ( updated ): Public Shared Function shortenUrl(ByVal URL As String)
I have an interface like Public Shared Function myfunction(Byval myvar as string, Optional ByVal
I've got this function: Public Shared Function GetQueryStringValue(Of T As Structure)(ByVal queryStringVariable As String)
Function: Public Shared Function ConvertoDate(ByVal dateString As String, ByRef result As DateTime) As Boolean
Public Shared Function GetData(ByVal id As Integer) As List(Of SomeClass) Dim command As New
Consider I have a shared function:- Public Shared Function CalculateAreaFromRadius(ByVal radius As Double) As
I've got this Function: Public Class QueryStringUtil Public Shared Function GetQueryStringValue(Of T As Structure)(ByVal
I like to create an extension method to Image.FromStream Public Shared Function FromStream(ByVal stream
I've made a class to encode a string Public Class UTF8 Public Shared Function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.