[HELP]Hasher
#1

pawn Код:
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, can anyone explain how the above code works?
Like why we have defined many variables, what are we returning, etc.
Reply
#2

In a Dialog of password, when you want to write it with dini or Y_INI, You udb_hash(inputtext).
Reply
#3

Quote:
Originally Posted by GeekSiMo
Посмотреть сообщение
In a Dialog of password, when you want to write it with dini or Y_INI, You udb_hash(inputtext).
Thanks for the reply, I know why this code is used but I want to know the meaning of the lines in the code like what is happening in

pawn Код:
for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
Reply
#4

Ask DracoBlue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)