udb_hash in php? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: udb_hash in php? (
/showthread.php?tid=369944)
udb_hash in php? -
milanosie - 18.08.2012
Waddup, since I'm not really good with php I'm asking for help here,
is it possible to make udb_hash working in php? I need it for my UCP
This it the original udb_hash stock
pawn Код:
stock udb_hash(buf[]) { //Credits to Dracoblue
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;
}
If possible, how would I go by adding it in a .php file?
Re: udb_hash in php? -
Bews - 12.02.2013
Here u go:
PHP код:
function udb_hash($buf) {
$length=strlen($buf);
$s1 = 1;
$s2 = 0;
for($n=0; $n<$length; $n++)
{
$s1 = ($s1 + ord($buf[$n])) % 65521;
$s2 = ($s2 + $s1) % 65521;
}
return ($s2 << 16) + $s1;
}
Re: udb_hash in php? -
Bews - 13.02.2013
Yeah, but if your player accounts use udb_hash... You will need it to change hash function.
Re: udb_hash in php? -
Bicentric - 13.02.2013
Quote:
Originally Posted by Bews
Yeah, but if your player accounts use udb_hash... You will need it to change hash function.
|
If it's using Alder32 (udb_hash) already then they should change it to SHA512, or Whirlpool, even MD5 or SHA1 would be better than Alder32 and those two aren't so good either.