Hi,

I have sent this bug-report to debian, as this is the distro I am using. I have found that this topic has been discussed before, but I haven't found any solutions for it on the mailing list. The previous thread is:

http://www.mail-archive.com/[email protected]/msg00293.html

In that thread, somebody sugested there is a simple solution using a one liner, but I fail to see it. Also, in my opinion, the solution is not finding a workarround, but make the CRC32 hash behave consistent with the other existing CRC32 implementations.

And now the bug report:

Package: libcrypto++
Severity: normal

The CryptoPP::CRC32 hasher computes the CRC32 using the wrong
endianness. For example, using:

python> import binascii
python> print "%X" % binascii.crc32("hello")
3610A686

Using libcrypto++, the result is 86A61036.

Many other programs that compute CRC32 sums return the result given by
python and not that returned by libcrypto++.

Here is a simple program that produces the above output:

///////////////////////////////////////////////////////

#include <string>
#include <iostream>

#include <crypto++/crc.h>
#include <crypto++/filters.h>
#include <crypto++/hex.h>

int main()
{
using namespace std;
using namespace CryptoPP;

string sum;
CRC32 hash;

StringSource("hello", true,
new HashFilter(hash,
new HexEncoder(
new StringSink(sum))));

cout << sum << endl;
return 0;
}

///////////////////////////////////////////////////////

This makes the libcrypto++ hard to use for computing CRC32, as any
developer will need to convert the result to the correct one by hand.

-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

TIA,

Ionutz


Reply via email to