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)
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]