ID: 32432 User updated by: alex at primafila dot net Reported By: alex at primafila dot net Status: Bogus Bug Type: *Encryption and hash functions Operating System: Linux, Darwin PHP Version: 4.3.10 New Comment:
Thank you a lot. Not only you were so fast, but you're also right :-) Previous Comments: ------------------------------------------------------------------------ [2005-03-23 19:03:26] [EMAIL PROTECTED] PHP only has signed integers, use: php -r "printf('%u', crc32('html:hp_taccuino'));" and you see it works fine. ------------------------------------------------------------------------ [2005-03-23 18:59:29] alex at primafila dot net Description: ------------ While comparing crc32()'s output with other languages' CRC32 functions I note that sometimes the result is different. Unfortunately all other engines, such as Perl Digest::Crc32, String::CRC32, Archive::Zip, give always the same value. I wasn't able to understand which format leds to this misbehaving, and I also tried to run crc32() of failing strings' MD5 hashes: the result is different. Reproduce code: --------------- #This works: php -r "echo crc32('htmlhptaccuin');" 121189226 perl -MString::CRC32 -e 'print crc32("htmlhptaccuin")' 121189226 #This doesn't: php -r "echo crc32('html:hp_taccuino');" -1565398511 perl -MString::CRC32 -e 'print crc32("html:hp_taccuino")' 2729568785 Expected result: ---------------- I expect to have the same CRC32 hash everywhere, so I expect to get 2729568785 in the above example. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32432&edit=1