#32432 [NEW]: crc32() sometimes gives different values than other CRC32 engines
| From: | alex at primafila dot net | Date: | Wed, 23 Mar 2005 17:59:30 +0000 |
| Subject: | #32432 [NEW]: crc32() sometimes gives different values than other CRC32 engines | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-75763@lists.php.net to get a copy of this message | ||
From: alex at primafila dot net
Operating system: Linux, Darwin
PHP version: 4.3.10
PHP Bug Type: *Encryption and hash functions
Bug description: crc32() sometimes gives different values than other CRC32 engines
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 bug report at http://bugs.php.net/?id=32432&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32432&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32432&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32432&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32432&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32432&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32432&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32432&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32432&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32432&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32432&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32432&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32432&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32432&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32432&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32432&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32432&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32432&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32432&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32432&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32432&r=mysqlcfg