Solved

VB.Net to VB6 Conversion

Posted on 2013-01-05
7
498 Views
Last Modified: 2013-01-05
Hi Experts,

Can anybody convert the following code to VB6?

Private Function SHA512String(ByVal input As String) As String
        Dim data() As Byte = System.Text.Encoding.ASCII.GetBytes(input)
        Dim shaM As New SHA512Managed()
        Dim result() As Byte = shaM.ComputeHash(data)
        Dim output As String = ""
        For Each b As Byte In result
            output += b.ToString("x2")
        Next
        Return output
    End Function
0
Comment
Question by:Soumen-Roy
  • 3
  • 3
7 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38747339
I'm not sure VB6 has a readily available SHA 512 library. You may need to implement your own.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 38747347
I think it would be easier to create a component (.dll) in .Net with this code and use it from VB6.
0
 

Author Comment

by:Soumen-Roy
ID: 38747354
@emoreau

Is it not possible to do that in VB6?

I can make VB.Net dll from that code, say named a.dll. But I don't know how the dll can be called from VB6. Can you please help?

Regards,
Soumen
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 38747376
0
 

Author Comment

by:Soumen-Roy
ID: 38747386
@emoreau,

Thank you for the link, just one more little query, if I make the above function in VB.Net and compile it as dll, then call that dll from VB6 exe, will that VB6 exe need framework as it is calling .net dll or; framework will not needed as it is compiled as COM?

Please help,
Regards,
Soumen
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 38747392
you will need the .Net framework. the good thing is that it is installed on almost all PC now!
0
 

Author Closing Comment

by:Soumen-Roy
ID: 38747393
Thanx for the idea, I will try it, Thanx a lot
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question