Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CRC32 Calculation for VB.Net

Posted on 2004-08-16
2
Medium Priority
?
450 Views
Last Modified: 2008-01-16
Hi!

I need to compare 2 sets of odd data.  I figure a CRC32 check should do the trick.  How?

I've looked at a lot of 3rd party components and I just need something simple like:

MyCRC32 = GetCRC32(Mydata as String)

All I seem to find are mammoth applications with a ton of extra crap.  I don't want to browse for files, set up timers (???) etc.  Just a simple CRC32/MD5/Whatever routine to generate a checksum for a string value.

The simplest solution gets the points.
0
Comment
Question by:MIKEV
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1000 total points
ID: 11814564
 Public Function ComputeMD5Hash(ByVal inputString As String) As String

    Dim md5Provider As New System.Security.Cryptography.MD5CryptoServiceProvider

    Dim bytesInput() As Byte = System.Text.UTF8Encoding.UTF8.GetBytes(inputString)

    Dim bytesHash() As Byte = md5Provider.ComputeHash(bytesInput)

    Return System.Text.UTF8Encoding.UTF8.GetString(bytesHash)

  End Function 'ComputeMD5Hash'

Bob
0
 

Author Comment

by:MIKEV
ID: 11814657
Excellent Bob, as always. :)  Thanks.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

971 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