udb_hash in php?
#1

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?
Reply
#2

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;

Reply
#3

Yeah, but if your player accounts use udb_hash... You will need it to change hash function.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)