#32393 [NEW]: ...
| From: | crackit at interia dot pl | Date: | Mon, 21 Mar 2005 09:41:53 +0000 |
| Subject: | #32393 [NEW]: ... | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-76687@lists.php.net to get a copy of this message | ||
From: crackit at interia dot pl
Operating system: linux
PHP version: 4.3.10
PHP Bug Type: Unknown/Other Function
Bug description: ...
Description:
------------
I have made a simple hashing function and it returns bad value!
Reproduce code:
---------------
function hash ($MAIL, $PASS)
{
//$amail = str_split($MAIL);
//$apass = str_split($PASS);
$mdl=strlen($MAIL);
for($z=0;$z<$mdl;$z++)
{
$amail[$z] = $MAIL{$z};
}
$pdl=strlen($PASS);
for($z=0;$z<$pdl;$z++)
{
$apass[$z] = $PASS{$z};
}
$tab = array_merge($apass, $amail);
$b = -1;
$i=0;
while( ($c = ord($tab[$i++])) != '' )
{
$a = ($c ^ $b) + ($c << 8);
$b = ($a >> 24) | ($a << 8);
}
return ($b < 0 ? -$b : $b);
}
$m = "test@mail.com";
$p = "testpass";
$fun = hash($m, $p);
Expected result:
----------------
on 3rd or 4th value of calculating hash everything go down ... there is
very small number eg. -16 or sommething but there should be a huge one...
like -4168570667... dudes what to do ??
Actual result:
--------------
best regards :)
--
Edit bug report at http://bugs.php.net/?id=32393&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32393&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32393&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32393&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32393&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32393&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32393&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32393&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32393&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32393&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32393&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32393&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32393&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32393&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32393&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32393&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32393&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32393&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32393&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32393&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32393&r=mysqlcfg