udb_hash DUDB
#1

Hello,

I have a problem with DUDB from dracoblua. I want udb_hash in php, but returns me to a different value (excuse me for the translation [****** translator]). I got it as follows:

Код:
function _udbhash( $pass )
{
  $length = strlen($pass);
  $s1 = 1;
  $s2 = 0;
  
  for($i=0; $i<$length; $i++)
  {
   $s1 = ($s1 + $pass[$i]) % 65521;
   $s2 = ($s2 + $s1)    % 65521;
  }
  return ($s2 << 16) + $s1;  
}
on dudb.inc SAMP:

Код:
stock udb_hash(buf[]) {
	new length=strlen(buf);
  new s1 = 1;
  new s2 = 0;
  new n;
  for (n=0; n<length; n++)
  {
    s1 = (s1 + buf[n]) % 65521;
    s2 = (s2 + s1)   % 65521;
  }
  return (s2 << 16) + s1;
}
Reply


Messages In This Thread
udb_hash DUDB - by gernes - 13.02.2010, 18:02
Re: udb_hash DUDB - by xCoder - 13.02.2010, 18:22
Re: udb_hash DUDB - by gernes - 13.02.2010, 18:22
Re: udb_hash DUDB - by xCoder - 13.02.2010, 18:53
Re: udb_hash DUDB - by Luka P. - 10.03.2010, 16:46
Re: udb_hash DUDB - by mick88 - 31.03.2010, 17:29
Re: udb_hash DUDB - by mick88 - 07.04.2010, 20:13
Re: udb_hash DUDB - by Scienziatopazzo - 18.06.2012, 16:01
Re: udb_hash DUDB - by Revo - 18.06.2012, 16:04

Forum Jump:


Users browsing this thread: 1 Guest(s)