locked
Checksum Value RRS feed

  • Question

  • User337885392 posted

    Hello .

    How can I calculate the checksum value of a string using CRC16 or CRC32 checksum algorithm?

    In VB.NET can I find a function for this problem ?

    Thank You !

    Thursday, May 22, 2008 5:07 PM

Answers

  • User1107498534 posted

     

     right click the website --> add reference --> browse tab --> select the DLL

     

    Dim oCRC as Vbaccelerator.Components.Algorithms.CRC32 = new Vbaccelerator.Components.Algorithms.CRC32()
    Dim oEnc as System.Text.UTF7Encoding = new System.Text.UTF7Encoding()
    Response.Write(oCRC.GetCrc32(new System.IO.MemoryStream(oEnc.GetBytes("Your String"))))

      

    Considering the trouble that you've had trying to reference a external .net assembly and make use of it and debugging your code I strongly suggest that you invest in a VB.Net for beginners book or something similar, you won't be able to make efficient use of .net, or any language until you have the basics covered.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 24, 2008 4:01 AM

All replies

  • User1107498534 posted

    Here is a C# example, if you don't want to port it you could just compile it into a DLL and use that or you could compile it into a DLL, download Lutz Roeder's Reflector from http://www.aisto.com/, reflect the DLL and copy the code out as VB.NET code

    http://www.vbaccelerator.com/home/net/code/libraries/CRC32/Crc32_zip_CRC32_CRC32_cs.asp

    Friday, May 23, 2008 7:00 AM
  • User337885392 posted

    It is much too difficult for me...

    I don't know how to do that...

    Friday, May 23, 2008 8:34 AM
  • User1107498534 posted

     Ok, well then just get the code, add it to a new c# class library, compile it into a DLL and reference that DLL in your project.

    Friday, May 23, 2008 8:41 AM
  • User337885392 posted

    I tryied to do what you said.

    When I try to compile the C# source from the link I get 3 errors....

    I downloaded the file crc32.zip from the same page and I compiled the project as a exe file.

    The file is working fine but the application only calculate the checksum value only for files not for strings.

    Still,I also compiled the project as a dll file but when I try to insert it into Visual Web Developer I can't because I get only errors no mater if I try to use it as .NET Framework Component or as a COM Component.(In C# I specified the target framework : .NET Framework and output type Class Library)

    Thank You !

    Friday, May 23, 2008 12:40 PM
  • User1107498534 posted

     What you need to do is get the CRC32.cs file from the download, create a new c# class lib, add only that file to the project, compile to a DLL, reference that DLL in your project as a .NET component

    from your project call

    GetCrc32(new System.IO.MemoryStream("your string"))

    I'm afraid that I really can't give you any more step by step instructions than these.

    Friday, May 23, 2008 12:56 PM
  • User337885392 posted

    Using the CRC32.cs I finally compiled a error free crc32.dll file and I put it into my BIN folder .

    Now I have other problem....I don't know how to use it.

    Please tell me how to import it inside my aspx page.

     

    Friday, May 23, 2008 1:52 PM
  • User1107498534 posted

     

     right click the website --> add reference --> browse tab --> select the DLL

     

    Dim oCRC as Vbaccelerator.Components.Algorithms.CRC32 = new Vbaccelerator.Components.Algorithms.CRC32()
    Dim oEnc as System.Text.UTF7Encoding = new System.Text.UTF7Encoding()
    Response.Write(oCRC.GetCrc32(new System.IO.MemoryStream(oEnc.GetBytes("Your String"))))

      

    Considering the trouble that you've had trying to reference a external .net assembly and make use of it and debugging your code I strongly suggest that you invest in a VB.Net for beginners book or something similar, you won't be able to make efficient use of .net, or any language until you have the basics covered.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 24, 2008 4:01 AM
  • User337885392 posted

    Thank You Very Much for Your HELP !

    Thanks to you the crc32 is working now.

    Saturday, May 24, 2008 9:39 AM