We help IT Professionals succeed at work.

How to combine two CRC32 results

Medium Priority
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

Watch Question

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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Was afraid of that :(
Well, thanks anyway.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.