SA-MP Forums Archive
[HELP] Decode udb_hash - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Decode udb_hash (/showthread.php?tid=64348)



[HELP] Decode udb_hash - lea_VA - 03.02.2009

hello, i need a scropt or a function tu decode udb_hash.

udb_hash script is :


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;
}


Please, help my

Thanks


Re: [HELP] Decode udb_hash - Joe Staff - 03.02.2009

You should never need to decode it, just hash what it is you're comparing it to, hash is usually meant for passwords so you really shouldn't get to see it lol


Re: [HELP] Decode udb_hash - maij - 03.02.2009

it maybe sounds dumb to you, but have you try switching the code, positive to negative?

Quote:

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;
}

i dont know how this code does its job, so it was just a random thought:
anyways, the solution shouldnt be that hard, because for any good thing, there is a bad thing, for any beautiful thing, there is a ugly thing etc.