13.02.2010, 18:02
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:
on dudb.inc SAMP:
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; }
Код:
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; }