php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32393 ...
Submitted: 2005-03-21 10:41 UTC Modified: 2005-03-21 11:04 UTC
From: crackit at interia dot pl Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.10 OS: linux
Private report: No CVE-ID: None
 [2005-03-21 10:41 UTC] crackit at interia dot pl
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 :)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-21 11:04 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:31 2024 UTC