#48284 [Asn]: hash "adler32" byte order is reversed

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               48284
 Updated by:       [email protected]
 Reported By:      tyler dot reese at taqua dot com
 Status:           Assigned
 Bug Type:         hash related
 Operating System: *
 PHP Version:      5.2.9
 Assigned To:      scottmac
 New Comment:

Fixed in trunk and for 5.3.1, will do 5.2 shortly.


Previous Comments:
------------------------------------------------------------------------

[2009-05-14 16:20:44] tyler dot reese at taqua dot com

Description:
------------
I'm using the "adler32" algorithm of the PHP hash() function.  The
result that I get has the byte-order reversed from the result I get when
doing the same hash on Python.

From the Python interpreter:
>>> import zlib
>>> hex(zlib.adler32('abc',1))
'0x24d0127'

I saw that a bug addressed this same thing for the crc32 algorithm, but
what about adler32?

Reproduce code:
---------------
<?php
   echo hash("adler32","abc");
?>


Expected result:
----------------
24d0127

Actual result:
--------------
27014d02


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48284&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.