|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-21 11:04 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 18:00:02 2025 UTC |
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 :)