|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-03-23 18:59 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 02:00:01 2025 UTC |
PHP only has signed integers, use: php -r "printf('%u', crc32('html:hp_taccuino'));" and you see it works fine.