[Botan-devel] Calculating crc32

Jack Lloyd lloyd at randombit.net
Tue Jan 12 20:30:53 EST 2010

On Tue, Jan 12, 2010 at 04:26:45PM -0800, jose jimenez wrote:

> I compiled the 'checksum' example. and run it without any
> problems. the thing is... that the CRC32 reported by the example is
> diferent than the one reported by Winrar/Winzip etc. this is also
> true for md5 hashes.

There are many different 32-bit CRCs [1], and it is possible Zip uses
a different one; I took a look at various docs but could not find
anything about that one way or another. The CRC32 in botan is the IEEE
802.3 Ethernet CRC, which is probably the most common.

However if MD5 hashes are also off, it is likely the problem is that
the Zip/RAR formats only include a portion of the data (for instance
just the plain file data and not the metadata headers - I know next to
nothing about the Zip/RAR formats so that's just an example of one
reason why the checksums you are calculating aren't matching the
values in the file).

Unfortunately the .exe isn't of much use for me in terms of debugging,
both because I mostly run Linux or other Unices, and because without
source it's really hard to see what exactly is going on.


[1] http://en.wikipedia.org/wiki/Cyclic_redundancy_check#Commonly_used_and_standardized_CRCs

More information about the botan-devel mailing list