Kod
stock pass_hash(buf[])
{
new length = strlen(buf);
new s1 = 1, s2 = 0;
for(new n=0; n<length; n++)
{
s1 = (s1 + buf[n] + buf[n]) % 66666;
s2 = (s2 + s1) % 66666;
}
return (s2 << 16) + s1;
}
{
new length = strlen(buf);
new s1 = 1, s2 = 0;
for(new n=0; n<length; n++)
{
s1 = (s1 + buf[n] + buf[n]) % 66666;
s2 = (s2 + s1) % 66666;
}
return (s2 << 16) + s1;
}
Próbowałem ją przerobić na PHP uzyskująć taki efekt
<?php $s1 = 0; $s2 = 1; $buf = 'test'; for( $x = 0; $x < $dlugosc; $x++ ) $s1 = ($s1 + $buf[x] + $buf[x]) % 66666; $s2 = ($s2 + $s1) % 66666; $return = ($s2 << 66) + $s1; ?>
Jednakże, funkcja ta nie działa i wypluwa dwa błędy
Kod
Notice: Use of undefined constant x - assumed 'x' in *:\*\*\*\*\logowanie.php on line 68
Warning: Illegal string offset 'x' in *:\*\*\*\*\logowanie.php on line 68
Warning: Illegal string offset 'x' in *:\*\*\*\*\logowanie.php on line 68
W jaki sposób mogę zrobić to tak, aby działało poprawnie? Wszelka pomoc mile widziana
