php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47467 The crc32b polynomial result has a wrong endianess
Submitted: 2009-02-20 21:24 UTC Modified: 2009-02-27 20:47 UTC
From: php at twinmail dot de Assigned: pajoye (profile)
Status: Not a bug Package: hash related
PHP Version: 5.2.8 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at twinmail dot de
New email:
PHP Version: OS:

 

 [2009-02-20 21:24 UTC] php at twinmail dot de
Description:
------------
The polynomial result of the crc32b hash function has since 5.2.8 a wrong byte endianess on Windows. This also affects the CVS snapshot. I cannot reproduce this error on any linux (debian / debian / gentoo / opensuse) box I have, so I think this bug only affects Windows versions.

I tested different versions of PHP on my Windows system:

PHP 5.2.9RC4-dev (cli) (built: Feb 20 2009 15:57:39): affected
PHP 5.2.8 (cli) (built: Dec  8 2008 19:31:23): affected
PHP 5.2.6 (cli) (built: May  2 2008 18:02:07): NOT affected

The bug #45028 is maybe related to this one.

Reproduce code:
---------------
print hash('crc32b', 'Lorem Ipsum');

Expected result:
----------------
5dd48a35

Actual result:
--------------
358ad45d

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-20 22:21 UTC] pajoye@php.net
Windows has no specific endianess but the processor. However I can reproduce on windows (vc6 and vc9). Weird, needs more analyze.
 [2009-02-27 14:33 UTC] pajoye@php.net
Are you sure you are using the same PHP version on all systems (try 5.2.8 on linux)?

I can't reproduce the problem on any of my tests hosts. The only difference is with php version prior to 5.2.6, but that's due to the bug #45028 which is now fixed.
 [2009-02-27 20:35 UTC] php at twinmail dot de
You are right: I tested this issue against PHP versions on linux which were below 5.2.8 and therefore affected by #45028. Before posting a new bug I also checked against some online calculators of crc32b, but they were also affected by #45028. So I thought "5dd48a35" is the correct result, but it isn't! "358ad45d" is indeed the correct result, so PHP 5.2.8 is correctly calculating crc32b.

This means everything is fine, except that I am an idiot! ;-) Sorry for reporting this "bug".
 [2009-02-27 20:47 UTC] pajoye@php.net
Not a bug > bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 03:01:28 2024 UTC