How to combine two CRC32 results

Posted on 2009-02-08
Last Modified: 2012-05-06
The thing is, i want to combine two calculated CRC32's...


The CRC32 of GetCRC32(New Byte() {1}) is 1526341860
The CRC32 of GetCRC32(New Byte() {2}) is -1007455906

Now, say i do not have access to the bytes (1 and 2) anymore, but i do have access to the CRC32 results (1526341860 and -1007455906).
Is it possible to combine these results as if the original calculation were GetCRC32(New Byte() {1, 2})?
Public Class Checksum


    Private CRC32Table(255) As Integer


    Public Sub New()


        Dim dwPolynomial As Integer = -306674912

        Dim j, dwCrc As Integer


        For i As Integer = 0 To 255

            dwCrc = i

            For j = 8 To 1 Step -1

                If (dwCrc And 1) Then

                    dwCrc = ((dwCrc And -2) \ 2&) And 2147483647

                    dwCrc = dwCrc Xor dwPolynomial


                    dwCrc = ((dwCrc And -2) \ 2&) And 2147483647

                End If

            Next j

            CRC32Table(i) = dwCrc



    End Sub


    Public Function GetCRC32(ByRef bt() As Byte) As Integer


        Dim CRC32Result As Integer = -1

        Dim iLookup As Integer


        For Each b As Byte In bt


            iLookup = (CRC32Result And 255) Xor b

            CRC32Result = ((CRC32Result And -256) \ 256) And 16777215

            CRC32Result = CRC32Result Xor CRC32Table(iLookup)




        Return CRC32Result


    End Function


End Class

Open in new window

Question by:vigylant
    LVL 41

    Accepted Solution

    The short answer is No...   the CRC algorythm needs to "see" all of the bytes
    LVL 2

    Author Comment

    Was afraid of that :(
    Well, thanks anyway.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now