09.10.2011, 17:09
Hello,
i need to convert one function from pawno to php, i tried to do it like this
Pawno code:
PHP code:
but it doesnt work, if someone knows how please tell me
i need to convert one function from pawno to php, i tried to do it like this
Pawno code:
Код:
stock num_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;
}
Код:
function cryptpw($buf)
{
$length=strlen($buf);
$s1 = 1;
$s2 = 0;
$n;
for ($n=0; $n<$length; $n++) {
$s1 = ($s1 + $buf[$n]) % 65521;
$s2 = ($s2 + $s1) % 65521;
}
return ($s2 << 16) + $s1;
}


