Computer Interfacing
Discussions about interfacing and electronics

# CRC32 check by zero

Author Message
frantzgac
Guest

 Aug 28, 2014 5:20 pm Hello I write C++ and Delphi application wich computes from a file same CRC32 than Total Commander (c) and WinRAR (c). I use CRC32_POLY_WINZIP 0x04C11DB7 as TC and WinRAR I assume my applications give a good result. Theory of CRC gives this equation CRC(X+CRC(X))=0 If a concatene file with its CRC, the CRC of new file is not zero. should someone could explains my mistake ?
gammatester
Guest

Aug 29, 2014 7:03 am

 Quote: Theory of CRC gives this equation CRC(X+CRC(X))=0
This is only valid for school book CRCs where the CRC is the remainder of a polynomial division without pre- and post-conditioning. Your CRC32_POLY_WINZIP 0x04C11DB7 in the implementation of e.g. TC ot Winrar use an initial and final xor of 0xFFFFFFFF. With this (and the correct byte order while appending the outer CRC) you get the magic constant 0x2144DF1C

Example: If you archive the file with the message "Test magic const for CRC32", i.e. in hex 69 63 20 63 6F 6E 73 74 20 66 6F 72 20 43 52 43 33 32 using winrar the CRC32 is 0x02362d8f.

Now append this CRC in little endian 69 63 20 63 6F 6E 73 74 20 66 6F 72 20 43 52 43 33 32 8F 2D 36 02

Archiving this new file give the CRCs 0x2144DF1C.

For more information about this magic constant (and other for different CRC) search and read M. Stigge et al, Reversing CRC - Theory and Practice, HU Berlin Public Report SAR-PR-2006-05

Gammatester
umarsahb
New User

Joined: 13 Mar 2015
Posts: 1

 Mar 13, 2015 11:21 am Hello I write C++ and Delphi application wich computes from a file same CRC32 than Total Commander (c) and WinRAR (c). I use CRC32_POLY_WINZIP 0x04C11DB7 as TC and WinRAR I assume my applications give a good result. ____________________________ raza

 Page 1 of 1

Running on php BB © 2001, 2009 php BB Group